cannot remove linux-image-extra-4.10.0-37-generic

Asked by drohhyn on 2017-11-30

Hi,

I am trying to remove the old kernel linux-image-extra-4.10.0-37-generic with sudo apt-get -f autoremove

[...]
After this operation, 132 MB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 285641 files and directories currently installed.)
Removing linux-image-extra-4.10.0-37-generic (4.10.0-37.41) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-37-generic /boot/vmlinuz-4.10.0-37-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.10.0-37-generic /boot/vmlinuz-4.10.0-37-generic
[...]

Nothing happens afterwards, apt is locked and I have to reboot. All installs/upgrades fail due to that issue.

I am running artful, upgraded from zesty.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
2017-12-02
Last query:
2017-12-02
Last reply:
2017-12-02
Manfred Hampl (m-hampl) said : #1

For diagnostic purposes please provide the output that you receive for the commands

uname -a
lsb_release -crid
dpkg -l | grep ' linux-i'
df -h
ls -l /boot
sudo dpkg --audit

drohhyn (drohhyn) said : #2

Here are the requested outputs. The packages not installed yet (winusb and woeusb) seem to fail due to the failing of the remove.

$ uname -a
Linux G-thor 4.13.0-17-generic #20-Ubuntu SMP Mon Nov 6 10:04:08 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -crid
Distributor ID: Ubuntu
Description: Ubuntu 17.10
Release: 17.10
Codename: artful

$ dpkg -l | grep 'linux-i'
rc linux-image-4.10.0-19-generic 4.10.0-19.21 amd64 Linux kernel image for version 4.10.0 on 64 bit x86 SMP
rc linux-image-4.10.0-20-generic 4.10.0-20.22 amd64 Linux kernel image for version 4.10.0 on 64 bit x86 SMP
rc linux-image-4.10.0-21-generic 4.10.0-21.23 amd64 Linux kernel image for version 4.10.0 on 64 bit x86 SMP
rc linux-image-4.10.0-22-generic 4.10.0-22.24 amd64 Linux kernel image for version 4.10.0 on 64 bit x86 SMP
rc linux-image-4.10.0-24-generic 4.10.0-24.28 amd64 Linux kernel image for version 4.10.0 on 64 bit x86 SMP
rc linux-image-4.10.0-26-generic 4.10.0-26.30 amd64 Linux kernel image for version 4.10.0 on 64 bit x86 SMP
rc linux-image-4.10.0-28-generic 4.10.0-28.32 amd64 Linux kernel image for version 4.10.0 on 64 bit x86 SMP
rc linux-image-4.10.0-30-generic 4.10.0-30.34 amd64 Linux kernel image for version 4.10.0 on 64 bit x86 SMP
rc linux-image-4.10.0-33-generic 4.10.0-33.37 amd64 Linux kernel image for version 4.10.0 on 64 bit x86 SMP
rc linux-image-4.10.0-35-generic 4.10.0-35.39 amd64 Linux kernel image for version 4.10.0 on 64 bit x86 SMP
ii linux-image-4.10.0-37-generic 4.10.0-37.41 amd64 Linux kernel image for version 4.10.0 on 64 bit x86 SMP
ii linux-image-4.13.0-16-generic 4.13.0-16.19 amd64 Linux kernel image for version 4.13.0 on 64 bit x86 SMP
ii linux-image-4.13.0-17-generic 4.13.0-17.20 amd64 Linux kernel image for version 4.13.0 on 64 bit x86 SMP
rc linux-image-4.8.0-22-generic 4.8.0-22.24 amd64 Linux kernel image for version 4.8.0 on 64 bit x86 SMP
rc linux-image-4.8.0-26-generic 4.8.0-26.28 amd64 Linux kernel image for version 4.8.0 on 64 bit x86 SMP
rc linux-image-4.8.0-27-generic 4.8.0-27.29 amd64 Linux kernel image for version 4.8.0 on 64 bit x86 SMP
rc linux-image-4.8.0-30-generic 4.8.0-30.32 amd64 Linux kernel image for version 4.8.0 on 64 bit x86 SMP
rc linux-image-4.8.0-32-generic 4.8.0-32.34 amd64 Linux kernel image for version 4.8.0 on 64 bit x86 SMP
rc linux-image-4.8.0-34-generic 4.8.0-34.36 amd64 Linux kernel image for version 4.8.0 on 64 bit x86 SMP
rc linux-image-4.8.0-37-generic 4.8.0-37.39 amd64 Linux kernel image for version 4.8.0 on 64 bit x86 SMP
rc linux-image-4.8.0-39-generic 4.8.0-39.42 amd64 Linux kernel image for version 4.8.0 on 64 bit x86 SMP
rc linux-image-4.8.0-41-generic 4.8.0-41.44 amd64 Linux kernel image for version 4.8.0 on 64 bit x86 SMP
rc linux-image-4.8.0-44-generic 4.8.0-44.47 amd64 Linux kernel image for version 4.8.0 on 64 bit x86 SMP
rc linux-image-4.8.0-45-generic 4.8.0-45.48 amd64 Linux kernel image for version 4.8.0 on 64 bit x86 SMP
rc linux-image-4.8.0-46-generic 4.8.0-46.49 amd64 Linux kernel image for version 4.8.0 on 64 bit x86 SMP
rc linux-image-extra-4.10.0-19-generic 4.10.0-19.21 amd64 Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
rc linux-image-extra-4.10.0-20-generic 4.10.0-20.22 amd64 Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
rc linux-image-extra-4.10.0-21-generic 4.10.0-21.23 amd64 Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
rc linux-image-extra-4.10.0-22-generic 4.10.0-22.24 amd64 Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
rc linux-image-extra-4.10.0-24-generic 4.10.0-24.28 amd64 Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
rc linux-image-extra-4.10.0-26-generic 4.10.0-26.30 amd64 Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
rc linux-image-extra-4.10.0-28-generic 4.10.0-28.32 amd64 Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
rc linux-image-extra-4.10.0-30-generic 4.10.0-30.34 amd64 Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
rc linux-image-extra-4.10.0-33-generic 4.10.0-33.37 amd64 Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
rc linux-image-extra-4.10.0-35-generic 4.10.0-35.39 amd64 Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
rH linux-image-extra-4.10.0-37-generic 4.10.0-37.41 amd64 Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
ii linux-image-extra-4.13.0-16-generic 4.13.0-16.19 amd64 Linux kernel extra modules for version 4.13.0 on 64 bit x86 SMP
ii linux-image-extra-4.13.0-17-generic 4.13.0-17.20 amd64 Linux kernel extra modules for version 4.13.0 on 64 bit x86 SMP
rc linux-image-extra-4.8.0-22-generic 4.8.0-22.24 amd64 Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
rc linux-image-extra-4.8.0-26-generic 4.8.0-26.28 amd64 Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
rc linux-image-extra-4.8.0-27-generic 4.8.0-27.29 amd64 Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
rc linux-image-extra-4.8.0-30-generic 4.8.0-30.32 amd64 Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
rc linux-image-extra-4.8.0-32-generic 4.8.0-32.34 amd64 Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
rc linux-image-extra-4.8.0-34-generic 4.8.0-34.36 amd64 Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
rc linux-image-extra-4.8.0-37-generic 4.8.0-37.39 amd64 Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
rc linux-image-extra-4.8.0-39-generic 4.8.0-39.42 amd64 Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
rc linux-image-extra-4.8.0-41-generic 4.8.0-41.44 amd64 Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
rc linux-image-extra-4.8.0-44-generic 4.8.0-44.47 amd64 Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
rc linux-image-extra-4.8.0-45-generic 4.8.0-45.48 amd64 Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
rc linux-image-extra-4.8.0-46-generic 4.8.0-46.49 amd64 Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
ii linux-image-generic 4.13.0.17.18 amd64 Generic Linux kernel image

$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 7,8G 0 7,8G 0% /dev
tmpfs 1,6G 19M 1,6G 2% /run
/dev/mapper/ubuntu--vg-root 218G 99G 108G 48% /
tmpfs 7,8G 18M 7,8G 1% /dev/shm
tmpfs 5,0M 4,0K 5,0M 1% /run/lock
tmpfs 7,8G 0 7,8G 0% /sys/fs/cgroup
/dev/loop0 84M 84M 0 100% /snap/core/3247
/dev/loop1 68M 68M 0 100% /snap/asunder-casept/1
/dev/loop2 84M 84M 0 100% /snap/core/3440
/dev/loop3 84M 84M 0 100% /snap/core/3017
/dev/sdb2 473M 230M 219M 52% /boot
/dev/sdb1 511M 4,6M 507M 1% /boot/efi
tmpfs 1,6G 12K 1,6G 1% /run/user/128
tmpfs 1,6G 44K 1,6G 1% /run/user/1000
/home/MY_USER/.Private 218G 99G 108G 48% /home/MY_USER
/dev/sdd1 7,5G 40M 7,5G 1% /media/MY_USER/3F1A79AB15249673

$ ls -l /boot
total 224923
-rw-r--r-- 1 root root 1443962 Okt 6 21:45 abi-4.10.0-37-generic
-rw-r--r-- 1 root root 1500286 Okt 11 19:33 abi-4.13.0-16-generic
-rw-r--r-- 1 root root 1500314 Nov 1 16:17 abi-4.13.0-17-generic
-rw-r--r-- 1 root root 204962 Okt 6 21:45 config-4.10.0-37-generic
-rw-r--r-- 1 root root 213028 Okt 11 19:33 config-4.13.0-16-generic
-rw-r--r-- 1 root root 213028 Nov 1 16:17 config-4.13.0-17-generic
drwx------ 3 root root 4096 Jan 1 1970 efi
drwxr-xr-x 5 root root 1024 Nov 25 11:59 grub
-rw-r--r-- 1 root root 52514759 Okt 21 11:05 initrd.img-4.10.0-37-generic
-rw-r--r-- 1 root root 60454081 Nov 11 08:56 initrd.img-4.13.0-16-generic
-rw-r--r-- 1 root root 60450128 Nov 24 13:21 initrd.img-4.13.0-17-generic
drwx------ 2 root root 12288 Okt 30 2016 lost+found
-rw-r--r-- 1 root root 182704 Jan 28 2016 memtest86+.bin
-rw-r--r-- 1 root root 184380 Jan 28 2016 memtest86+.elf
-rw-r--r-- 1 root root 184840 Jan 28 2016 memtest86+_multiboot.bin
-rw------- 1 root root 3722207 Okt 6 21:45 System.map-4.10.0-37-generic
-rw------- 1 root root 3878463 Okt 11 19:33 System.map-4.13.0-16-generic
-rw------- 1 root root 3881480 Nov 1 16:17 System.map-4.13.0-17-generic
-rw------- 1 root root 7583504 Okt 6 21:45 vmlinuz-4.10.0-37-generic
-rw------- 1 root root 7812880 Okt 11 19:33 vmlinuz-4.13.0-16-generic
-rw------- 1 root root 7814808 Okt 21 11:06 vmlinuz-4.13.0-16-generic.efi.signed
-rw------- 1 root root 7816976 Nov 1 16:17 vmlinuz-4.13.0-17-generic
-rw------- 1 root root 7818904 Nov 24 13:21 vmlinuz-4.13.0-17-generic.efi.signed

$ sudo dpkg --audit
[sudo] password for philip:
The following packages have been unpacked but not yet configured.
They must be configured using dpkg --configure or the configure
menu option in dselect for them to work:
 winusb WinUSB dummy package
 woeusb WoeUSB can create bootable windows installer on usb.

The following packages are only half installed, due to problems during
installation. The installation can probably be completed by retrying it;
the packages can be removed using dselect or dpkg --remove:
 linux-image-extra-4.10.0-37-generic Linux kernel extra modules for version 4.1

Manfred Hampl (m-hampl) said : #3

Try

sudo apt-get install --reinstall linux-image-extra-4.10.0-37-generic -f

and report the results

drohhyn (drohhyn) said : #4

$ sudo apt-get install --reinstall linux-image-extra-4.10.0-37-generic -f
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

$ sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of woeusb:
 woeusb depends on libwxbase3.0-0v5 (>= 3.0.3.1+dfsg2); however:
  Package libwxbase3.0-0v5 is not installed.
 woeusb depends on libwxgtk3.0-0v5 (>= 3.0.3.1+dfsg2); however:
  Package libwxgtk3.0-0v5 is not installed.
 woeusb depends on grub-pc-bin; however:
  Package grub-pc-bin is not installed.

dpkg: error processing package woeusb (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of winusb:
 winusb depends on woeusb; however:
  Package woeusb is not configured yet.

dpkg: error processing package winusb (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 woeusb
 winusb

sudo apt-get install --reinstall linux-image-extra-4.10.0-37-generic -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reinstallation of linux-image-extra-4.10.0-37-generic is not possible, it cannot be downloaded.
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 woeusb : Depends: libwxbase3.0-0v5 (>= 3.0.3.1+dfsg2) but it is not going to be installed
          Depends: libwxgtk3.0-0v5 (>= 3.0.3.1+dfsg2) but it is not going to be installed
          Depends: grub-pc-bin
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  grub-pc-bin libwxbase3.0-0v5 libwxgtk3.0-0v5
Suggested packages:
  desktop-base
The following packages will be REMOVED:
  linux-image-extra-4.10.0-37-generic
The following NEW packages will be installed:
  grub-pc-bin libwxbase3.0-0v5 libwxgtk3.0-0v5
0 upgraded, 3 newly installed, 1 to remove and 31 not upgraded.
3 not fully installed or removed.
Need to get 0 B/6.033 kB of archives.
After this operation, 132 MB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 285641 files and directories currently installed.)
Removing linux-image-extra-4.10.0-37-generic (4.10.0-37.41) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-37-generic /boot/vmlinuz-4.10.0-37-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.10.0-37-generic /boot/vmlinuz-4.10.0-37-generic

Progress: [ 4%] [#######...............................................................................................................................................................................]

Same result. But I'm asking myself why the error "Reinstallation of linux-image-extra-4.10.0-37-generic is not possible, it cannot be downloaded." appeared.

You can tidy up with:

sudo dpkg -P `dpkg -l | grep ^rc | awk {'print $2'}`

All the lines starting 'rc' are removed but have residual configurations. The command will clean those up for you.

Manfred Hampl (m-hampl) said : #6

For the problem with woeusb and winusb:
are these packages really necessary?

For "Reinstallation of linux-image-extra-4.10.0-37-generic is not possible, it cannot be downloaded."
what is the output of
ls -l /var/cache/apt/archives/linux-image-*

drohhyn (drohhyn) said : #7

woeusb and winusb are not necessary, these are two packages i tried to install (via deb) for another reason, but had a dependency (grub-pc-bin). When I tried to install grub-pc-bin the package linux-image-extra-4.10.0-37-generic was already flagged for autoremove, but this failed.

$ sudo ls -l /var/cache/apt/archives/linux-image-*
ls: cannot access '/var/cache/apt/archives/linux-image-*': No such file or directory

@actionbarsnip: what does this line really do? dpkg -l | grep ^rc gives a really long list with lots of packages including all kernel versions but also other stuff like php7, findbugs or docker-engine

The packages aren't installed. They are the residual configuration files and files the packages generated by the package but not part of the package itself. If you reinstall the package then the files will be used again. It's incase you need them or want to reinstall the package and keep previous configuration.
You don't need them and cleaning up is good. The installed kernels and other packages start their lines with 'ii' and will not be touched

You can avoid having to do this by adding the option

--purge

When you use apt-get. Eg (don't run this. It's just an example):

sudo apt-get --purge remove firefox

It doesn't remove configurations from your user's $HOME folder but the stuff installing a package created during installation is removed.

drohhyn (drohhyn) said : #10

Thank you very much, both actionparsnip and Manfred!

$ sudo dpkg -P `dpkg -l | grep ^rc | awk {'print $2'}`
$ sudo dpkg -r winusb woeusb
$ sudo apt-get autoremove

Finally updating is possible again!

drohhyn (drohhyn) said : #11

Thanks actionparsnip, that solved my question.