Package: btrfs-progs Version: 5.10.1-2 Severity: normal Tags: patch Hi,
I recently upgraded a system to bullseye that has a btrfs raid1. At around the same time, I switched from raid1 to raid1c3 (over 4 disks), but I'm pretty sure this problem started with the bullseye upgrade. Now, when booting with the supplied /usr/share/initramfs-tools/hooks/btrfs in place, during the boot systemd becomes upset at it's inability to find all the components of the btrfs raid, and stops at the emergency prompt. Since I'm talking about a non-root partition, I'm sure it's possible to work around this by configuring the filesystem as being automounted, so that systemd brings it up later, after it's been found, but that does not address the fact that someone who's not noticed this potential behaviour of btrfs in advance could inocently add a disk to a system, and on configuring btrfs to make use it, render their system unbootable without intervention. Instead, inspired by the way that mdadm seems to be dealing with a similar issue, I patched the initramfs hook script (patch attached). With that patch in place, the system boots without problems. BTW I just set it to install both udev rules because it seemed harmless to do so. If you'd like me to check if just one of them would suffice, just ask. It seems possible that this would also fix #964906. I note that #772752 seems like a related issue, and that seems to have been left unaddressed on the basis that udev is optional. I hope that the fact that this code is conditional on the presence of the udev files means that the same objection does not apply in this case. BTW Here's where I grabbed the patch from: https://salsa.debian.org/lechner/mdadm/-/blob/debian/master/debian/mdadm.initramfs-hook#L53 which was part of this commit: https://salsa.debian.org/lechner/mdadm/-/commit/140efd4862d89f9202ee90abcb4b685d6f7e5460#66d9dc38ed0e19d8774c3aa092fa5e111a550dcc which says that it's been there since 4.1-1, which was in "buster", so it's been in prduction use for some time. Cheers, Phil. -- System Information: Debian Release: 11.1 APT prefers stable-security APT policy: (500, 'stable-security'), (500, 'stable'), (99, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 5.10.0-9-amd64 (SMP w/2 CPU threads) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages btrfs-progs depends on: ii libblkid1 2.36.1-8 ii libc6 2.31-13+deb11u2 ii libcom-err2 1.46.2-2 ii libext2fs2 1.46.2-2 ii libgcc-s1 10.2.1-6 ii liblzo2-2 2.10-2 ii libmount1 2.36.1-8 ii libuuid1 2.36.1-8 ii libzstd1 1.4.8+dfsg-2.1 ii zlib1g 1:1.2.11.dfsg-2 btrfs-progs recommends no packages. Versions of packages btrfs-progs suggests: pn duperemove <none> -- no debconf information -- debsums errors found: debsums: changed file /usr/share/initramfs-tools/hooks/btrfs (from btrfs-progs package)
>From 030328a4a897a990b8233a0bc30c47c54431fa34 Mon Sep 17 00:00:00 2001 From: Philip Hands <p...@hands.com> Date: Wed, 1 Dec 2021 14:02:30 +0100 Subject: [PATCH] install udev rules in initramfs hook --- debian/local/btrfs.hook | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/debian/local/btrfs.hook b/debian/local/btrfs.hook index 9ac26941..6f37c8dd 100644 --- a/debian/local/btrfs.hook +++ b/debian/local/btrfs.hook @@ -25,4 +25,14 @@ then then copy_exec /sbin/fsck.btrfs /sbin fi + + # Copy udev rules, which udev no longer does + for UDEV_RULE in 64-btrfs.rules 64-btrfs-dm.rules; do + for rules_folder in /lib/udev/rules.d /etc/udev/rules.d; do + if [ -f $rules_folder/$UDEV_RULE ]; then + mkdir -p $DESTDIR$rules_folder + cp $rules_folder/$UDEV_RULE $DESTDIR$rules_folder/$UDEV_RULE + fi + done + done fi -- 2.30.2