处理 Linux 内核包时遇到错误

处理 Linux 内核包时遇到错误

Ubuntu 服务器 14.04。

apt-get升级和apt-get autoremove其他以错误结束:

 Errors were encountered while processing:
 linux-image-extra-3.13.0-96-generic
 linux-image-extra-3.19.0-64-generic
 linux-image-extra-3.19.0-65-generic
 linux-image-extra-3.19.0-66-generic
 linux-image-extra-3.19.0-68-generic

它阻止我升级到 16.04 我尝试了很多建议,但都不起作用

有人有什么主意吗?

完整的输出如下:

$ sudo apt-get autoremove
[sudo] password for drousar:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  linux-image-extra-3.13.0-96-generic linux-image-extra-3.19.0-64-generic
  linux-image-extra-3.19.0-65-generic linux-image-extra-3.19.0-66-generic
  linux-image-extra-3.19.0-68-generic
0 upgraded, 0 newly installed, 5 to remove and 11 not upgraded.
20 not fully installed or removed.
After this operation, 793 MB disk space will be freed.
Do you want to continue? [Y/n] Y
dpkg: warning: files list file for package 'linux-headers-3.13.0-103-generic' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-headers-3.13.0-103' missing; assuming package has no files currently installed
(Reading database ... 130673 files and directories currently installed.)
Removing linux-image-extra-3.13.0-96-generic (3.13.0-96.143) ...
depmod: FATAL: could not load /boot/System.map-3.13.0-96-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-96-generic /boot/vmlinuz-3.13.0-96-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-96-generic /boot/vmlinuz-3.13.0-96-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-96-generic
grep: /boot/config-3.13.0-96-generic: No such file or directory
WARNING: missing /lib/modules/3.13.0-96-generic
Device driver support needs thus be built-in linux image!
depmod: ERROR: could not open directory /lib/modules/3.13.0-96-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create file via template ‘/var/tmp/mkinitramfs-FW_XXXXXX’: No such file or directory
update-initramfs: failed for /boot/initrd.img-3.13.0-96-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-3.13.0-96-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-3.19.0-64-generic (3.19.0-64.72~14.04.1) ...
depmod: FATAL: could not load /boot/System.map-3.19.0-64-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.19.0-64-generic /boot/vmlinuz-3.19.0-64-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.19.0-64-generic /boot/vmlinuz-3.19.0-64-generic
update-initramfs: Generating /boot/initrd.img-3.19.0-64-generic
grep: /boot/config-3.19.0-64-generic: No such file or directory
WARNING: missing /lib/modules/3.19.0-64-generic
Device driver support needs thus be built-in linux image!
depmod: ERROR: could not open directory /lib/modules/3.19.0-64-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create file via template ‘/var/tmp/mkinitramfs-FW_XXXXXX’: No such file or directory
update-initramfs: failed for /boot/initrd.img-3.19.0-64-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-3.19.0-64-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-3.19.0-65-generic (3.19.0-65.73~14.04.1) ...
depmod: FATAL: could not load /boot/System.map-3.19.0-65-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.19.0-65-generic /boot/vmlinuz-3.19.0-65-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.19.0-65-generic /boot/vmlinuz-3.19.0-65-generic
update-initramfs: Generating /boot/initrd.img-3.19.0-65-generic
grep: /boot/config-3.19.0-65-generic: No such file or directory
WARNING: missing /lib/modules/3.19.0-65-generic
Device driver support needs thus be built-in linux image!
depmod: ERROR: could not open directory /lib/modules/3.19.0-65-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create file via template ‘/var/tmp/mkinitramfs-FW_XXXXXX’: No such file or directory
update-initramfs: failed for /boot/initrd.img-3.19.0-65-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-3.19.0-65-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-3.19.0-66-generic (3.19.0-66.74~14.04.1) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.19.0-66-generic /boot/vmlinuz-3.19.0-66-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.19.0-66-generic /boot/vmlinuz-3.19.0-66-generic
update-initramfs: Generating /boot/initrd.img-3.19.0-66-generic
mktemp: failed to create file via template ‘/var/tmp/mkinitramfs-FW_XXXXXX’: No such file or directory
update-initramfs: failed for /boot/initrd.img-3.19.0-66-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-3.19.0-66-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Removing linux-image-extra-3.19.0-68-generic (3.19.0-68.76~14.04.1) ...
depmod: FATAL: could not load /boot/System.map-3.19.0-68-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.19.0-68-generic /boot/vmlinuz-3.19.0-68-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.19.0-68-generic /boot/vmlinuz-3.19.0-68-generic
update-initramfs: Generating /boot/initrd.img-3.19.0-68-generic
grep: /boot/config-3.19.0-68-generic: No such file or directory
WARNING: missing /lib/modules/3.19.0-68-generic
Device driver support needs thus be built-in linux image!
depmod: ERROR: could not open directory /lib/modules/3.19.0-68-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create file via template ‘/var/tmp/mkinitramfs-FW_XXXXXX’: No such file or directory
update-initramfs: failed for /boot/initrd.img-3.19.0-68-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-3.19.0-68-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 linux-image-extra-3.13.0-96-generic
 linux-image-extra-3.19.0-64-generic
 linux-image-extra-3.19.0-65-generic
 linux-image-extra-3.19.0-66-generic
 linux-image-extra-3.19.0-68-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

尝试了以下方法:

sudo rm -f /var/lib/dpkg/info/linux-image-extra-{3.13.0-96,3.19.0-64,3.19.0-65,3.19.0-66,3.19.0-68}-generic.postrm
sudo apt-get purge linux-image-extra-{3.13.0-96,3.19.0-64,3.19.0-65,3.19.0-66,3.19.0-68}-generic

输出:

drousar@ubk-ubuntu-test:~$ sudo rm -f /var/lib/dpkg/info/linux-image-extra-{3.13.0-96,3.19.0-64,3.19.0-65,3.19.0-66,3.19.0-68}-generic.postrm
[sudo] password for drousar:
drousar@ubk-ubuntu-test:~$ sudo apt-get purge linux-image-extra-{3.13.0-96,3.19.0-64,3.19.0-65,3.19.0-66,3.19.0-68}-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  linux-image-extra-3.13.0-96-generic linux-image-extra-3.19.0-64-generic
  linux-image-extra-3.19.0-65-generic linux-image-extra-3.19.0-66-generic
  linux-image-extra-3.19.0-68-generic
0 upgraded, 0 newly installed, 5 to remove and 11 not upgraded.
20 not fully installed or removed.
After this operation, 793 MB disk space will be freed.
Do you want to continue? [Y/n]
dpkg: warning: files list file for package 'linux-headers-3.13.0-103-generic' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-headers-3.13.0-103' missing; assuming package has no files currently installed
(Reading database ... 130673 files and directories currently installed.)
Removing linux-image-extra-3.13.0-96-generic (3.13.0-96.143) ...
Removing linux-image-extra-3.19.0-64-generic (3.19.0-64.72~14.04.1) ...
Removing linux-image-extra-3.19.0-65-generic (3.19.0-65.73~14.04.1) ...
Removing linux-image-extra-3.19.0-66-generic (3.19.0-66.74~14.04.1) ...
Removing linux-image-extra-3.19.0-68-generic (3.19.0-68.76~14.04.1) ...
Setting up linux-image-3.13.0-103-generic (3.13.0-103.150) ...
Setting up linux-image-3.13.0-105-generic (3.13.0-105.152) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
The link /initrd.img is a dangling linkto /boot/initrd.img-3.19.0-77-generic
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-105-generic /boot/vmlinuz-3.13.0-105-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-105-generic /boot/vmlinuz-3.13.0-105-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-105-generic
mktemp: failed to create file via template ‘/var/tmp/mkinitramfs-FW_XXXXXX’: No such file or directory
update-initramfs: failed for /boot/initrd.img-3.13.0-105-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-3.13.0-105-generic.postinst line 1025.
dpkg: error processing package linux-image-3.13.0-105-generic (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up linux-image-3.13.0-96-generic (3.13.0-96.143) ...
Setting up linux-image-3.19.0-64-generic (3.19.0-64.72~14.04.1) ...
Setting up linux-image-3.19.0-65-generic (3.19.0-65.73~14.04.1) ...
Setting up linux-image-3.19.0-66-generic (3.19.0-66.74~14.04.1) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Failed to symbolic-link boot/initrd.img-3.19.0-66-generic to initrd.img:File exists at /var/lib/dpkg/info/linux-image-3.19.0-66-generic.postinst line 629.
dpkg: error processing package linux-image-3.19.0-66-generic (--configure):
 subprocess installed post-installation script returned error exit status 17
Setting up linux-image-3.19.0-68-generic (3.19.0-68.76~14.04.1) ...
Setting up linux-image-3.19.0-77-generic (3.19.0-77.85~14.04.1) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
The link /initrd.img is a dangling linkto /boot/initrd.img-3.13.0-105-generic
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.19.0-77-generic /boot/vmlinuz-3.19.0-77-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.19.0-77-generic /boot/vmlinuz-3.19.0-77-generic
update-initramfs: Generating /boot/initrd.img-3.19.0-77-generic
mktemp: failed to create file via template ‘/var/tmp/mkinitramfs-FW_XXXXXX’: No such file or directory
update-initramfs: failed for /boot/initrd.img-3.19.0-77-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-3.19.0-77-generic.postinst line 1025.
dpkg: error processing package linux-image-3.19.0-77-generic (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of linux-image-extra-3.13.0-105-generic:
 linux-image-extra-3.13.0-105-generic depends on linux-image-3.13.0-105-generic; however:
  Package linux-image-3.13.0-105-generic is not configured yet.

dpkg: error processing package linux-image-extra-3.13.0-105-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-3.13.0-105-generic; however:
  Package linux-image-3.13.0-105-generic is not configured yet.
 linux-image-generic depends on linux-image-extra-3.13.0-105-generic; however:
  Package linux-image-extra-3.13.0-105-generic is not configured yet.

dpkg: error processing package linux-image-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
 linux-generic depends on linux-image-generic (= 3.13.0.105.113); however:
  Package linux-image-generNo apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
ic is not configured yet.

dpkg: error processing package linux-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image-extra-3.19.0-77-generic:
 linux-image-extra-3.19.0-77-generic depends on linux-image-3.19.0-77-generic; however:
  Package linux-image-3.19.0-77-generic is not configured yet.

dpkg: error processing package linux-image-extra-3.19.0-77-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image-generic-lts-vivid:
 linux-image-generic-lts-vivid depends on linux-image-3.19.0-77-generic; however:
  Package linux-image-3.19.0-77-generic is not configured yet.
 linux-image-generic-lts-vivid depends on linux-image-extra-3.19.0-77-generic; however:
  Package linux-image-extra-3.19.0-77-generic is not configured yet.

dpkg: error processing package linux-image-generic-lts-vivid (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic-lts-vivid:
 linux-generic-lts-vivid depends on linux-image-generic-lts-vivid (= 3.19.0.77.59); however:
  Package linux-image-generic-lts-vivid is not configured yet.

dpkg: error processing package linux-generic-lts-vivid (--configure):
 dependency problems - leaving unconfigured
Setting up linux-image-extra-3.13.0-103-generic (3.13.0-103.150) ...
depmod: FATAL: could not load /boot/System.map-3.13.0-103-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-103-generic /boot/vmlinuz-3.13.0-103-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-103-generic /boot/vmlinuz-3.13.0-103-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-103-generic
grep: /boot/config-3.13.0-103-generic: No such file or directory
WARNING: missing /lib/modules/3.13.0-103-generic
Device driver support needs thus be built-in linux image!
depmod: ERROR: could not open directory /lib/modules/3.13.0-103-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create file via template ‘/var/tmp/mkinitramfs-FW_XXXXXX’: No such file or directory
update-initramfs: failed for /boot/initrd.img-3.13.0-103-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-3.13.0-103-generic (--configure):
 subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
 linux-image-3.13.0-105-generic
 linux-image-3.19.0-66-generic
 linux-image-3.19.0-77-generic
 linux-image-extra-3.13.0-105-generic
 linux-image-generic
 linux-generic
 linux-image-extra-3.19.0-77-generic
 linux-image-generic-lts-vivid
 linux-generic-lts-vivid
 linux-image-extra-3.13.0-103-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

所有这些linux-image-extra-*软件包都依赖于它们各自的linux-image-*对应软件包。其中包括使用这些软件包资源的删除后脚本(在删除软件包后执行的一系列命令)。

在这种特殊情况下,强制删除而不执行删除后脚本应该是安全的。不幸的是,没有包管理器选项可以做到这一点,但您可以删除有问题的脚本文件,然后正常删除包:

sudo rm -f /var/lib/dpkg/info/linux-image-extra-{3.13.0-96,3.19.0-64,3.19.0-65,3.19.0-66,3.19.0-68}-generic.postrm
sudo apt-get purge linux-image-extra-{3.13.0-96,3.19.0-64,3.19.0-65,3.19.0-66,3.19.0-68}-generic

相关内容