bootnukem
bootnukem copied to clipboard
[Bug]: apt installs a linux-image-unsigned
What happened?
bootnukem identifies the correct kernel to remove, but then when it runs apt, apt installs a linux-image-unsigned version of the kernel version bootnukem just removed.
Running on Ubuntu 20.04 (upgraded from 18.04, upgraded from 16.04, upgraded from 14.04.. there may be weird leftovers)
See log below
Version
0.2.2 (latest)
Relevant log output
root@host ~$ bootnukem
Kernel packages to be removed:
linux-headers-5.4.0-86
linux-headers-5.4.0-86-generic
linux-image-5.4.0-86-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
linux-image-unsigned-5.4.0-86-generic
Suggested packages:
fdutils linux-doc | linux-source-5.4.0 linux-tools linux-headers-5.4.0-86-generic
The following packages will be REMOVED:
linux-headers-5.4.0-86* linux-headers-5.4.0-86-generic* linux-image-5.4.0-86-generic* linux-modules-extra-5.4.0-86-generic*
The following NEW packages will be installed:
linux-image-unsigned-5.4.0-86-generic
0 upgraded, 1 newly installed, 4 to remove and 0 not upgraded.
Need to get 9,012 kB of archives.
After this operation, 288 MB disk space will be freed.
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-image-unsigned-5.4.0-86-generic amd64 5.4.0-86.97 [9,012 kB]
Fetched 9,012 kB in 1s (15.6 MB/s)
(Reading database ... 155662 files and directories currently installed.)
Removing linux-headers-5.4.0-86-generic (5.4.0-86.97) ...
Removing linux-headers-5.4.0-86 (5.4.0-86.97) ...
Removing linux-modules-extra-5.4.0-86-generic (5.4.0-86.97) ...
Removing linux-image-5.4.0-86-generic (5.4.0-86.97) ...
I: /vmlinuz.old is now a symlink to boot/vmlinuz-5.4.0-88-generic
I: /initrd.img.old is now a symlink to boot/initrd.img-5.4.0-88-generic
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.4.0-86-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-88-generic
Found initrd image: /boot/initrd.img-5.4.0-88-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done
Selecting previously unselected package linux-image-unsigned-5.4.0-86-generic.
(Reading database ... 120486 files and directories currently installed.)
Preparing to unpack .../linux-image-unsigned-5.4.0-86-generic_5.4.0-86.97_amd64.deb ...
Unpacking linux-image-unsigned-5.4.0-86-generic (5.4.0-86.97) ...
Setting up linux-image-unsigned-5.4.0-86-generic (5.4.0-86.97) ...
I: /vmlinuz is now a symlink to boot/vmlinuz-5.4.0-86-generic
I: /initrd.img is now a symlink to boot/initrd.img-5.4.0-86-generic
(Reading database ... 120489 files and directories currently installed.)
Purging configuration files for linux-modules-extra-5.4.0-86-generic (5.4.0-86.97) ...
Purging configuration files for linux-image-5.4.0-86-generic (5.4.0-86.97) ...
I: /vmlinuz is now a symlink to boot/vmlinuz-5.4.0-88-generic
I: /initrd.img is now a symlink to boot/initrd.img-5.4.0-88-generic
/var/lib/dpkg/info/linux-image-5.4.0-86-generic.postrm ... removing pending trigger
rmdir: failed to remove '/lib/modules/5.4.0-86-generic': Directory not empty
Processing triggers for linux-image-unsigned-5.4.0-86-generic (5.4.0-86.97) ...
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-88-generic
Found initrd image: /boot/initrd.img-5.4.0-88-generic
Found linux image: /boot/vmlinuz-5.4.0-86-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 236M 199M 25M 89% /boot (before)
/dev/sda1 236M 121M 104M 54% /boot (after)
Interesting. Seems like others are seeing this behavior also.
TIL: there appears to be a linux-purge utility that may have additional functionality and correctness.
I'm not able to test this fix right now, but if the above AskUbuntu post is correct, this may help: https://github.com/erichs/bootnukem/tree/issue-2-fix. @lePoMo if you're able to test that change, I'd appreciate it. Otherwise, I'll try to get to that soon! You might also try the linux-purge
utility, and see which you like better!
Thanks for the quick reply. I got around to testing.
Bascially, it works! For me it was the linux-modules.
The only thing left is some polishing, by suppressing an error. This:
dpkg -l linux-{image,headers,modules,tools}-"[0-9]*" | awk '/ii/{print $2}'
Gives me this error:
dpkg-query: no packages found matching linux-tools-[0-9]*
I admit this confuses me, there exist quite some linux-tools-[0-9].. packages. But if someone said to include -tools, easier just suppress:
dpkg -l linux-{image,headers,modules,tools}-"[0-9]*" 2> /dev/null | awk '/ii/{print $2}'
Here's the full output, if usefull:
root@host ~$ bootnukem/bootnukem
dpkg-query: no packages found matching linux-tools-[0-9]*
Kernel packages to be removed:
linux-headers-5.4.0-86
linux-headers-5.4.0-86-generic
linux-image-5.4.0-86-generic
linux-modules-5.4.0-86-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-headers-5.4.0-86* linux-headers-5.4.0-86-generic* linux-image-5.4.0-86-generic* linux-modules-5.4.0-86-generic* linux-modules-extra-5.4.0-86-generic*
0 upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
After this operation, 378 MB disk space will be freed.
(Reading database ... 155115 files and directories currently installed.)
Removing linux-headers-5.4.0-86-generic (5.4.0-86.97) ...
Removing linux-headers-5.4.0-86 (5.4.0-86.97) ...
Removing linux-modules-extra-5.4.0-86-generic (5.4.0-86.97) ...
Removing linux-image-5.4.0-86-generic (5.4.0-86.97) ...
I: /vmlinuz.old is now a symlink to boot/vmlinuz-5.4.0-88-generic
I: /initrd.img.old is now a symlink to boot/initrd.img-5.4.0-88-generic
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.4.0-86-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-88-generic
Found initrd image: /boot/initrd.img-5.4.0-88-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done
Removing linux-modules-5.4.0-86-generic (5.4.0-86.97) ...
(Reading database ... 118694 files and directories currently installed.)
Purging configuration files for linux-modules-extra-5.4.0-86-generic (5.4.0-86.97) ...
Purging configuration files for linux-modules-5.4.0-86-generic (5.4.0-86.97) ...
dpkg: warning: while removing linux-modules-5.4.0-86-generic, directory '/lib/modules/5.4.0-86-generic' not empty so not removed
Purging configuration files for linux-image-5.4.0-86-generic (5.4.0-86.97) ...
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-88-generic
Found initrd image: /boot/initrd.img-5.4.0-88-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 236M 199M 25M 89% /boot (before)
/dev/sda1 236M 104M 120M 47% /boot (after)
swt83@dell-xps:~/bootnukem$ sudo bootnukem
Kernel packages to be removed:
linux-image-5.11.0-27-generic
linux-image-5.11.0-34-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
linux-image-unsigned-5.11.0-27-generic linux-image-unsigned-5.11.0-34-generic
Suggested packages:
fdutils linux-doc | linux-hwe-5.11-source-5.11.0 linux-hwe-5.11-tools linux-headers-5.11.0-27-generic linux-modules-extra-5.11.0-27-generic linux-headers-5.11.0-34-generic linux-modules-extra-5.11.0-34-generic
The following packages will be REMOVED:
linux-image-5.11.0-27-generic* linux-image-5.11.0-34-generic* linux-modules-extra-5.11.0-27-generic* linux-modules-extra-5.11.0-34-generic*
The following NEW packages will be installed:
linux-image-unsigned-5.11.0-27-generic linux-image-unsigned-5.11.0-34-generic
0 upgraded, 2 newly installed, 4 to remove and 1 not upgraded.
Need to get 19.9 MB of archives.
After this operation, 434 MB disk space will be freed.
Get:1 http://mirrors.ubuntu.com/mirrors.txt Mirrorlist [3,209 B]
Get:3 https://repos.eggycrew.com/ubuntu focal-updates/main amd64 linux-image-unsigned-5.11.0-34-generic amd64 5.11.0-34.36~20.04.1 [9,975 kB]
Ign:2 http://mirrors.cmich.edu/ubuntu focal-updates/main amd64 linux-image-unsigned-5.11.0-27-generic amd64 5.11.0-27.29~20.04.1
Get:2 http://mirror.siena.edu/ubuntu focal-updates/main amd64 linux-image-unsigned-5.11.0-27-generic amd64 5.11.0-27.29~20.04.1 [9,927 kB]
Fetched 19.9 MB in 1min 3s (315 kB/s)
(Reading database ... 159035 files and directories currently installed.)
Removing linux-modules-extra-5.11.0-27-generic (5.11.0-27.29~20.04.1) ...
dpkg: linux-image-5.11.0-27-generic: dependency problems, but removing anyway as you requested:
linux-signatures-nvidia-5.11.0-27-generic depends on linux-image-5.11.0-27-generic | linux-image-unsigned-5.11.0-27-generic; however:
Package linux-image-5.11.0-27-generic is to be removed.
Package linux-image-unsigned-5.11.0-27-generic is not installed.
linux-modules-5.11.0-27-generic depends on linux-image-5.11.0-27-generic | linux-image-unsigned-5.11.0-27-generic; however:
Package linux-image-5.11.0-27-generic is to be removed.
Package linux-image-unsigned-5.11.0-27-generic is not installed.
Removing linux-image-5.11.0-27-generic (5.11.0-27.29~20.04.1) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.11.0-27-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.11.0-38-generic
Found initrd image: /boot/initrd.img-5.11.0-38-generic
Found linux image: /boot/vmlinuz-5.11.0-37-generic
Found initrd image: /boot/initrd.img-5.11.0-37-generic
Found linux image: /boot/vmlinuz-5.11.0-34-generic
Found initrd image: /boot/initrd.img-5.11.0-34-generic
Adding boot menu entry for UEFI Firmware Settings
done
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.11.0-38-generic
Found initrd image: /boot/initrd.img-5.11.0-38-generic
Found linux image: /boot/vmlinuz-5.11.0-37-generic
Found initrd image: /boot/initrd.img-5.11.0-37-generic
Found linux image: /boot/vmlinuz-5.11.0-34-generic
Found initrd image: /boot/initrd.img-5.11.0-34-generic
Adding boot menu entry for UEFI Firmware Settings
done
Selecting previously unselected package linux-image-unsigned-5.11.0-27-generic.
(Reading database ... 153349 files and directories currently installed.)
Preparing to unpack .../linux-image-unsigned-5.11.0-27-generic_5.11.0-27.29~20.04.1_amd64.deb ...
Unpacking linux-image-unsigned-5.11.0-27-generic (5.11.0-27.29~20.04.1) ...
(Reading database ... 153353 files and directories currently installed.)
Removing linux-modules-extra-5.11.0-34-generic (5.11.0-34.36~20.04.1) ...
dpkg: linux-image-5.11.0-34-generic: dependency problems, but removing anyway as you requested:
linux-modules-5.11.0-34-generic depends on linux-image-5.11.0-34-generic | linux-image-unsigned-5.11.0-34-generic; however:
Package linux-image-5.11.0-34-generic is to be removed.
Package linux-image-unsigned-5.11.0-34-generic is not installed.
Removing linux-image-5.11.0-34-generic (5.11.0-34.36~20.04.1) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.11.0-34-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.11.0-38-generic
Found initrd image: /boot/initrd.img-5.11.0-38-generic
Found linux image: /boot/vmlinuz-5.11.0-37-generic
Found initrd image: /boot/initrd.img-5.11.0-37-generic
Found linux image: /boot/vmlinuz-5.11.0-27-generic
Adding boot menu entry for UEFI Firmware Settings
done
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.11.0-38-generic
Found initrd image: /boot/initrd.img-5.11.0-38-generic
Found linux image: /boot/vmlinuz-5.11.0-37-generic
Found initrd image: /boot/initrd.img-5.11.0-37-generic
Found linux image: /boot/vmlinuz-5.11.0-27-generic
Adding boot menu entry for UEFI Firmware Settings
done
Selecting previously unselected package linux-image-unsigned-5.11.0-34-generic.
(Reading database ... 147672 files and directories currently installed.)
Preparing to unpack .../linux-image-unsigned-5.11.0-34-generic_5.11.0-34.36~20.04.1_amd64.deb ...
Unpacking linux-image-unsigned-5.11.0-34-generic (5.11.0-34.36~20.04.1) ...
Setting up linux-image-unsigned-5.11.0-34-generic (5.11.0-34.36~20.04.1) ...
I: /boot/vmlinuz.old is now a symlink to vmlinuz-5.11.0-38-generic
I: /boot/initrd.img.old is now a symlink to initrd.img-5.11.0-38-generic
I: /boot/vmlinuz is now a symlink to vmlinuz-5.11.0-34-generic
I: /boot/initrd.img is now a symlink to initrd.img-5.11.0-34-generic
Setting up linux-image-unsigned-5.11.0-27-generic (5.11.0-27.29~20.04.1) ...
I: /boot/vmlinuz.old is now a symlink to vmlinuz-5.11.0-34-generic
I: /boot/vmlinuz is now a symlink to vmlinuz-5.11.0-27-generic
I: /boot/initrd.img is now a symlink to initrd.img-5.11.0-27-generic
(Reading database ... 147676 files and directories currently installed.)
Purging configuration files for linux-modules-extra-5.11.0-34-generic (5.11.0-34.36~20.04.1) ...
Purging configuration files for linux-image-5.11.0-27-generic (5.11.0-27.29~20.04.1) ...
I: /boot/vmlinuz.old is now a symlink to vmlinuz-5.11.0-38-generic
I: /boot/initrd.img.old is now a symlink to initrd.img-5.11.0-38-generic
I: /boot/vmlinuz is now a symlink to vmlinuz-5.11.0-34-generic
/var/lib/dpkg/info/linux-image-5.11.0-27-generic.postrm ... removing pending trigger
rmdir: failed to remove '/lib/modules/5.11.0-27-generic': Directory not empty
Purging configuration files for linux-image-5.11.0-34-generic (5.11.0-34.36~20.04.1) ...
I: /boot/vmlinuz.old is now a symlink to vmlinuz-5.11.0-37-generic
I: /boot/initrd.img.old is now a symlink to initrd.img-5.11.0-37-generic
I: /boot/vmlinuz is now a symlink to vmlinuz-5.11.0-38-generic
I: /boot/initrd.img is now a symlink to initrd.img-5.11.0-38-generic
/var/lib/dpkg/info/linux-image-5.11.0-34-generic.postrm ... removing pending trigger
rmdir: failed to remove '/lib/modules/5.11.0-34-generic': Directory not empty
Purging configuration files for linux-modules-extra-5.11.0-27-generic (5.11.0-27.29~20.04.1) ...
Processing triggers for linux-image-unsigned-5.11.0-27-generic (5.11.0-27.29~20.04.1) ...
Processing triggers for linux-image-unsigned-5.11.0-34-generic (5.11.0-34.36~20.04.1) ...
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.11.0-38-generic
Found initrd image: /boot/initrd.img-5.11.0-38-generic
Found linux image: /boot/vmlinuz-5.11.0-37-generic
Found initrd image: /boot/initrd.img-5.11.0-37-generic
Found linux image: /boot/vmlinuz-5.11.0-34-generic
Found linux image: /boot/vmlinuz-5.11.0-27-generic
Adding boot menu entry for UEFI Firmware Settings
done
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.11.0-38-generic
Found initrd image: /boot/initrd.img-5.11.0-38-generic
Found linux image: /boot/vmlinuz-5.11.0-37-generic
Found initrd image: /boot/initrd.img-5.11.0-37-generic
Found linux image: /boot/vmlinuz-5.11.0-34-generic
Found linux image: /boot/vmlinuz-5.11.0-27-generic
Adding boot menu entry for UEFI Firmware Settings
done
Filesystem Size Used Avail Use% Mounted on
/dev/nvme0n1p2 457M 415M 8.3M 99% /boot (before)
/dev/nvme0n1p2 457M 240M 184M 57% /boot (after)
This app works great, btw -- but I randomly saw that I had the same error as this post so I'm posting my output.