Gentoo Dracut btrfs Quirk

Not sure if this is a real bug or just an unexpected feature…

For Gentoo at least, the easiest way to boot onto a multi-device btrfs root is to use the “dracut” utility to create an initramfs to do the “btrfs device scan” to find all the disks to get your btrfs raid/jbod up and running. Easy.

Except…

Running dracut on defaults, everything appears to work fine and most times the system boots up fine, but it doesn’t always boot up… There’s an occasional “btrfs: open_ctree failed” and you are dropped into the recovery shell. Entering ctl-d exits out of the shell and the system boots up fine regardless.

A consistent fix appears to be to add the line:

filesystems+="btrfs ext2 ext4"

into the “/etc/dracut.conf” config file before running dracut (or dracut --force if you are overwriting the existing initramfs file).

Also, when running dracut, make sure you have your “/boot” mounted!

A further quirk for btrfs mounting at boot is to have “0 0” set for the last two columns in “/etc/fstab” for btrfs mounts. Otherwise, a btrfsck will always halt the bootup… To work-around that, some distros remove “/sbin/fsck.btrfs” altogether. (You can still manually run “/sbin/btrfsck”.)

Leave a Reply