depmod:严重:无法加载 /boot/System.map-4.10.0-19-generic

depmod:严重:无法加载 /boot/System.map-4.10.0-19-generic

我已经升级了我的Ubuntu 17.04 升级至 Ubuntu 17.10既然我已这么做了,我 无法再安装任何程序

如果我尝试安装某物,则会出现以下错误。

~$ sudo apt-get install ...

Removing linux-image-extra-4.10.0-19-generic (4.10.0-19.21) ...
depmod: FATAL: could not load /boot/System.map-4.10.0-19-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-19-generic /boot/vmlinuz-4.10.0-19-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.10.0-19-generic /boot/vmlinuz-4.10.0-19-generic

似乎在安装任何东西之前,安装程序都会尝试删除我的 /boot 文件夹中不存在的系统映像。

有人能帮我解决这个问题吗?

根据已咨询的相关问题提供更多潜在有用信息1

/启动

 ~$ ls -la /boot

    total 125236
    drwxr-xr-x 3 root root 4096 mar 7 11:05 .
    drwxr-xr-x 27 root root 4096 mar 5 10:10 ..
    -rw-r--r-- 1 root root 1443962 dic 4 15:04 abi-4.10.0-42-generic
    -rw-r--r-- 1 root root 1501359 feb 16 18:49 abi-4.13.0-36-generic
    -rw-r--r-- 1 root root 204962 dic 4 15:04 config-4.10.0-42-generic
    -rw-r--r-- 1 root root 213212 feb 16 18:49 config-4.13.0-36-generic
    drwxr-xr-x 5 root root 4096 mar 7 11:05 grub
    -rw-r--r-- 1 root root 42833675 mar 5 10:12 initrd.img-4.10.0-42-generic
    -rw-r--r-- 1 root root 58376815 mar 7 10:59 initrd.img-4.13.0-36-generic
    -rw-r--r-- 1 root root 182704 gen 28 2016 memtest86+.bin
    -rw-r--r-- 1 root root 184380 gen 28 2016 memtest86+.elf
    -rw-r--r-- 1 root root 184840 gen 28 2016 memtest86+_multiboot.bin
    -rw-r--r-- 1 root root 2860 feb 16 18:49 retpoline-4.13.0-36-generic
    -rw------- 1 root root 3722463 dic 4 15:04 System.map-4.10.0-42-generic
    -rw------- 1 root root 3880918 feb 16 18:49 System.map-4.13.0-36-generic
    -rw------- 1 root root 7587600 dic 4 15:04 vmlinuz-4.10.0-42-generic
    -rw------- 1 root root 7870224 feb 16 18:49 vmlinuz-4.13.0-36-generic

dkms 状态

 ~$ dkms status
    bbswitch, 0.8, 4.10.0-42-generic, x86_64: installed
    bbswitch, 0.8, 4.13.0-36-generic, x86_64: installed
    nvidia-384, 384.111, 4.10.0-42-generic, x86_64: installed
    nvidia-384, 384.111, 4.13.0-36-generic, x86_64: installed
    virtualbox, 5.1.30, 4.10.0-42-generic, x86_64: installed
    virtualbox, 5.1.30, 4.13.0-36-generic, x86_64: installed

Linux 映像

~$ ls -l /var/lib/dpkg/info/linux-image-*
-rw-r--r-- 1 root root  82412 dic 11 11:08 /var/lib/dpkg/info/linux-image-4.10.0-42-generic.list
-rw-r--r-- 1 root root 101208 dic  4 15:04 /var/lib/dpkg/info/linux-image-4.10.0-42-generic.md5sums
-rwxr-xr-x 1 root root  40162 dic  4 15:04 /var/lib/dpkg/info/linux-image-4.10.0-42-generic.postinst
-rwxr-xr-x 1 root root  13727 dic  4 15:04 /var/lib/dpkg/info/linux-image-4.10.0-42-generic.postrm
-rwxr-xr-x 1 root root  11581 dic  4 15:04 /var/lib/dpkg/info/linux-image-4.10.0-42-generic.preinst
-rwxr-xr-x 1 root root  11391 dic  4 15:04 /var/lib/dpkg/info/linux-image-4.10.0-42-generic.prerm
-rw-r--r-- 1 root root  82856 mar  5 10:09 /var/lib/dpkg/info/linux-image-4.13.0-36-generic.list
-rw-r--r-- 1 root root 101687 feb 16 18:49 /var/lib/dpkg/info/linux-image-4.13.0-36-generic.md5sums
-rwxr-xr-x 1 root root  40162 feb 16 18:49 /var/lib/dpkg/info/linux-image-4.13.0-36-generic.postinst
-rwxr-xr-x 1 root root  13727 feb 16 18:49 /var/lib/dpkg/info/linux-image-4.13.0-36-generic.postrm
-rwxr-xr-x 1 root root  11581 feb 16 18:49 /var/lib/dpkg/info/linux-image-4.13.0-36-generic.preinst
-rwxr-xr-x 1 root root  11391 feb 16 18:49 /var/lib/dpkg/info/linux-image-4.13.0-36-generic.prerm
-rw-r--r-- 1 root root      0 mar 16 14:03 /var/lib/dpkg/info/linux-image-extra-4.10.0-19-generic.list
-rw-r--r-- 1 root root 415834 apr  6  2017 /var/lib/dpkg/info/linux-image-extra-4.10.0-19-generic.md5sums
-rwxr-xr-x 1 root root    391 apr  6  2017 /var/lib/dpkg/info/linux-image-extra-4.10.0-19-generic.postinst
-rwxr-xr-x 1 root root    391 apr  6  2017 /var/lib/dpkg/info/linux-image-extra-4.10.0-19-generic.postrm
-rw-r--r-- 1 root root 345004 dic 11 11:08 /var/lib/dpkg/info/linux-image-extra-4.10.0-42-generic.list
-rw-r--r-- 1 root root 416179 dic  4 15:04 /var/lib/dpkg/info/linux-image-extra-4.10.0-42-generic.md5sums
-rwxr-xr-x 1 root root    391 dic  4 15:04 /var/lib/dpkg/info/linux-image-extra-4.10.0-42-generic.postinst
-rwxr-xr-x 1 root root    391 dic  4 15:04 /var/lib/dpkg/info/linux-image-extra-4.10.0-42-generic.postrm
-rw-r--r-- 1 root root 358075 mar  5 10:09 /var/lib/dpkg/info/linux-image-extra-4.13.0-36-generic.list
-rw-r--r-- 1 root root 431457 feb 16 18:49 /var/lib/dpkg/info/linux-image-extra-4.13.0-36-generic.md5sums
-rwxr-xr-x 1 root root    391 feb 16 18:49 /var/lib/dpkg/info/linux-image-extra-4.13.0-36-generic.postinst
-rwxr-xr-x 1 root root    391 feb 16 18:49 /var/lib/dpkg/info/linux-image-extra-4.13.0-36-generic.postrm
-rw-r--r-- 1 root root    162 mar  5 10:09 /var/lib/dpkg/info/linux-image-generic.list
-rw-r--r-- 1 root root    159 feb 16 19:46 /var/lib/dpkg/info/linux-image-generic.md5sums

建议回答

   ~$ dpkg -l "*linux-*" | grep "4.10.0-19" | tr -s ' ' | cut -d' ' -f2
    linux-image-4.10.0-19-generic
    linux-image-extra-4.10.0-19-generic

答案1

升级破坏了 apt 数据库... 这可不是好事,但确实会发生。要修复此问题,您需要手动删除损坏的软件包。

首先找到所有具有该版本的软件包

dpkg -l "*linux-*" | grep "4.10.0-19" | tr -s ' ' | cut -d' ' -f2

然后使用以下命令删除找到的包dpkg --purge

sudo dpkg --purge linux-image-4.10.0-19-generic

如果有新的错误消息,请查看dpkg --force-help

相关内容