0

I have upgraded my Ubuntu 17.04 to Ubuntu 17.10 and since I have done it, I cannot install any program anymore.

If I try to install sth, I have the following error.

~$ 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

It seems that before installing anything, the installer tries to remove an unexisitng image of my system in my /boot folder.

Can anyone help me solving this?

Additional potential useful information according to related questions already consulted 1.

/boot

 ~$ 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 status

 ~$ 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-image

~$ 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

Suggested in answer

   ~$ 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

The upgrade broke the apt database... That is not nice, but it happens. In order to fix this issue, you need to manully remove the broken packages.

First find all packages with that version

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

Then remove the found packages with dpkg --purge

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

If there are new error messages take a look at dpkg --force-help

  • Thanks for your answer. Your command gives : linux-image-4.10.0-19-generic linux-image-extra-4.10.0-19-generic . And when I m trying to remove them, sudo dpkg --purge --force-all linux-image-extra-4.10.0-19-generic, same problem : '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 '. When I am trying to remove the other one, sudo dpkg --purge --force-all linux-image-4.10.0-19-generic, I have 'dpkg: warning: ignoring request to remove linux-image-4.10.0-19-generic which isn't installed' – Wraf Mar 16 '18 at 15:31
  • 1
    FIne, it worked!!! Thx! I had to do: 'sudo rm linux-image-extra-4.10.0-19-generic.postrm' in addition before 'sudo dpkg --purge --force-all linux-image-4.10.0-19-generic' as described here: askubuntu.com/questions/48014/… – Wraf Mar 16 '18 at 15:53

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.