I experience this after upgrading to bullseye too. Based on my
investigations, the problem is a race between invocation of `btrfs
device scan` in initramfs and kernel block device detection. The scan
is run at the time, when only one of the devices needed for RAID1 has
been detected by the kernel. It appears that initramfs waits for the
root device to be detected by the kernel in `local_device_setup` but
this function is not aware that it needs to wait for both RAID1
devices. Specifically, I have `root=UUID=xxxx` on the kernel command
line and initramfs translates this to /dev/sdb2 via blkid. Initramfs
is not aware of the other needed device /dev/sda2.

If this happens to anybody, you can boot into your system as follows:
Boot with the following on the kernel command line:

    break=premount

When the initramfs shell prompt appears wait a second and exit. By
that time all block devices will be detected and boot will proceed
normally.

To ensure that my system boots without manual intervention, I applied
the following workaround. I added
/etc/initramfs-tools/scripts/local-top/btrfs-raid1-wait file containing:

    #!/bin/sh

    PREREQ=""
    prereqs()
    {
        echo "$PREREQ"
    }
    case $1 in
    prereqs)
        prereqs
        exit 0
        ;;
    esac
    . /scripts/functions

    while ! test -b /dev/sda2 || ! test -b /dev/sdb2; do
        echo "Waiting for BTRFS RAID1 devices"
        sleep 1
    done
        echo "Done"

Then the initramfs needs to be updated:

    update-initramfs -k 5.10.0-8-amd64 -u

Reply via email to