Ubuntu Talks Up Rust Kernel Programming Potential With Ubuntu 23.04

Programming
UBUNTU

Ubuntu 23.04 is being talked up for how it can aide developers who want to start programming with Rust code for Linux kernel modules. It’s possible to get started with Rust kernel development on Ubuntu 23.04 thanks to its generic kernel having the necessary kernel configuration, but ultimately it’s still in an early state and there isn’t much to do with the stock kernel.

Ubuntu 23.04 is shipping this month with the Linux 6.2 kernel as a nice upgrade over 5.19 used by Ubuntu 22.10 and 22.0.4.2 LTS with its HWE stack. The initial Rust programming support for the Linux kernel was added to upstream in Linux 6.1.

Thus with Ubuntu 23.04, Rust support in the kernel is now available — including with the necessary Rust configuration bits that Canonical has gone ahead and enabled in their stock “generic” Linux kernel image for Ubuntu 23.04.

Ubuntu Rust kernel support

Published today by Canonical engineer Andrea Righi is a how-to guide for getting “Rusty” in Lunar with their Rust kernel support. Admittedly, the Rust kernel state in Linux 6.2 is quite basic and the guide just walks through creating a Rust module to print the classic “hello world” output.

Ubuntu Rust kernel toy module

The how-to guide concludes with, “Ubuntu can now be used by all the developers who want to easily and quickly begin to familiarize themselves with kernel programming in Rust, without dealing with external software/packages and simply using the standard Ubuntu kernel and toolchain.

While, yes, that’s true and their Linux 6.2 kernel build in Ubuntu 23.04 does allow for Rust kernel modules, those wanting to get serious about Rust kernel work are better off tracking Linux 6.3 or the Rust “-next” code… Linux 6.3 stable will be out right around the same time as Ubuntu 23.04’s release at the end of month. But per usual Ubuntu policy, Ubuntu 23.04 won’t see any stable release updates past Linux 6.2 as their supported kernel option.

Linux 6.3 has more Rust infrastructure and other ongoing Rust subsystem abstractions and the like remains ongoing, some of which may land for Linux 6.4 while most of the developers are working on Rust modules aiming for the mainline are rightfully following the “-next” code. So, yes, you can write toy “hello world” modules with Ubuntu 23.04’s Linux 6.2 kernel but for those wanting to do more with this memory-safe programming language for the kernel will want/need to be rolling their own newer kernel.