Systemd Wants Rust in, But its Core Will Have to Wait

The rustification is ongoing, with Rust-written programs now allowed and existing C code not being ported.
Warp Terminal

systemd, the init system and service manager that most mainstream Linux distributions use, has merged support for writing its programs in Rust. It landed on the main branch through a pull request of 19 commits.

The pull request replaces an earlier proposal and follows rules the maintainers agreed upon at a recent hackfest in Berlin.

The first program to use it is systemd-keyring-setup, and it adds X.509 certificates to kernel keyrings, such as the dm-verity and fs-verity ones, at boot before locking them down.

If you remember, we recently talked about Amutable launching a preview for their new offering. Anyhow, let's see what they are up to now.

Rust, but on systemd's terms

With the approach they are following, Rust stays optional, and systemd can still be built without it.

The Rust code's scope is limited to new standalone programs that nothing else depends on, while everything builds with meson, excluding cargo from the equation. Only the core and libc crates are allowed, and that rules out the standard library and alloc.

Programs would use systemd's own Box and Vec types, and a failed allocation would return an error instead of panicking. A Rust program must also behave like its C counterparts, with a test checking this for programs that declare the same command.

Building Rust programs involves having rustc 1.85, bindgen 0.71.1, and meson 1.4.0 or newer.

Distributions that build systemd with every feature enabled, such as Arch and openSUSE OBS, will have to install the Rust toolchain or turn Rust support off.

The shared library problem

The library that systemd's programs share, libsystemd-shared, stays in C for now. Putting Rust in it would need proper shared library support from Rust itself, and the language still has no stable ABI.

Rust programs use that C library the same way C programs do, and putting Rust inside it would duplicate the same code across the library and many of systemd’s binaries.

Filesystem access is another hurdle, since systemd looks up paths through file descriptors to keep that step secure and does not accept Rust's standard path handling for its sensitive components. It would like Rust to support that approach as well.

systemd still wants Rust in its core and says it is open to work with the Rust community to get there.

A wave of rust

systemd is not the only part of the Linux stack making room for Rust.

The memory-safe language entered the Linux kernel with 6.1 as an exploratory effort, with the kernel maintainers declaring late last year that the experiment was over.

Ubuntu has been taking the same route with its core tools since some time now, when sudo-rs and uutils coreutils became the default experiences.

All that strongly suggests that the adoption of Rust will only accelerate as we go into a very busy 2027.

Enjoyed this update? Support independent Linux news coverage

It's FOSS has been helping people use Linux for the past 14 years. Help us stay independent from big tech. Become a Plus member, enjoy ad-free reading and get 5 eBooks.

Plus yearly

Ad-free, FREE ebooks

Join yearly

Buy us a coffee

Any amount, no commitment

Support on Ko-fi
About the author
Sourav Rudra

Sourav Rudra

A nerd with a passion for open source software, custom PC builds, motorsports, and exploring the endless possibilities of this world.

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

itsfoss happy penguin

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.