Bug#1060411: initramfs: can't boot bcachefs storage with multi devices
On Sun, Jan 28, 2024 at 11:06:53AM +0100, Steinar H. Gunderson wrote:
> I'm a bit unsure how this would work; unless you manually set
> rootfstype=bcachefs on the GRUB command line, I think this is autodetected
> from fstype (in klibc-utils), which doesn't understand bcachefs right now?
Evidently, blkid does, so that part is fine.
With the attached patch, and bcachefs-tools upgraded to a version with
mount.bcachefs included, I can boot with root=UUID=<foo> using a multi-device
filesystem. grub-mkconfig still errors out, though.
/* Steinar */
--
Homepage: https://www.sesse.net/
diff -Nru initramfs-tools-0.142/scripts/local initramfs-tools-0.142/scripts/local
--- initramfs-tools-0.142/scripts/local 2022-04-10 21:59:31.000000000 +0200
+++ initramfs-tools-0.142/scripts/local 2022-07-12 23:51:34.000000000 +0200
@@ -148,15 +148,30 @@
panic "No root device specified. Boot arguments must include a root= parameter."
fi
local_device_setup "${ROOT}" "root file system"
- ROOT="${DEV}"
# Get the root filesystem type if not set
if [ -z "${ROOTFSTYPE}" ] || [ "${ROOTFSTYPE}" = auto ]; then
- FSTYPE=$(get_fstype "${ROOT}")
+ FSTYPE=$(get_fstype "${DEV}")
else
FSTYPE=${ROOTFSTYPE}
fi
+ # If we have an UUID bcachefs mount, we must not set $ROOT to the real device,
+ # since the filesystem may be a multi-device filesystem. If so, we must keep
+ # the UUID= argument; mount.bcachefs will figure out what devices to include.
+ if [ "${FSTYPE}" = "bcachefs" ]; then
+ case "$ROOT" in
+ UUID=*)
+ ;;
+ *)
+ ROOT="${DEV}"
+ ;;
+ esac
+ else
+ # For all other filesystems, we resolve to the actual device.
+ ROOT="${DEV}"
+ fi
+
local_premount
if [ "${readonly?}" = "y" ]; then
Reply to: