我的 Ubuntu 服务器目前有几个问题。使用 apt 时,它告诉我:
The following packages will be REMOVED
linux-restricted-modules-2.6.28-11-server
linux-restricted-modules-2.6.28-19-server
但卸载失败,因为目录和图像已经不存在。
dkpg --list | grep linux-restricted-modules
...返回此信息:
rH linux-restricted-modules-2.6.28-11-server 2.6.28-11.15
rH linux-restricted-modules-2.6.28-19-server 2.6.28-19.24
所以 r 表示我想要将其删除,而我认为 H 表示它在系统中只有一半存在,或者其他什么?
我该如何删除这个包的剩余内容以便不再接收这些错误消息?
谢谢。
编辑: apt-get upgrade 的完整输出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED
linux-restricted-modules-2.6.28-11-server linux-restricted-modules-2.6.28-19-server
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 5,046kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 59849 files and directories currently installed.)
Removing linux-restricted-modules-2.6.28-11-server ...
rmdir: failed to remove `/lib/modules/2.6.28-11-server/volatile/': No such file or directory
FATAL: Could not open '/boot/System.map-2.6.28-11-server': No such file or directory
update-initramfs: Generating /boot/initrd.img-2.6.28-11-server
Cannot find /lib/modules/2.6.28-11-server
update-initramfs: failed for /boot/initrd.img-2.6.28-11-server
dpkg: error processing linux-restricted-modules-2.6.28-11-server (--remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-restricted-modules-2.6.28-19-server ...
rmdir: failed to remove `/lib/modules/2.6.28-19-server/volatile/': No such file or directory
FATAL: Could not open '/boot/System.map-2.6.28-19-server': No such file or directory
update-initramfs: Generating /boot/initrd.img-2.6.28-19-server
Cannot find /lib/modules/2.6.28-19-server
update-initramfs: failed for /boot/initrd.img-2.6.28-19-server
dpkg: error processing linux-restricted-modules-2.6.28-19-server (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-restricted-modules-2.6.28-11-server
linux-restricted-modules-2.6.28-19-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
找到该/var/lib/dpkg/info/linux-restricted-modules-2.6.28-11-server.postrm
文件并将其移动到其他位置,例如
sudo mv /var/lib/dpkg/info/linux-restricted-modules-2.6.28-11-server.postrm /var/tmp
然后再次运行apt-get upgrade
。如果成功,对另一个包执行相同操作。
这不是最好的方法,但应该可行。脚本postrm
失败,因为您不再2.6.28-11-server
安装内核。