apt-get 升级失败并显示“权限被拒绝”

Mar*_*zio 5 installation apt dpkg gtk

我最近安装了 12.04 并且一切似乎都很好,直到今天我在尝试运行时遇到一系列错误apt-get upgrade

$ sudo apt-get upgrade 

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  visual-regexp
The following packages will be upgraded:
  dkms firefox firefox-globalmenu firefox-gnome-support 
  firefox-locale-en gnome-games-data gnome-sudoku gnomine
  google-chrome-stable libglu1-mesa libglu1-mesa:i386 libmysqlclient18:i386 
  mahjongg mysql-common tk8.5 vino
16 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
11 not fully installed or removed.
Need to get 0 B/67.4 MB of archives.
After this operation, 2,890 kB of additional disk space will be used.
Do you want to continue [Y/n]? 
(Reading database ... 
dpkg: warning: files list file for package `tk8.5' missing, assuming package has no     files currently installed.
(Reading database ... 235237 files and directories currently installed.)
    Removing visual-regexp ...
dpkg (subprocess): unable to execute installed post-removal script (/var/lib/dpkg/info/visual-regexp.postrm): Permission denied
dpkg: error processing visual-regexp (--remove):
 subprocess installed post-removal script returned error exit status 2
Errors were encountered while processing:
     visual-regexp
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)

这一切似乎都始于这个臭名昭著的错误:

dpkg: warning: files list file for package `tk8.5' missing, 
assuming package has no files currently installed.
Run Code Online (Sandbox Code Playgroud)

这可能是由我的安装引起的visual-regexp- 我现在无法删除。

我尝试了几种修复方法,包括:

sudo apt-get -f install
sudo dpkg --configure -a
sudo apt-get --fix-missing upgrade
Run Code Online (Sandbox Code Playgroud)

和其他人,试图遵循这个答案,但无济于事。

另外,我不太清楚 可能有什么问题permission,因为我显然正在运行 apt-get 作为sudo

$ ll /var/lib/dpkg/info/visual-regexp.postrm
-rwxr-xr-x 1 root root 160 Jun 24  2011 /var/lib/dpkg/info/visual-regexp.postrm
Run Code Online (Sandbox Code Playgroud)

另外,请注意11 not fully installed or removed.这是由于之前的失败造成的apt-get upgrade:有没有办法从中恢复?

提前致谢,马可。

Jor*_*tro 3

OP发布:

所以,我突然意识到权限被拒绝的事情可能与noexec选项有关/etc/fstab(我安装/var在与 不同的磁盘上/)。

结果我使用了以下安装选项:

UUID=b5ae50cf-58e6-46f8-8313-6c1492dcc8ad /var ext4 defaults,users 0 0 
Run Code Online (Sandbox Code Playgroud)

并且, whiledefaults暗示execusers相反 暗示noexec- 由于后者是最后一个,它将覆盖前一个。

将其更改为defaults only,现在一切都是小马和阳光与 apt-get 。把它留在这里,以防它对其他人有帮助。