一个月前我升级到了 Ubuntu 22.04,升级过程中出现了一些错误,但最终还是完成了。但从那以后我就无法运行 sudo apt upgrade 了。它出现了五个无法创建某些图标的备份链接的错误。
每次我尝试 sudo apt upgrade 时,都会显示类似于下面的错误。(我无法重现确切的错误,因为我尝试删除并重新安装 aptdaemon-data 包)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
aptdaemon-data
0 upgraded, 1 newly installed, 0 to remove and 15 not upgraded.
Need to get 0 B/159 kB of archives.
After this operation, 254 kB of additional disk space will be used.
(Reading database ... 366121 files and directories currently installed.)
Preparing to unpack .../aptdaemon-data_1.1.1+bzr982-0ubuntu39_all.deb ...
Unpacking aptdaemon-data (1.1.1+bzr982-0ubuntu39) ...
dpkg: error processing archive /var/cache/apt/archives/aptdaemon-data_1.1.1+bzr982-0ubuntu39_all.deb (--unpack):
unable to make backup link of './usr/share/icons/hicolor/24x24/status/aptdaemon-cleanup.png' before installing new version: Operation not permitted
Errors were encountered while processing:
/var/cache/apt/archives/aptdaemon-data_1.1.1+bzr982-0ubuntu39_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
我尝试检查标志,结果显示如下
ls -ll /usr/share/icons/hicolor/24x24/status/aptdaemon-cleanup.png
-rw-r--r-- 1 root 8296 1870 Nov 6 1927 /usr/share/icons/hicolor/24x24/status/aptdaemon-cleanup.png
尽管如此,我尝试运行 chattr,但它也不起作用
sudo chattr -ia /usr/share/icons/hicolor/24x24/status/aptdaemon-cleanup.png
chattr: Operation not supported while setting flags on /usr/share/icons/hicolor/24x24/status/aptdaemon-cleanup.png
我卸载并从 livecd 启动并运行 fsck,也没有显示任何错误。
我尝试以 root 身份sudo su
运行 apt upgrade 命令,但出现了同样的错误。
我尝试删除 aptdaemon-data 包,这个包成功了,但之后我就无法再安装它了。我试了一下,sudo apt upgrade
结果显示有些包被阻止了。我运行sudo apt dist-upgrade
并安装了这些包。现在 apt 说我的系统是最新的。
现在,当我尝试安装 aptdaemon-data 包时,apt 显示上述错误unable to make backup link of './usr/share/icons/hicolor/24x24/status/aptdaemon-cleanup.png' before installing new version: Operation not permitted
此时,我不确定该怎么做,我不知道这个 aptdaemon-data 包是否重要,或者如果没有它我是否可以继续。我不知道这是否会影响未来的更新。任何关于此问题或如何修复该错误的意见都将不胜感激。
我觉得不对劲,图标目录中有一个文件无法以任何方式删除或编辑,即使我是 root 身份。
编辑
跑步lsattr /usr/share/icons/hicolor/24x24/status/aptdaemon-cleanup.png
给予
lsattr /usr/share/icons/hicolor/24x24/status/aptdaemon-cleanup.png
-u---a-Ac---tTe------m /usr/share/icons/hicolor/24x24/status/aptdaemon-cleanup.png
跑步ls -al /usr/share/icons/hicolor/
可以
total 208
drwxr-xr-x 29 root root 4096 Jun 28 07:55 .
drwxr-xr-x 20 root root 4096 Jun 24 23:21 ..
drwxr-xr-x 3 root root 4096 Jun 10 17:18 100x100
drwxr-xr-x 3 root root 4096 Jun 8 2021 1024x1024
drwxr-xr-x 15 root root 4096 Apr 20 2021 128x128
drwxr-xr-x 3 root root 4096 Apr 30 2021 150x150
drwxr-xr-x 3 root root 4096 Apr 30 2021 160x160
drwxr-xr-x 15 root root 4096 Jun 10 17:01 16x16
drwxr-xr-x 15 root root 4096 Apr 20 2021 192x192
drwxr-xr-x 3 root root 4096 Jun 8 2021 20x20
drwxr-xr-x 15 root root 4096 Jun 10 17:01 22x22
drwxr-xr-x 15 root root 4096 Nov 4 2021 24x24
drwxr-xr-x 15 root root 4096 Apr 20 2021 256x256
drwxr-xr-x 3 root root 4096 Jun 8 2021 28x28
drwxr-xr-x 3 root root 4096 Apr 30 2021 30x30
drwxr-xr-x 15 root root 4096 Jun 10 17:01 32x32
drwxr-xr-x 15 root root 4096 Apr 20 2021 36x36
drwxr-xr-x 3 root root 4096 Jun 8 2021 40x40
drwxr-xr-x 3 root root 4096 Apr 26 2021 42x42
drwxr-xr-x 3 root root 4096 Jun 8 2021 480x480
drwxr-xr-x 15 root root 4096 Nov 4 2021 48x48
drwxr-xr-x 3 root root 4096 Apr 30 2021 50x50
drwxr-xr-x 15 root root 4096 Apr 20 2021 512x512
drwxr-xr-x 15 root root 4096 Apr 20 2021 64x64
drwxr-xr-x 15 root root 4096 Apr 20 2021 72x72
drwxr-xr-x 3 root root 4096 Apr 26 2021 8x8
drwxr-xr-x 15 root root 4096 Apr 20 2021 96x96
-rw-r--r-- 1 root root 34992 Jun 28 07:55 icon-theme.cache
-rw-r--r-- 1 root root 55507 Mar 19 2018 index.theme
drwxr-xr-x 15 root root 4096 Apr 25 2021 scalable
drwxr-xr-x 3 root root 4096 Jun 10 17:01 symbolic
答案1
这很少见。嗯。你先试了一遍,然后又试了sudo apt-get install -f
一遍sudo apt update
,或者sudo apt upgrade
下载sudo apt dist-upgrade
.deb 文件。aptdaemon .deb 看看会发生什么!