You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enable CONFIG_RUST support (for dkms bcachefs) #7289
I am using bcache via dkms and when loading the module it warns:
[ 234.975483] bcachefs (sda1): kernel does not have CONFIG_RUST enabled; this will be required for bcachefs in the near future - please alert your distribution or kernel developers if your kernel does not support CONFIG_RUST
Can you please support CONFIG_RUST so that modules like bcachefs can be loaded.
Steps to reproduce the behaviour
N/A
Device (s)
Raspberry Pi 5
System
I use Arch Linux Arm but use the officially raspberry pi kernels that are tracked from this repo as the upstream.
r:~ # uname -a
Linux r 6.18.20-1-rpi-16k #1 SMP PREEMPT Wed Mar 25 15:05:23 UTC 2026 aarch64 GNU/Linux
I think this seems unlikely at the moment. It is not a simple config option to enable with no risk.
It requires building with LLVM=1 which means switching from gcc to clang to build (even for existing C code).
And on our build machine (Ubuntu 22.04) that had an immediate issue:
*** C compiler is too old.
*** Your Clang version: 14.0.0
*** Minimum Clang version: 15.0.0
CONFIG_RUST has a number of dependencies that aren't currently met:
and I suspect enabling some of those will have code size implications for the kernel.
We really don't want to make users' kernel builds harder, and this puts additional requirement on tools needed to build.
While it may be possible for them to build the kernel without LLVM=1, it would be undesirable for their own kernels to be built differently (and potentially have different behaviour when bug tracking) compared to our shipped builds.
Happy to keep this open to gauge interest.
Reports of what the minimum number of changes to config and tools needed may be helpful in progressing this.
As would reports on kernel/module size and free memory with and without this option enabled.
It requires building with LLVM=1 which means switching from gcc to clang to build (even for existing C code). And on our build machine (Ubuntu 22.04) that had an immediate issue:
*** C compiler is too old.
*** Your Clang version: 14.0.0
*** Minimum Clang version: 15.0.0
Compile the kernel with Clang 22 by setting LLVM=-22 CC=clang-22.
Just did the above and opened a PR to fix the reported Clang 22 warnings. #7299
I have CONFIG_RUST enabled on Android kernel as some AOSP specific kernel drivers (binder, ashmem) are migrating to rust. AOSP provides hermetic build environment for the kernel build so it includes the necessary build tools such as Clang toolchain and rust. Enabling rust for standalone build seems to be a bit more tricky with setting all the specific rust versions, etc (https://docs.kernel.org/rust/quick-start.html). In any case, this will become necessary sooner or later with more drivers migrating to rust.
As a side note, I'd like to suggest adding a CI target that compiles the Raspberry Pi kernel using Clang as the diagnostics seems to be better at picking up possible issues.
#7289 — does bcachefs DKMS need CONFIG_RUST on 6.18?
Short answer: no — not today. Rust is currently a soft dependency of the out-of-tree
bcachefs module. It builds and loads fine against a CONFIG_RUST=n kernel; the message in the
report is deliberate advance notice, not a build or load failure. Enabling CONFIG_RUST in the
Pi kernels would also, on its own, not make the DKMS module build with Rust.
Context
bcachefs was dropped from the kernel tree in 6.18 (there is no fs/bcachefs/ in the rpi 6.18.48
tree), so on a Pi it is DKMS-only. From 1.38.7 the module started carrying Rust code, but Kent
Overstreet explicitly flagged Rust-over-DKMS as "not going to be practical" for most users, and
the plan is distro binary packages rather than DKMS. Debian's 1.39.0 dkms package still reports built without Rust support; this will be required in the near future on a kernel that does
have CONFIG_RUST=y.
What would actually be needed when it becomes a hard dependency
Three things, and rpi currently has none of them:
1. CONFIG_RUST=y in the kernel build
Not set in any rpi defconfig. On arm64 it is available (arch/arm64/Kconfig:252, select HAVE_RUST if RUSTC_SUPPORTS_ARM64; SHADOW_CALL_STACK is not enabled, so no extra rustc
floor). The build environment needs rustc >= 1.78.0 and bindgen >= 0.65.1
(scripts/min-tool-version.sh:33).
Config conflict to resolve: init/Kconfig:2090 has
config RUST
bool "Rust support"
depends on HAVE_RUST
depends on RUST_IS_AVAILABLE
select EXTENDED_MODVERSIONS if MODVERSIONS
depends on !MODVERSIONS || GENDWARFKSYMS
...
and both arch/arm64/configs/bcm2711_defconfig:78 and arch/arm64/configs/bcm2712_defconfig:81
set CONFIG_MODVERSIONS=y. GENDWARFKSYMS needs full (unreduced, unsplit) DEBUG_INFO
(kernel/module/Kconfig:188), which the rpi defconfigs do not enable — so it is either turn on
full DWARF debug info or drop MODVERSIONS.
32-bit: HAVE_RUST requires ARMv7 LE (arch/arm/Kconfig:137, select HAVE_RUST if CPU_LITTLE_ENDIAN && CPU_32v7 && !KASAN), so the ARMv6 Pi 1 / Zero kernels
can never have it.
2. Rust artefacts shipped in the headers / build tree
This is the real blocker, and it is upstream rather than rpi-specific: scripts/package/install-extmod-build contains no mention of Rust at all, and even deletes all *.o (line 75):
rust/*.rmeta — crate metadata, read via --extern on every out-of-tree compile
rust/*.so — proc-macro shared objects
rust/helpers/*.bc — on 6.19+ with CONFIG_RUST_INLINE_HELPERS=y (clang builds)
That is why the Debian reporter got missing the kernel's prebuilt Rust stdlib (/usr/src/linux-headers-.../rust/libcore.rmeta)
despite CONFIG_RUST=y. Armbian has already had to patch this themselves — roughly 25 MiB
xz-compressed added to the headers package.
3. A matching toolchain on the Pi itself
rustc must match CONFIG_RUSTC_VERSION_TEXT exactly (Rust has no stable ABI), plus rust-src and
the bindgen CLI. Cross-compiled proc-macro .so files will not even load on the target.
Suggested reply on the issue
The warning is harmless for now. Enabling CONFIG_RUST alone would be cosmetic at best and would
not silence it, since the headers package would still lack the rust/ artefacts; and even a full
pipeline needs a version-matched rustc on every Pi — which is exactly why upstream bcachefs is
steering away from DKMS towards prebuilt module packages.
r:~ # pacman -Syu bcachefs-dkms
:: Synchronizing package databases...
core is up to date
extra 10.0 MiB 441 KiB/s 00:23 [############################################] 100%
alarm is up to date
aur is up to date
warning: bcachefs-dkms-3:1.39.4-1 is up to date -- reinstalling
.
.
.
(2/3) Install DKMS modules
==> dkms install --no-depmod bcachefs/v1.39.4 -k 6.18.48-1-rpi-16k
Error! Bad return status for module build on kernel: 6.18.48-1-rpi-16k (aarch64)
Consult /var/lib/dkms/bcachefs/v1.39.4/build/make.log for more information.
==> WARNING: `dkms install --no-depmod bcachefs/v1.39.4 -k 6.18.48-1-rpi-16k' exited 10
.
.
.
r:~ # cat /var/lib/dkms/bcachefs/v1.39.4/build/make.log | grep \\.rs
thread 'main' (24824) panicked at /usr/lib/modules/6.18.48-1-rpi-16k/build/scripts/generate_rust_target.rs:190:9:
make[4]: *** No rule to make target '/usr/lib/rustlib/src/rust/library/core/src/lib.rs', needed by 'src/fs/bcachefs/vrust/core.o'. Stop.
Activity
popcornmix commentedon Mar 27, 2026
I think this seems unlikely at the moment. It is not a simple config option to enable with no risk.
It requires building with
LLVM=1which means switching from gcc to clang to build (even for existing C code).And on our build machine (Ubuntu 22.04) that had an immediate issue:
CONFIG_RUSThas a number of dependencies that aren't currently met:and I suspect enabling some of those will have code size implications for the kernel.
We really don't want to make users' kernel builds harder, and this puts additional requirement on tools needed to build.
While it may be possible for them to build the kernel without
LLVM=1, it would be undesirable for their own kernels to be built differently (and potentially have different behaviour when bug tracking) compared to our shipped builds.Happy to keep this open to gauge interest.
Reports of what the minimum number of changes to config and tools needed may be helpful in progressing this.
As would reports on kernel/module size and free memory with and without this option enabled.
KonstaT commentedon Apr 2, 2026
Clang 15 can be installed on Ubuntu 22.04 from the official repositories (https://documentation.ubuntu.com/ubuntu-for-developers/reference/availability/llvm/).
$ sudo apt install clang-15 clang-tools-15 lld-15 llvm-15Compile the kernel with Clang 15 by setting
LLVM=-15 CC=clang-15.You can also install Clang 22 on Ubuntu and Debian based distros (such as Ubuntu 22.04 and Raspberry Pi OS) from LLVM (https://apt.llvm.org/).
Compile the kernel with Clang 22 by setting
LLVM=-22 CC=clang-22.Just did the above and opened a PR to fix the reported Clang 22 warnings.
#7299
I have
CONFIG_RUSTenabled on Android kernel as some AOSP specific kernel drivers (binder, ashmem) are migrating to rust. AOSP provides hermetic build environment for the kernel build so it includes the necessary build tools such as Clang toolchain and rust. Enabling rust for standalone build seems to be a bit more tricky with setting all the specific rust versions, etc (https://docs.kernel.org/rust/quick-start.html). In any case, this will become necessary sooner or later with more drivers migrating to rust.As a side note, I'd like to suggest adding a CI target that compiles the Raspberry Pi kernel using Clang as the diagnostics seems to be better at picking up possible issues.
nnathan commentedon Aug 31, 2026
bcachefs now requires rust and you can no longer install via DKMS because the kernel doesn't support CONFIG_RUST
pelwell commentedon Sep 1, 2026
That might mean we get feedback from more users....
popcornmix commentedon Sep 1, 2026
Some Claude analysis:
#7289 — does bcachefs DKMS need
CONFIG_RUSTon 6.18?Short answer: no — not today. Rust is currently a soft dependency of the out-of-tree
bcachefs module. It builds and loads fine against a
CONFIG_RUST=nkernel; the message in thereport is deliberate advance notice, not a build or load failure. Enabling
CONFIG_RUSTin thePi kernels would also, on its own, not make the DKMS module build with Rust.
Context
bcachefs was dropped from the kernel tree in 6.18 (there is no
fs/bcachefs/in the rpi 6.18.48tree), so on a Pi it is DKMS-only. From 1.38.7 the module started carrying Rust code, but Kent
Overstreet explicitly flagged Rust-over-DKMS as "not going to be practical" for most users, and
the plan is distro binary packages rather than DKMS. Debian's 1.39.0 dkms package still reports
built without Rust support; this will be required in the near futureon a kernel that doeshave
CONFIG_RUST=y.What would actually be needed when it becomes a hard dependency
Three things, and rpi currently has none of them:
1.
CONFIG_RUST=yin the kernel buildNot set in any rpi defconfig. On arm64 it is available (
arch/arm64/Kconfig:252,select HAVE_RUST if RUSTC_SUPPORTS_ARM64;SHADOW_CALL_STACKis not enabled, so no extra rustcfloor). The build environment needs rustc >= 1.78.0 and bindgen >= 0.65.1
(
scripts/min-tool-version.sh:33).Config conflict to resolve:
init/Kconfig:2090hasand both
arch/arm64/configs/bcm2711_defconfig:78andarch/arm64/configs/bcm2712_defconfig:81set
CONFIG_MODVERSIONS=y.GENDWARFKSYMSneeds full (unreduced, unsplit)DEBUG_INFO(
kernel/module/Kconfig:188), which the rpi defconfigs do not enable — so it is either turn onfull DWARF debug info or drop
MODVERSIONS.32-bit:
HAVE_RUSTrequires ARMv7 LE (arch/arm/Kconfig:137,select HAVE_RUST if CPU_LITTLE_ENDIAN && CPU_32v7 && !KASAN), so the ARMv6 Pi 1 / Zero kernelscan never have it.
2. Rust artefacts shipped in the headers / build tree
This is the real blocker, and it is upstream rather than rpi-specific:
scripts/package/install-extmod-buildcontains no mention of Rust at all, and even deletes all*.o(line 75):A DKMS build needs:
rust/*.rmeta— crate metadata, read via--externon every out-of-tree compilerust/*.so— proc-macro shared objectsrust/helpers/*.bc— on 6.19+ withCONFIG_RUST_INLINE_HELPERS=y(clang builds)That is why the Debian reporter got
missing the kernel's prebuilt Rust stdlib (/usr/src/linux-headers-.../rust/libcore.rmeta)despite
CONFIG_RUST=y. Armbian has already had to patch this themselves — roughly 25 MiBxz-compressed added to the headers package.
3. A matching toolchain on the Pi itself
rustc must match
CONFIG_RUSTC_VERSION_TEXTexactly (Rust has no stable ABI), plusrust-srcandthe bindgen CLI. Cross-compiled proc-macro
.sofiles will not even load on the target.Suggested reply on the issue
The warning is harmless for now. Enabling
CONFIG_RUSTalone would be cosmetic at best and wouldnot silence it, since the headers package would still lack the
rust/artefacts; and even a fullpipeline needs a version-matched rustc on every Pi — which is exactly why upstream bcachefs is
steering away from DKMS towards prebuilt module packages.
Sources
nnathan commentedon Sep 1, 2026
Claude is wrong.
popcornmix commentedon Sep 2, 2026
Can you confirm if a kernel built with rust support is sufficient to build dkms bcachefs?
nnathan commentedon Sep 2, 2026
Hi,
I built this rasp pi kernel with CONFIG_RUST using the Arch build scripts from the Arch Linux ARM Repository.
The ensuing DKMS compilation for dkms-bcachefs successfully built and it is mounting bcachefs filesystem.
koverstreet commentedon Sep 11, 2026
that Claude response looks correct to me, and I've been getting repeated complaints about the raspberry pi kernel still not having CONFIG_RUST enabled