Installing a Newer Linux Kernel

  • We need a bleeding edge kernel to use this bleeding edge library
  • Things go smoothly the first time when I put Linux v5.12.9 on my laptop
  • But in trying to repeat success on my workstation, the situation goes downhill fast

As you may recall, Glommio requires a Linux kernel >= version 5.8:

$ uname -r
5.4.0-72-generic

$ cargo test

# ...

...panicked at 'Failed to register a probe.  The most likely reason is that
your kernel witnessed Romulus killing Remus (too old!! kernel should be at
least 5.8)', glommio/src/sys/uring.rs:214:13

Following instructions from this askubunto.com page, I downloaded some .deb files from a kernel releases website.

The most recent stable version is currently v5.12.9, so I figured we would start by trying to install that, rather than the minimum version I needed (5.8).

Now, one thing I wanted to do beforehand is make it so I choose the kernel version each time on boot, as using newer kernels does not always play nicely with Ubuntu LTS distros. Ah, here we go:

To prevent GRUB from booting automatically and always wait for you to choose an OS, change the line to GRUB_TIMEOUT=-1

To have your changes take effect, simply save the [/usr/default/grub] text file ... and then run the sudo update-grub command.

Chris Hoffman

I set these two, then run sudo update-grub

GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=-1

I downloaded these files to a local directory (when in doubt, I go for the ones labeled "generic"):

$ wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.12.9/amd64/linux-headers-5.12.9-051209-generic_5.12.9-051209.202106030850_amd64.deb
$ wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.12.9/amd64/linux-headers-5.12.9-051209_5.12.9-051209.202106030850_all.deb
$ wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.12.9/amd64/linux-image-unsigned-5.12.9-051209-generic_5.12.9-051209.202106030850_amd64.deb
$ wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.12.9/amd64/linux-modules-5.12.9-051209-generic_5.12.9-051209.202106030850_amd64.deb

Here we go:

$ cd path/to/deb/files
$ sudo dpkg -i ./*.deb

Hmm. Errors encountered:

dpkg: dependency problems prevent configuration of linux-headers-5.12.9-051209-generic:
 linux-headers-5.12.9-051209-generic depends on libc6 (>= 2.33); however:
  Version of libc6:amd64 on system is 2.31-0ubuntu9.2.

dpkg: error processing package linux-headers-5.12.9-051209-generic (--install):
 dependency problems - leaving unconfigured

# ...

ERROR (dkms apport): kernel package linux-headers-5.12.9-051209-generic is not supported
Error! Bad return status for module build on kernel: 5.12.9-051209-generic (x86_64)

Well, time to restart, I guess.

Wow! It works!

$ uname -r
5.12.9-051209-generic

Now will Glommio's tests run?

$ git clone https://github.com/DataDog/glommio.git
$ cd glommio
$ cargo test

A lot of them do run successfully. But one seems to have deadlocked:

test executor::test::test_shares_high_disparity_fat_task has been running for over 60 seconds

Try cargo test --release, maybe? It does improve things! Still five errors, but hundreds of tests pass, and the errors are compilation errors for doctests, so not critical. Looks like we are in business!

It gets worse

additional drivers dialog box in ubuntu

Additional drivers: you're gonna have a bad time

Now, everything was all nice and clean and easy on my laptop, but the experience on my workstation was much worse.

Upon installing 5.12, the Nvidia drivers broke, and suddenly I was troubleshooting at 640x480 resolution. Several painfully slow "Additional Drivers" selections and restarts later, I could not get it to work. After finding that apt-cache search nvidia showed "modules" packages that seemed only to go to 5.10, I tried downgrading to that, and voila, my displays were working again.

Then I discovered that zfs was not working. The version installed via apt-get is only compatible up to 5.9, it seems. So then I installed Kernel 5.9.16 instead. Downgrading to 5.9 still didn't fix the issue, and it's a big headache I don't feel like dealing with. From what I gather it will be fixed soon as the patches propagate down. But 5.8 is probably a better bet if you have use zfs on your system.

Good news is, glommio tests are almost all passing:

$ uname -r
5.9.16-050916-generic
$ cargo test

# ...

failures:
    controllers::deadline_queue::test::deadline_queue_second_queued_item_increases_slope
    sys::hardware_topology::test::topology_this_machine_unique_ids

test result: FAILED. 314 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 5.85s

error: test failed, to rerun pass '-p glommio --lib'

Conclusion

  • Personally, I place a big value on being able to develop on a physical machine, but if you don't, it's probably easier to set this up on a cloud instance or orther ephemeral server build
  • Don't "go for the gold" of the newest version out there, use the lowest one that meets your requirements (assuming you're on Ubuntu 20.04)