A change has been accepted to the systemd system manager codebase that adds the ability to create components in the Rust language. They intend to use Rust only for the development of new components, and they do not plan to rewrite existing C code in Rust. The cargo package manager is not used during the build process; only the Meson build system remains used. Rust code is used in “no_std” mode (without a standard library), only the core, alloc and libc libraries are allowed.
Systemd components in Rust are dynamically linked to the libsystemd-shared C library. Rust bindings over libsystemd-shared are generated automatically at the build stage from header files using the bindgen utility, and are made available to rust programs in the form of the systemd_shared package. To work, you need at least version rustc 1.85 and bindgen 0.71.1, corresponding to the versions from Debian 13.
The test executable file in Rust, when assembled with LTO optimizations, takes 32 KB, while the analogue in C takes 20 KB. By default, Rust support is enabled only if the system has the appropriate Rust tools (-Drust=auto). As the first component written in Rust, is being developed systemd-keyring-setup, which has not yet been accepted into the main systemd codebase. Systemd-keyring-setup is designed to configure and manage X.509 certificates for the Linux kernel dm-verity, fs-verity, and bpf mechanisms.