apt-get 无法安装/删除 linux-image-4.2.0-25-generic

apt-get 无法安装/删除 linux-image-4.2.0-25-generic

我尝试在 Xubuntu 15.10 系统上通过 安装软件包 ( jsonlint) apt-get,但由于安装错误而失败linux-image-4.2.0-25-generic。这是 2016 年 1 月 15 日全新安装的 15.10

我尝试过独立

sudo apt-get install linux-image-4.2.0-25-generic

并且失败了。我也无法删除linux-image-4.2.0-25-genericlinux-image-4.2.0-23-generic在 中处于活动状态/boot并且可以通过 正确启动grub,但是这些损坏的 -25 工件阻止了更新。

无法删除或安装内核没有帮助

以下是我尝试安装/删除时的日志。我不使用 lilo,所以我不知道这些错误是什么意思,或者如何忽略它们。

我该如何清理它以便可以安装其他软件包?apt-get --force-yes听起来很危险;有没有更好的办法?

上次安装失败后我尝试删除:

$ uname -r
4.2.0-23-generic
$ sudo apt-get update
...
$ sudo apt-get remove linux-image-4.2.0-25-generic
(Reading database ... 208105 files and directories currently installed.)
Removing linux-generic (4.2.0.25.27) ...
Removing linux-image-generic (4.2.0.25.27) ...
Removing linux-image-extra-4.2.0-25-generic (4.2.0-25.30) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
update-initramfs: Generating /boot/initrd.img-4.2.0-25-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
run-parts: executing /etc/kernel/postinst.d/zz-runlilo 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
Warning: LBA32 addressing assumed
Fatal: raid_setup: stat("/dev/sdb")
run-parts: /etc/kernel/postinst.d/zz-runlilo exited with return code 1
dpkg: error processing package linux-image-extra-4.2.0-25-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-4.2.0-25-generic (4.2.0-25.30) ...
Examining /etc/kernel/prerm.d.
run-parts: executing /etc/kernel/prerm.d/dkms 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
dkms: removing: vboxhost 5.0.12 (4.2.0-25-generic) (x86_64)

-------- Uninstall Beginning --------
Module:  vboxhost
Version: 5.0.12
Kernel:  4.2.0-25-generic (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

vboxdrv.ko:
 - Uninstallation
   - Deleting from: /lib/modules/4.2.0-25-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


vboxnetflt.ko:
 - Uninstallation
   - Deleting from: /lib/modules/4.2.0-25-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


vboxnetadp.ko:
 - Uninstallation
   - Deleting from: /lib/modules/4.2.0-25-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


vboxpci.ko:
 - Uninstallation
   - Deleting from: /lib/modules/4.2.0-25-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod....

DKMS: uninstall completed.
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
update-initramfs: Deleting /boot/initrd.img-4.2.0-25-generic
run-parts: executing /etc/kernel/postrm.d/zz-runlilo 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
Warning: LBA32 addressing assumed
Fatal: raid_setup: stat("/dev/sdb")
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.2.0-23-generic
Found initrd image: /boot/initrd.img-4.2.0-23-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
Found Ubuntu 14.04.3 LTS (14.04) on /dev/sda5
done
The link /vmlinuz is a damaged link
Removing symbolic link vmlinuz
 you may need to re-run your boot loader[grub]
The link /initrd.img is a damaged link
Removing symbolic link initrd.img
 you may need to re-run your boot loader[grub]
Removing linux-firmware (1.149.3) ...
Errors were encountered while processing:
 linux-image-extra-4.2.0-25-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
Failed to perform requested operation on package.  Trying to recover:

Current status: 1 (+1) broken.

我尝试安装以查看是否能修补它:

$ sudo apt-get install linux-image-4.2.0-25-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  fdutils linux-doc-4.2.0 linux-source-4.2.0 linux-tools
The following packages will be REMOVED:
  linux-image-extra-4.2.0-25-generic
The following NEW packages will be installed:
  linux-image-4.2.0-25-generic
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/17.3 MB of archives.
After this operation, 112 MB disk space will be freed.
Do you want to continue? [Y/n] y
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
(Reading database ... 201526 files and directories currently installed.)
Removing linux-image-extra-4.2.0-25-generic (4.2.0-25.30) ...
depmod: FATAL: could not load /boot/System.map-4.2.0-25-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
update-initramfs: Generating /boot/initrd.img-4.2.0-25-generic
depmod: WARNING: could not open /var/tmp/mkinitramfs_2vAXLr/lib/modules/4.2.0-25-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_2vAXLr/lib/modules/4.2.0-25-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
run-parts: executing /etc/kernel/postinst.d/zz-runlilo 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
Warning: LBA32 addressing assumed
Fatal: raid_setup: stat("/dev/sdb")
run-parts: /etc/kernel/postinst.d/zz-runlilo exited with return code 1
dpkg: error processing package linux-image-extra-4.2.0-25-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-4.2.0-25-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

我再次尝试将其删除:

$ sudo apt-get remove linux-image-4.2.0-25-generic
Building dependency tree
Reading state information... Done
Package 'linux-image-4.2.0-25-generic' is not installed, so not removed
The following packages will be REMOVED:
  linux-image-extra-4.2.0-25-generic
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 162 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 201526 files and directories currently installed.)
Removing linux-image-extra-4.2.0-25-generic (4.2.0-25.30) ...
depmod: FATAL: could not load /boot/System.map-4.2.0-25-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
update-initramfs: Generating /boot/initrd.img-4.2.0-25-generic
depmod: WARNING: could not open /var/tmp/mkinitramfs_RhzV1u/lib/modules/4.2.0-25-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_RhzV1u/lib/modules/4.2.0-25-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
run-parts: executing /etc/kernel/postinst.d/zz-runlilo 4.2.0-25-generic /boot/vmlinuz-4.2.0-25-generic
Warning: LBA32 addressing assumed
Fatal: raid_setup: stat("/dev/sdb")
run-parts: /etc/kernel/postinst.d/zz-runlilo exited with return code 1
dpkg: error processing package linux-image-extra-4.2.0-25-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-4.2.0-25-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

更多信息:

$ apt-cache policy linux-image-generic
linux-image-generic:
  Installed: (none)
  Candidate: 4.2.0.25.27
  Version table:
     4.2.0.25.27 0
        500 http://us.archive.ubuntu.com/ubuntu/ wily-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ wily-security/main amd64 Packages
     4.2.0.16.18 0
        500 http://us.archive.ubuntu.com/ubuntu/ wily/main amd64 Packages

答案1

我想我已经解决了我的问题——我深入研究了那些故障日志并发现了一些 lilo 错误。

Fatal: raid_setup: stat("/dev/sdb")
run-parts: /etc/kernel/postinst.d/zz-runlilo exited with return code 1

我(认为)没有使用 lilo,因为它在 Ubuntu 安装过程中失败了,所以我改用 grub。但显然系统认为 lilo 已安装/处于活动状态。该/etc/lilo.conf文件指向旧位置。我重命名了我的/etc/lilo.conf文件并重新运行liloconfig,现在dpkg尝试卸载 4.2.0-25 或安装其他软件包时不会崩溃。

相关内容