summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@cryptonomic.net>2021-03-02 17:36:19 -0500
committerAndrew Cady <d@cryptonomic.net>2021-03-02 18:17:24 -0500
commit60f81e1cd5b9c7f4c3249f1f6e6f2d62d70e6e11 (patch)
tree19f69e0adbac88eac973f123bcacd7fc8d8af255
parent3619754c55abae45b3c41200d0c511485843a9ac (diff)
Fix to make the btrfs install method work.
Just figured this out. We must change the fsuid after removing the devices, because btrfs MODIFIES the READ-ONLY SEED DEVICES to mark them unavailable after when remove them from the read-write device. When we reboot with the UNMODIFIED, IMMUTABLE seed image, btrfs cannot handle the duplicate fsuid. We detect this situation (kind of) and call btrfstune -m to change the fsuid of the /dev/mapper/samizdatcrypt single device fs. Now it just works. It would be much better to call this on the booted system on the running rootfs, but btrfs can't, so we instead call it on the initrd mount time. A more proper fix might use the partition table to mark the partition as in need of 'btrfstune -m'.
-rw-r--r--src/initrd/btrfs-create.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/initrd/btrfs-create.sh b/src/initrd/btrfs-create.sh
index 02ce257..cb415ab 100644
--- a/src/initrd/btrfs-create.sh
+++ b/src/initrd/btrfs-create.sh
@@ -286,10 +286,14 @@ open_samizdat()
286 fi 286 fi
287 modprobe btrfs || return 287 modprobe btrfs || return
288 btrfs device scan -u || true 288 btrfs device scan -u || true
289 btrfs device scan || return 289 if ! btrfs device scan || ! btrfs device ready "$blockdev"
290 if ! btrfs device ready "$blockdev"
291 then 290 then
292 : btrfs device ready failed, continuing anyway 291 devcount=$(btrfs inspect-internal dump-super "$blockdev" | grep -c dev_item.devid)
292 if [ "$devcount" -eq 1 ]
293 then
294 btrfstune -m "$blockdev"
295 btrfs device ready "$blockdev" || : get used to disappointment
296 fi
293 fi 297 fi
294 mount -t btrfs "$blockdev" /root || return 298 mount -t btrfs "$blockdev" /root || return
295 samizdat_movemounts "$imgfile" 299 samizdat_movemounts "$imgfile"