我正在使用 Ubuntu 19.04,并且不断出现sudo apt upgrade
故障错误,当我运行时sudo apt install --fix-broken
,我得到以下输出:
sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
libreoffice-common
The following NEW packages will be installed
libreoffice-common
0 to upgrade, 1 to newly install, 0 to remove and 10 not to upgrade.
19 not fully installed or removed.
Need to get 0 B/33.2 MB of archives.
After this operation, 86.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 428397 files and directories currently installed.)
Preparing to unpack .../libreoffice-common_1%3a6.2.3-0ubuntu0.19.04.1_all.deb ...
Unpacking libreoffice-common (1:6.2.3-0ubuntu0.19.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/libreoffice-common_1%3a6.2.3-0ubuntu0.19.04.1_all.deb (--unpack):
unable to open '/usr/share/libreoffice/share/config/images_helpimg.zip.dpkg-new': Operation not permitted
rmdir: failed to remove '/var/lib/libreoffice/share/prereg/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice/share/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice/program/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice': No such file or directory
Errors were encountered while processing:
/var/cache/apt/archives/libreoffice-common_1%3a6.2.3-0ubuntu0.19.04.1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
使用 sudo 检查你被授予了哪些权限:
sudo -l
这应该给你以下几行:
User root may run the following commands on xyzzy:
(ALL : ALL) ALL
如果您没有得到该信息(没有完全权限),请尝试以 root 身份运行 apt:
sudo -g root apt ...
如果您确实拥有完全的权限……好吧,让我们具体一点。
我查看了我的系统,它有 libreoffice,而我没有/usr/share/libreoffice/share/config/images_helpimg.zip.dpkg-new
。一切似乎都运行正常。不过,让我们看一下目录:
ls -l -d /usr/share/libreoffice/share/config
希望这个回复的第一部分是这样的
drwxr-xr-x
如果不是,我会让你使用 chmod 来实现这一点(man chmod
将解释如何使用它)。
然后看一下目录中的文件:
ls -l /usr/share/libreoffice/share/config
我的系统显示:
-rw-r--r-- 1 root root 1337709 Jan 23 17:51 images_breeze.zip
-rw-r--r-- 1 root root 3084230 Jan 23 17:51 images_galaxy.zip
-rw-r--r-- 1 root root 2079435 Jan 23 17:51 images_oxygen.zip
-rw-r--r-- 1 root root 7845910 Jan 23 17:51 images_tango.zip
对你来说,最重要的部分是第一个权限块。对于 root (rw-),所有内容都应是可读写的,对于其他人 (r--r--),至少是可读的。
如果一切正常,那么我能想到的建议就是删除 libreoffice 并重新安装。但首先请确保您的软件包是最新的,并且为了确保万无一失,我还建议您进行全面升级。所以,
apt update
apt upgrade
看看这是否解决了你的问题。如果没有:
apt remove libreoffice
如果有问题的文件仍然存在(ls -l /usr/share/libreoffice/share/config
),则继续
apt autoremove
然后再把 libreoffice 放回去
apt install libreoffice
我将为你祈祷。