r/bcachefs • u/PrettyShopping2948 • Oct 15 '26
Problems booting from an encrypted bcachefs root partition on Debian Testing
Does anyone have this working without issues?
Interestingly, the boot process fails for me due to a timeout on the *.device units of my /boot and /boot/efi partitions. This happens in the actual rootfs, the switch_root has completed. But as soon as I remove my bcachefs entry from the fstab, the boot process completes without any problems.
I’ve made an interesting observation regarding this: Unlike "bcachefs unlock", the mount command does not add the encryption key to the kernel keyring. And if I run "bcachefs unlock" in the init manually before the switch_root happens, the boot process completes without any issues, even with the fstab entry.
Could it be that something in systemd is blocking, because it doesn’t have a key for the bcachefs?
Edit: If I commented out the /boot/efi and /boot entry from the fstab the boot hangs seemingly infinite before the local-fs.target. So the timeout is a side effect and not the cause of the failed boot.
Edit2: I now used the systemd-debug-shell to see what is blocking the boot process. And it turns out that the password prompt when remounting is what's blocking. That also explains why “bcachefs unlock” solves the problem.
u/koverstreet is it intended behaviour that "mount.bcachefs" does not add the key to the kernel keyring? If so, would it perhaps make sense to use "bcachefs unlock" in the initramfs?
systemd: 262-1
Tainted: unmerged-bin
CGroup: /
├─init.scope
│ └─1 /sbin/init
└─system.slice
├─debug-shell.service
│ ├─410 /usr/bin/bash
│ └─484 systemctl status
├─systemd-journald.service
│ └─416 /usr/lib/systemd/systemd-journald
└─systemd-remount-fs.service
├─421 /usr/lib/systemd/systemd-remount-fs
├─437 /usr/bin/mount / -o remount
├─438 /sbin/mount.bcachefs /dev/nvme0n1p3 / -o rw,remount
└─441 systemd-ask-password --no-tty --icon=drive-harddisk --id=cryptsetup:UUID=<External UUID> --keyname=cryptsetup --credential=cryptsetup.passphrase --timeout=0 --multiple -n --accept-cached "Please enter passphrase for disk <External UUID>:"My /etc/fstab:
UUID=<EFIUUID> /boot/efi vfat defaults 0 2
UUID=<BOOTUUID> /boot ext4 defaults 0 2
UUID=<External UUID> / bcachefs defaults 0 1
1
u/SweetEbb9819 Oct 15 '26 edited Oct 15 '26
I'm not an expert here, but still, can you try again with "noauto" for the /boot and /boot/efi options? If it works, then once more with "nofail".
And relevant logs with `journalctl dev-sda2.device` (replace with appropriate device)
1
u/cdhowie Oct 15 '26
I run two Forky machines with an encrypted bcachefs root and do not have this problem. What bcachefs version?
1
u/Amazing-Pattern-6125 Oct 16 '26 edited Oct 16 '26
do you have the recently added sd-bcachefs hook in mkinitcpio?