// ITS FOSS — LINUX & OPEN SOURCE
Systemd Wants Rust in, But its Core Will Have to Wait
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.
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 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.