ubuntu-mainline-kernel.sh icon indicating copy to clipboard operation
ubuntu-mainline-kernel.sh copied to clipboard

warn/fail if libc6 is not correct version

Open robinpaulson opened this issue 3 years ago • 10 comments

I recently installed kernel v5.12 on my Ubuntu Focal (20.04) laptop and got an error: "linux-headers-5.12-512000-generic.deb depends on libc6 >2.33 installed, you have libc6=2.31" I don't want to risk installing libc6 2.33 on my system, so I uninstalled that version of the kernel. Perhaps this script could check for the required version of libc6 before installing?

we can use dpkg-deb to find out the version required in the .deb package $ dpkg-deb --field linux-headers-5.12-512000-generic.deb Depends (we may need extra wrangling of the output, using find/sed/awk)

and dpkg-query to find out which version is installed: $ dpkg-query --no-pager -f='${Version}' -W libc6

robinpaulson avatar May 04 '21 09:05 robinpaulson

Of course, the broader point here is that the latest kernel will not work on any version of Ubuntu earlier than hirsuite, 21.04.

i realise that's outside the scope of this project, perhaps you could add a warning to the readme, that this only works on certain versions of ubuntu? Perhaps also a sanity check by parsing the output of "lsb_release -rs" if a user does use the script?

robinpaulson avatar May 10 '21 08:05 robinpaulson

The issue with the kernel is that whoever runs it is packaging the kernel-headers with a 21.04 only requirement. Which makes the kernel essentially useless, because 21.04 is already at that kernel level.

This is an ubuntu packaging issue, not this script. The best thing to do for now is to drop back to a supported kernel until the ubuntu guys can find their ass with both hands.

ThoreauHenry avatar May 13 '21 17:05 ThoreauHenry

These errors have happened before and afaik they have always been retro-actively fixed by the Ubuntu kernel team when they have time? That could take a couple of weeks unfortunately.

pimlie avatar May 13 '21 17:05 pimlie

until the ubuntu guys can find their ass with both hands.

i'm not sure insulting the ubuntu devs gets us anywhere.

also, this is getting off-topic. my point was to prevent the packages being installed on a system which doesn't support them, not to criticise those "responsible"

they have always been retro-actively fixed by the Ubuntu kernel team

that's good to hear. rather than installing the kernel, finding my system is broken and uninstalling it, are you interested in the suggestion i made for a fix? it would be better if we could find out the dependencies before downloading, but I'm not sure if that's possible. although there should be a build script/recipe somewhere on the server which hosts them.

is there any chance there is new code in the kernel which requires a more recent libc6? i had a look around on the kernel wiki/faq and couldn't find anything obvious. it's a bit beyond my skills to understand the kernel unfortunately.

it may be one of these: https://launchpad.net/~canonical-kernel-team/+archive/ubuntu/ppa https://launchpad.net/~canonical-kernel-team/+archive/ubuntu/unstable

the latter of those links takes us to this build log:https://launchpadlibrarian.net/535697172/buildlog_ubuntu-hirsute-amd64.linux-meta-unstable_5.12.0.9.9_BUILDING.txt.gz

which lists libc6 v2.33 as a requirement for the build

robinpaulson avatar May 13 '21 20:05 robinpaulson

we can use dpkg-deb to find out the version required in the .deb package

and dpkg-query to find out which version is installed:

d'oh. of course, we can use gdebi instead of these two tools. no need to use dpkg, which has no knowledge of the apt database.

$ sudo gdebi [headers-package] --apt-line --q $ echo $? will tell us if we can install it or not. if $? returns "0", then on we go. if "1" or any other digit, then we stop and tell the user their system is not supported [the --apt-line] option will only simulate the install, checking dependencies and other pre-requisites

robinpaulson avatar May 14 '21 07:05 robinpaulson

Given that Ubuntu hirsute and impish both use libc6 v2.33, I find it extremely doubtful that we ever will be able to install any mainline kernels on any earlier version of Ubuntu. Personally I only use LTS, upgrading every 6 months is way too much hassle. So, I guess I'll stick with the default Ubuntu hwe kernel until next April, then use this script again.

robinpaulson avatar May 28 '21 07:05 robinpaulson

Of course, the "correct" way to fix this would be to build the kernel ourselves, against Ubuntu Focal, then making a PPA on Launchpad or similar. That's again a bit more than I'm interested in doing.

robinpaulson avatar May 28 '21 07:05 robinpaulson

While this gets fixed, it's possible to use this PPA (big thanks to TuxInvader!). If you are on focal you can simply add it with the usual add-apt-repository command, if you are on an older version you can

sudo nano /etc/apt/sources.list.d/mainline-ppa.list

and paste

deb http://ppa.launchpad.net/tuxinvader/lts-mainline/ubuntu focal main
deb-src http://ppa.launchpad.net/tuxinvader/lts-mainline/ubuntu focal main

Using it with ubuntu 18.04LTS/bionic and it works like a charm.

GiorgioBrux avatar Jun 09 '21 14:06 GiorgioBrux

Thanks @GiorgioBrux , I'll give that a go.

robinpaulson avatar Jun 10 '21 04:06 robinpaulson

OK, that works really well. It's a bigger install than umk provides, but that's not a biggie. So long as the maintainer continues providing those packages, I'll be using that instead of this, a ppa is always preferable to a single-use apt clone.

robinpaulson avatar Jun 12 '21 03:06 robinpaulson