Score:2

How does Ubuntu define which linux-headers-* will be installed alongside linux-headers-generic?

eh flag

While upgrading from 22.10 to 23.04, I ran into this bug which made the system unbootable because the newest kernel 6.2.0-20 has not been installed correctly.

I used the GRUB startup menu to define an older kernel (apparently, 5.19.0-41 is the only one available "behind" the newest 6.2.0-20), so now I run on this older kernel.

To cleanup my system I tried to apt remove linux-headers-6.2.0-20 and all other 6.2.0-20-related headers of the new and broken kernel, but this was not possible because the unspecific linux-headers-generic depended on those packages.

So I also removed linux-headers-generic with the plan to re-install it once I removed the problematic headers. I manually purged all of those new headers until the list was pretty much empty (I left linux-libc-dev:amd64 because it seemed this was not causing problems):

$ sudo dpkg -l | grep "6.2.0-20"
pi  linux-headers-6.2.0-20                                      6.2.0-20.20                               all          Header files related to Linux kernel version 6.2.0
rc  linux-image-6.2.0-20-generic                                6.2.0-20.20                               amd64        Signed kernel image generic
ii  linux-libc-dev:amd64                                        6.2.0-20.20                               amd64        Linux Kernel Headers for development
rc  linux-modules-6.2.0-20-generic                              6.2.0-20.20                               amd64        Linux kernel extra modules for version 6.2.0 on 64 bit x86 SMP
rc  linux-modules-extra-6.2.0-20-generic                        6.2.0-20.20                               amd64        Linux kernel extra modules for version 6.2.0 on 64 bit x86 SMP

But now, when apt install linux-headers-generic it will still try to install the newest headers alongside it:

$ sudo apt install linux-headers-generic
Die folgenden zusätzlichen Pakete werden installiert:
  linux-headers-6.2.0-20 linux-headers-6.2.0-20-generic

Now I wonder, how does the system determine that it will install a newer kernel when installing the general linux-headers-generic and can I somehow reset this to the older kernel?

bomben avatar
eh flag
btw: When doing this I also removed `pfring-dkms` because it was a dependency. Now, when trying to install it again, the package is not found. After a reboot, my virtual machine has the second monitor black and the mouse click is not working, although the mouse cursor is generally visible and movable. I also removed `libc6-dev`.
Score:5
pl flag

5.19.0-41 was an Ubuntu 22.10 kernel. It's not in the repository for 23.04, so you won't find it with apt. It was probably still on your system from before you upgraded.

linux-headers-generic is a metapackage, which always points to the latest set of headers.

You can specify exactly what headers to install by apt install linux-headers-6.2.0-20-generic for example, which the metapackage points to (see changelog)

However you won't be able to apt install the linux-headers-5.19.0-41-generic because, as mentioned above, it's not in the 23.04 repo.

You could, as you're running 5.19 on 23.04, go and get the deb manually:

bomben avatar
eh flag
This is a nice answer, however this will not install `linux-headers-generic`. Also, I had to first install the `...all.deb` since the other package depends on it.
bomben avatar
eh flag
I did more digging and I wonder why `linux-headers-generic` (without additional specification at the end of the name) is not availlabe here: https://packages.ubuntu.com/kinetic/kernel/ Should it not be?
pl flag
Yes, that's the previous release, which points to the kernel headers I mentioned. You certainly can install that along with the versioned headers I mentioned.
bomben avatar
eh flag
I can find the kernel headers and installed them. But the problem is, that the metapackage `linux-headers-generic` (and also the more meta `linux-generic`) is not installed automatically along with the kernel headers. So I tried to find this package, but it is not in the list. I suspect now, as a metapackage, it is never "downloadable", but created in some process, see bottom: https://help.ubuntu.com/community/MetaPackages. I also suspect I will get problems without those packages when trying to upgrade from 23.04 later on. So, I have to create them. But I am not sure how.
bomben avatar
eh flag
More precisely: I can do `dpkg -i linux-generic_5.19.0.41.37_amd64.deb` but it will complain, that `linux-headers-generic` is missing and a dependency. But there is no package `linux-headers-generic__5.19.0.41.37_amd64.deb` I can download (or any package with the name `linux-headers-generic`).
pl flag
If you just install the `linux-headers-generic` from your current release, it will pull in the 6.2.20 headers, which will fulfil the requirements?
bomben avatar
eh flag
But this was what I wanted to avoid, because the new kernel was broken. But I am fine now, I was able to install the new kernel by downloading it: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2017267?comments=all
Score:0
ru flag

Actually, you don't want to install linux-headers-generic, since that package depends on other packages which are causing problems for you.

There are two ways to handle this:

  1. Find the latest version of linux-headers-generic that works for you, and install it. Then, place a hold on that package so that it won't upgrade automatically. Then, once, the latest headers include a fix for the bug you mentioned, release the hold and upgrade to the latest version.

    This strategy is a lot of work, since you have to hunt down a working version, test and make sure it works, then clean up each version that doesn't work. Finally, if the latest working version is not available to your current version of Ubuntu, it's extra work to add the package, as popey's answer intimates.

  2. Leave your system as is, in a working state. Don't make any changes until the bug gets fixed, at which time, you'll be able to install the latest version of linux-headers-generic in exactly the normal way that you install other software.

    If this strategy doesn't work for you, why not? Why is it so important to install this package?

bomben avatar
eh flag
Thanks! I am not able to install an old version of `linux-headers-generic`. So, this option is not possible. But as I mentioned in my comments on the other answer, I was able to install the kernel (and all the headers) by downloading it.
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.