Score:1

What installed these kernels as dependencies?

il flag

I'm running a standard Ubuntu 22.04 desktop, installed from the amd64 USB image. Nothing unusual other than having the Nvidia binary driver for my GPU to power dual monitors.

Installed updates a couple of days ago, shut down at the end of the day and power on the next morning - only one screen comes on and it takes around 10 seconds for X to start, it's normally almost immediate and when investigating I find I'm using the nouveau driver instead of Nvidia. Reboot, use grub to choose another kernel, notice linux-image-6.2.0-xx-gcp is the default kernel and there are loads of other platform specific kernels of various versions installed:

linux-image-5.15.0-1029-nvidia/jammy-updates,jammy-security,now 5.15.0-1029.29 amd64 [installed,automatic]
linux-image-5.15.0-1036-intel-iotg/jammy-updates,jammy-security,now 5.15.0-1036.41 amd64 [installed,automatic]
linux-image-5.15.0-1038-gcp/jammy-updates,jammy-security,now 5.15.0-1038.46 amd64 [installed,automatic]
linux-image-5.15.0-1039-oracle/jammy-updates,jammy-security,now 5.15.0-1039.45 amd64 [installed,automatic]
linux-image-5.15.0-1040-aws/jammy-updates,jammy-security,now 5.15.0-1040.45 amd64 [installed,automatic]
linux-image-5.15.0-78-generic/jammy-updates,jammy-security,now 5.15.0-78.85 amd64 [installed,automatic]
linux-image-5.15.0-78-lowlatency/jammy-updates,jammy-security,now 5.15.0-78.85 amd64 [installed,automatic]
linux-image-5.17.0-1035-oem/jammy-updates,jammy-security,now 5.17.0-1035.36 amd64 [installed,automatic]
linux-image-5.19.0-1014-nvidia-lowlatency/jammy-updates,jammy-security,now 5.19.0-1014.14 amd64 [installed,automatic]
linux-image-5.19.0-1014-nvidia/jammy-updates,jammy-security,now 5.19.0-1014.14 amd64 [installed,automatic]
linux-image-5.19.0-1027-gcp/jammy-updates,jammy-security,now 5.19.0-1027.29~22.04.1 amd64 [installed,automatic]
linux-image-5.19.0-1027-oracle/jammy-updates,jammy-security,now 5.19.0-1027.30 amd64 [installed,automatic]
linux-image-5.19.0-1029-aws/jammy-updates,jammy-security,now 5.19.0-1029.30~22.04.1 amd64 [installed,automatic]
linux-image-5.19.0-1030-lowlatency/jammy-updates,jammy-security,now 5.19.0-1030.30 amd64 [installed,automatic]
linux-image-5.19.0-50-generic/jammy-updates,jammy-security,now 5.19.0-50.50 amd64 [installed,automatic]
linux-image-6.0.0-1020-oem/jammy-updates,jammy-security,now 6.0.0-1020.20 amd64 [installed,automatic]
linux-image-6.1.0-1017-oem/jammy-updates,jammy-security,now 6.1.0-1017.17 amd64 [installed,automatic]
linux-image-6.2.0-1003-nvidia/jammy-updates,jammy-security,now 6.2.0-1003.3~22.04.1+1 amd64 [installed,automatic]
linux-image-6.2.0-1008-aws/jammy-updates,jammy-security,now 6.2.0-1008.8~22.04.1 amd64 [installed,automatic]
linux-image-6.2.0-1009-lowlatency/jammy-updates,jammy-security,now 6.2.0-1009.9~22.04.1 amd64 [installed,automatic]
linux-image-6.2.0-1010-gcp/jammy-updates,jammy-security,now 6.2.0-1010.10~22.04.1 amd64 [installed,automatic]
linux-image-6.2.0-26-generic/jammy-updates,jammy-security,now 6.2.0-26.26~22.04.1 amd64 [installed,automatic]
linux-image-generic/jammy-updates,jammy-security,now 5.15.0.78.75 amd64 [installed]

I choose another kernel from grub menu, one screen is blank but backlit and can't I switch between VTs. The other screen doesn't come on at all. Forcibly reboot and go round in circles choosing various kernels and getting either one working display or none before realising the lowest common denominator is 5.15.0-78-generic, which boots and after installing the linux-image-generic metapackage and nvidia-driver-535, reboots giving me dual screens using the Nvidia driver again.

I've no idea why all these kernel variants got installed, I didn't do it myself. I think some packaging bug pulled them all in as dependencies but when I try to remove them, apt insists on installing the -unsigned versions of each instead. I did also find the -hwe kernels installed but managed to remove them manually and the -azure kernels which I managed to uninstall after removing linux-base-sgx. I can't find any forum threads or bugs that mention anyone else is having this issue.

I've tried going back through the apt logs and using apt-rdepends to work out what is pulling these kernels in but I still can't figure it out and I can't remove them. I have the following in my apt history.log from the upgrade where all of these kernels appeared:

Start-Date: 2023-07-26  09:54:25
Commandline: packagekit role='install-packages'
Requested-By: adam (1000)
Install: linux-image-5.15.0-1042-azure:amd64 (5.15.0-1042.49, automatic), libnvidia-common-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), linux-objects-nvidia-525-6.2.0-1009-lowlatency:amd64 (6.2.0-1009.9~22.04.1, automatic), linux-objects-nvidia-525-6.1.0-1017-oem:amd64 (6.1.0-1017.17, automatic), linux-objects-nvidia-525-6.2.0-1003-nvidia:amd64 (6.2.0-1003.3~22.04.1+2, automatic), linux-image-5.19.0-1027-oracle:amd64 (5.19.0-1027.30, automatic), libnvidia-fbc1-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), libnvidia-fbc1-535:i386 (535.54.03-0ubuntu0.22.04.1, automatic), linux-modules-5.15.0-1039-oracle:amd64 (5.15.0-1039.45, automatic), linux-modules-5.17.0-1035-oem:amd64 (5.17.0-1035.36, automatic), linux-modules-5.19.0-1027-gcp:amd64 (5.19.0-1027.29~22.04.1, automatic), libnvidia-gl-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), libnvidia-gl-535:i386 (535.54.03-0ubuntu0.22.04.1, automatic), linux-signatures-nvidia-5.19.0-50-generic:amd64 (5.19.0-50.50, automatic), linux-signatures-nvidia-6.2.0-1010-gcp:amd64 (6.2.0-1010.10~22.04.1, automatic), linux-modules-5.19.0-1014-nvidia-lowlatency:amd64 (5.19.0-1014.14, automatic), linux-objects-nvidia-525-5.19.0-1030-lowlatency:amd64 (5.19.0-1030.30, automatic), linux-modules-5.15.0-1038-gcp:amd64 (5.15.0-1038.46, automatic), linux-modules-nvidia-535-5.19.0-50-generic:amd64 (5.19.0-50.50, automatic), linux-modules-5.19.0-1029-aws:amd64 (5.19.0-1029.30~22.04.1, automatic), linux-signatures-nvidia-5.19.0-1014-nvidia-lowlatency:amd64 (5.19.0-1014.14, automatic), linux-signatures-nvidia-5.19.0-1010-nvidia-lowlatency:amd64 (5.19.0-1010.10, automatic), libnvidia-extra-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), linux-objects-nvidia-525-5.15.0-1029-nvidia:amd64 (5.15.0-1029.29, automatic), linux-signatures-nvidia-6.1.0-1017-oem:amd64 (6.1.0-1017.17, automatic), nvidia-compute-utils-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), nvidia-driver-535:amd64 (535.54.03-0ubuntu0.22.04.1), linux-modules-6.2.0-1008-azure:amd64 (6.2.0-1008.8~22.04.1, automatic), dctrl-tools:amd64 (2.24-3build2, automatic), linux-image-5.19.0-1014-nvidia-lowlatency:amd64 (5.19.0-1014.14, automatic), linux-image-5.19.0-1010-nvidia-lowlatency:amd64 (5.19.0-1010.10, automatic), linux-signatures-nvidia-5.15.0-1036-intel-iotg:amd64 (5.15.0-1036.41, automatic), libnvidia-encode-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), libnvidia-encode-535:i386 (535.54.03-0ubuntu0.22.04.1, automatic), linux-signatures-nvidia-5.19.0-1014-nvidia:amd64 (5.19.0-1014.14, automatic), linux-objects-nvidia-525-5.19.0-1014-nvidia:amd64 (5.19.0-1014.14, automatic), linux-objects-nvidia-525-6.2.0-26-generic:amd64 (6.2.0-26.26~22.04.1, automatic), nvidia-utils-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), linux-image-6.2.0-1008-azure:amd64 (6.2.0-1008.8~22.04.1, automatic), linux-signatures-nvidia-5.15.0-1042-azure:amd64 (5.15.0-1042.49, automatic), linux-signatures-nvidia-6.2.0-1008-aws:amd64 (6.2.0-1008.8~22.04.1, automatic), xserver-xorg-video-nvidia-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), linux-image-5.15.0-1040-aws:amd64 (5.15.0-1040.45, automatic), linux-modules-5.19.0-1030-lowlatency:amd64 (5.19.0-1030.30, automatic), linux-modules-5.19.0-1010-nvidia-lowlatency:amd64 (5.19.0-1010.10, automatic), linux-image-6.2.0-1003-nvidia:amd64 (6.2.0-1003.3~22.04.1+1, automatic), linux-objects-nvidia-525-5.15.0-78-generic:amd64 (5.15.0-78.85, automatic), linux-modules-5.19.0-1027-oracle:amd64 (5.19.0-1027.30, automatic), linux-image-5.19.0-1030-lowlatency:amd64 (5.19.0-1030.30, automatic), linux-objects-nvidia-525-5.15.0-1040-aws:amd64 (5.15.0-1040.45, automatic), linux-modules-5.15.0-1042-azure:amd64 (5.15.0-1042.49, automatic), libnvidia-decode-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), libnvidia-decode-535:i386 (535.54.03-0ubuntu0.22.04.1, automatic), linux-image-6.2.0-1010-gcp:amd64 (6.2.0-1010.10~22.04.1, automatic), linux-objects-nvidia-535-5.19.0-50-generic:amd64 (5.19.0-50.50, automatic), nvidia-firmware-535-535.54.03:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), linux-signatures-nvidia-5.15.0-1039-oracle:amd64 (5.15.0-1039.45, automatic), linux-objects-nvidia-525-5.15.0-1039-oracle:amd64 (5.15.0-1039.45, automatic), linux-signatures-nvidia-5.15.0-1040-aws:amd64 (5.15.0-1040.45, automatic), linux-image-5.17.0-1035-oem:amd64 (5.17.0-1035.36, automatic), nvidia-kernel-common-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), linux-modules-6.2.0-1009-lowlatency:amd64 (6.2.0-1009.9~22.04.1, automatic), linux-image-6.0.0-1020-oem:amd64 (6.0.0-1020.20, automatic), linux-objects-nvidia-525-5.15.0-78-lowlatency:amd64 (5.15.0-78.85+1, automatic), linux-image-5.15.0-1038-gcp:amd64 (5.15.0-1038.46, automatic), linux-signatures-nvidia-5.19.0-1027-oracle:amd64 (5.19.0-1027.30, automatic), linux-objects-nvidia-525-5.15.0-1036-intel-iotg:amd64 (5.15.0-1036.41, automatic), linux-modules-nvidia-535-generic-hwe-22.04:amd64 (5.19.0-50.50), linux-signatures-nvidia-6.2.0-1003-nvidia:amd64 (6.2.0-1003.3~22.04.1+2, automatic), linux-modules-5.15.0-78-lowlatency:amd64 (5.15.0-78.85, automatic), linux-objects-nvidia-525-6.2.0-1008-azure:amd64 (6.2.0-1008.8~22.04.1, automatic), linux-image-6.2.0-1009-lowlatency:amd64 (6.2.0-1009.9~22.04.1, automatic), linux-image-5.15.0-78-generic:amd64 (5.15.0-78.85, automatic), linux-signatures-nvidia-6.2.0-1009-lowlatency:amd64 (6.2.0-1009.9~22.04.1, automatic), linux-image-6.2.0-1008-aws:amd64 (6.2.0-1008.8~22.04.1, automatic), linux-objects-nvidia-525-5.15.0-1038-gcp:amd64 (5.15.0-1038.46, automatic), linux-modules-6.2.0-26-generic:amd64 (6.2.0-26.26~22.04.1, automatic), linux-image-5.15.0-1029-nvidia:amd64 (5.15.0-1029.29, automatic), linux-image-5.15.0-78-lowlatency:amd64 (5.15.0-78.85, automatic), linux-image-6.1.0-1017-oem:amd64 (6.1.0-1017.17, automatic), linux-signatures-nvidia-6.2.0-26-generic:amd64 (6.2.0-26.26~22.04.1, automatic), linux-base-sgx:amd64 (4.5ubuntu9, automatic), linux-image-6.2.0-26-generic:amd64 (6.2.0-26.26~22.04.1, automatic), linux-modules-6.2.0-1003-nvidia:amd64 (6.2.0-1003.3~22.04.1, automatic), linux-image-5.19.0-1027-gcp:amd64 (5.19.0-1027.29~22.04.1, automatic), linux-modules-5.15.0-1029-nvidia:amd64 (5.15.0-1029.29, automatic), linux-signatures-nvidia-5.15.0-1038-gcp:amd64 (5.15.0-1038.46, automatic), linux-modules-6.2.0-1010-gcp:amd64 (6.2.0-1010.10~22.04.1, automatic), linux-signatures-nvidia-5.15.0-78-lowlatency:amd64 (5.15.0-78.85+1, automatic), linux-modules-5.15.0-1036-intel-iotg:amd64 (5.15.0-1036.41, automatic), linux-image-5.19.0-1029-aws:amd64 (5.19.0-1029.30~22.04.1, automatic), linux-image-5.19.0-1014-nvidia:amd64 (5.19.0-1014.14, automatic), linux-objects-nvidia-525-5.19.0-1027-oracle:amd64 (5.19.0-1027.30, automatic), linux-signatures-nvidia-5.19.0-1030-lowlatency:amd64 (5.19.0-1030.30, automatic), linux-modules-6.0.0-1020-oem:amd64 (6.0.0-1020.20, automatic), linux-objects-nvidia-525-6.2.0-1010-gcp:amd64 (6.2.0-1010.10~22.04.1, automatic), linux-signatures-nvidia-5.15.0-78-generic:amd64 (5.15.0-78.85, automatic), linux-objects-nvidia-525-5.19.0-1014-nvidia-lowlatency:amd64 (5.19.0-1014.14, automatic), linux-modules-5.19.0-1014-nvidia:amd64 (5.19.0-1014.14, automatic), linux-objects-nvidia-525-5.19.0-1010-nvidia-lowlatency:amd64 (5.19.0-1010.10, automatic), linux-objects-nvidia-525-5.19.0-50-generic:amd64 (5.19.0-50.50, automatic), linux-image-5.15.0-1036-intel-iotg:amd64 (5.15.0-1036.41, automatic), libnvidia-cfg1-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), linux-objects-nvidia-525-5.17.0-1035-oem:amd64 (5.17.0-1035.36, automatic), linux-objects-nvidia-525-5.19.0-1027-gcp:amd64 (5.19.0-1027.29~22.04.1+5, automatic), linux-modules-5.15.0-1040-aws:amd64 (5.15.0-1040.45, automatic), nvidia-kernel-source-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), linux-objects-nvidia-525-6.0.0-1020-oem:amd64 (6.0.0-1020.20, automatic), linux-objects-nvidia-525-5.19.0-1029-aws:amd64 (5.19.0-1029.30~22.04.1, automatic), libnvidia-compute-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), libnvidia-compute-535:i386 (535.54.03-0ubuntu0.22.04.1, automatic), linux-signatures-nvidia-5.15.0-1029-nvidia:amd64 (5.15.0-1029.29, automatic), linux-modules-6.2.0-1008-aws:amd64 (6.2.0-1008.8~22.04.1, automatic), linux-signatures-nvidia-5.17.0-1035-oem:amd64 (5.17.0-1035.36, automatic), linux-signatures-nvidia-6.0.0-1020-oem:amd64 (6.0.0-1020.20, automatic), linux-signatures-nvidia-5.19.0-1027-gcp:amd64 (5.19.0-1027.29~22.04.1+5, automatic), linux-signatures-nvidia-5.19.0-1029-aws:amd64 (5.19.0-1029.30~22.04.1, automatic), linux-objects-nvidia-525-6.2.0-1008-aws:amd64 (6.2.0-1008.8~22.04.1, automatic), linux-modules-6.1.0-1017-oem:amd64 (6.1.0-1017.17, automatic), linux-objects-nvidia-525-5.15.0-1042-azure:amd64 (5.15.0-1042.49, automatic), dkms:amd64 (2.8.7-2ubuntu2.2, automatic), linux-modules-5.15.0-78-generic:amd64 (5.15.0-78.85, automatic), linux-image-5.15.0-1039-oracle:amd64 (5.15.0-1039.45, automatic), linux-signatures-nvidia-6.2.0-1008-azure:amd64 (6.2.0-1008.8~22.04.1, automatic)

I've had to tell grub to boot my running kernel by default from now on and I'll have to manually select the newest 5.15.0-xx-generic kernel in the grub menu each time I get a kernel update until I can remove all those unnecessary kernels.

Can anybody help me figure out how to remove them?

nobody avatar
gh flag
You can try aptitude after installing it. aptitude why a kernel package name.
Score:1
cn flag

I'll have to manually select the newest 5.15.0-xx-generic kernel in the grub menu each time I get a kernel update until I can remove all those unnecessary kernels.

Nope. See /etc/default/grub. You need

GRUB_SAVEDEFAULT=true 
GRUB_DEFAULT=saved

Then do sudo update-grub, do a reboot, and 1 time select the kernel you want. Next boots will use that choice.

Can anybody help me figure out how to remove them?

To begin:

sudo apt autoremove

This will automatically remove old kernels.

To list all installed: dpkg --list | egrep -i --color 'linux-image|linux-headers|linux-modules' | awk '{ print $2 }' > kernels.txt

It will create a list in file kernels.txt. Edit it and remove all you do want to keep. Or use grep -v $(uname -r) kernels.txt > kernels.txt and confirm grep $(uname -r) kernels.txt shows NOTHING. And this will remove them:

cat kernels.txt | xargs sudo apt purge -y

I've no idea why all these kernel variants got installed, I didn't do it myself.

I would assume you did install them. 22.10 started with Kernel 5.19. Could it be you installed the HWE? Check /etc/lsb-release.

Adam Sweet avatar
il flag
Thank you so much. I confidently assumed I'd already done most of your steps and they weren't going to help me but they did. I had already done the /etc/default/grub part and ran update-grub. I'd also run apt autoremove but it wasn't removing anything as I do it regularly.
Adam Sweet avatar
il flag
Sorry,I hit Enter for a newline, it submitted the comment and I couldn't resubmit after editing. The rest was supposed to be: I had tried manually apt purging each unwanted kernel but apt kept insisting on replacing each one with the -unsigned variant. No idea why your dpkg line worked when specifying all the unwanted kernels manually didn't, but they're gone. Thank you. I don't recall manually installing -hwe and I wouldn't have installed any of the others intentionally. I'm on 22.04.2. FWIW, I manually readded linux-image-generic and headers to make sure I have the meta packages.
Score:0
cn flag

I had the same problem today with 22.04. Had this issue with 23.04 not too long ago. All the kernels downloaded. I had security updates download automatically. If you install them, then it will automatically remove most of them next time I run the updater.Then reinstall them again. I don't get it. I've been changing grub to use the last kernel I selected to keep the machine running. Did 23.04 too. I searched for a solution to solve this problem but couldn't find any.

Then I changed software and updates auto to never. I used time machine to take the system back a couple days before all this started.

One thing I noticed is the difference between updating using the updater and using the terminal apt update and upgrade. Those kernels don't show up on my system. That's odd.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.