---
title: Get familiar with “Rusty” kernel programming in Ubuntu Lunar Lobster
description: The Linux kernel has recently introduced Rust as an alternative to C
  for creating kernel modules. Ubuntu has made it easier to use Rust for kernel development
  by providing all the necessary toolchain and kernel requirements to build and test
  out-of-tree kernel modules.
url: https://canonical.com/blog/get-familiar-with-rusty-kernel-programming-in-ubuntu-lunar-lobster?format=md
---

1. [Blog](https://canonical.com/blog)
2. Article

---

[arighi](https://canonical.com/blog/author/arighi "More about arighi")

31 August 2023

# Get familiar with “Rusty” kernel programming in Ubuntu Lunar Lobster

[Development](https://canonical.com/blog/tag/development)
[Linux kernel](https://canonical.com/blog/tag/linux-kernel)
[Rust](https://canonical.com/blog/tag/rust)

---

Share the article

The Linux kernel has recently introduced the Rust programming language as an alternative to C for creating kernel modules.

Rust is a strongly, statically typed programming language with a focus on memory safety features which produces extremely compact executable code. These properties, paired with its good tooling, make Rust a natural choice for creating many types of kernel modules, including device drivers, network protocols and filesystems.

Unfortunately, setting up an environment to build and run Rust kernel modules is not trivial, because it requires both a custom toolchain and custom kernel changes which are not usually suitable for a generic distro kernel.

## Dealing with Rusty complexity

Ubuntu has made it easier to use Rust for kernel programming by providing all the necessary toolchain and kernel requirements to build and test out-of-tree kernel modules.

This has the potential to make kernel programming more accessible to a wider audience of individuals who are interested in experimenting with it, from junior developers and students to people who simply want to learn a little bit of kernel programming.

## Rust support in the Ubuntu kernel

Using Rust, you can easily create your own kernel modules and share them with other Ubuntu users, without the need of any special toolchain or kernel requirements.

The generic kernel in Ubuntu already contains the Rust subsystem that is capable of running Rust modules.

From a user-space perspective developers just need to install the toolchain packages required to build kernel modules in Rust:

```
​$ sudo apt install rustc-1.62 rust-1.62-src rustfmt-1.62 \
  bindgen-0.56 llvm clang gcc make \
  linux-lib-rust-$(uname -r) \
  linux-headers-$(uname -r)
```

Distributing Rust kernel modules is also easy with Ubuntu, any Ubuntu user can recompile and load binary modules (.ko) directly into the generic kernel shipped with the distribution, like any other regular kernel module.

## Future work

Please keep in mind that at the moment Rust support in the Ubuntu kernel should still be considered a technology preview and hence not yet ready for production.

Currently, Rust can only be used for basic tasks, but more features are expected to be added and the Ubuntu kernel team is actively working with the upstream developers to integrate them in our kernel.

## Embarking Rustaceans on a kernel programming journey

To get a better understanding of how to start with the Rust programming language in Ubuntu take a look at the previous Rust blog post: [Why and how to use Rust on Ubuntu](https://ubuntu.com/blog/why-and-how-to-use-rust-on-ubuntu).

To learn how to write your own kernel modules in Rust follow our in-depth tutorial: [Ubuntu kernel is getting “Rusty” in Lunar](https://discourse.ubuntu.com/t/ubuntu-kernel-is-getting-rusty-in-lunar/34977). Stay tuned for more.

[Get in touch

Interested in running Ubuntu in your organization?](https://ubuntu.com/about/contact-us/form)

## Sign up for our newsletter

Get the latest Canonical news and updates in your inbox.

Work email:

\*I agree to receive information about Canonical's
products and services.

By submitting this form, I confirm that I have read and agree to [Canonical's Privacy Policy](https://canonical.com/legal/dataprivacy).

Sign up

## Share on

---

## Related posts

[### Crafting new Linux schedulers with sched-ext, Rust and Ubuntu](https://canonical.com/blog/crafting-new-linux-schedulers-with-sched-ext-rust-and-ubuntu)

In our ongoing exploration of Rust and Ubuntu, we delve into an experimental kernel project that leverages these technologies to create new schedulers for Linux. Playing around...

[arighi](https://canonical.com/blog/author/arighi)

26 February 2024

[### Live Linux kernel patching with progressive timestamped rollouts](https://canonical.com/blog/live-linux-kernel-patching-with-progressive-timestamped-rollouts)

In internet connected environments, where Ubuntu instances can reach livepatch.canonical.com, Livepatch Client supports timestamp-based rollout configurations. Organizations...

[Rajan Patel](https://canonical.com/blog/author/rajanpatel927)

2 July 2025

[### Update Livepatch Client for the newest kernel module signing certificate](https://canonical.com/blog/update-livepatch-client-for-the-newest-kernel-module-signing-certificate)

The kernel engineering team at Canonical has generated a new module signing certificate on May 16, 2025, and it is embedded in all Ubuntu kernels published after that date....

[Rajan Patel](https://canonical.com/blog/author/rajanpatel927)

1 July 2025

[### Automated patching for the Linux kernel](https://canonical.com/blog/automated-patching-for-the-linux-kernel)

To start securely and efficiently, Linux systems follow a carefully orchestrated sequence of steps to initialize firmware and manage services. Applying security patches to the...

[Rajan Patel](https://canonical.com/blog/author/rajanpatel927)

31 March 2025
