summaryrefslogtreecommitdiff
path: root/raveos-calamares-theme/etc/calamares/modules/calamares-fix-bootentry.sh
diff options
context:
space:
mode:
Diffstat (limited to 'raveos-calamares-theme/etc/calamares/modules/calamares-fix-bootentry.sh')
-rw-r--r--raveos-calamares-theme/etc/calamares/modules/calamares-fix-bootentry.sh14
1 files changed, 11 insertions, 3 deletions
diff --git a/raveos-calamares-theme/etc/calamares/modules/calamares-fix-bootentry.sh b/raveos-calamares-theme/etc/calamares/modules/calamares-fix-bootentry.sh
index a462bc9..f49e1d0 100644
--- a/raveos-calamares-theme/etc/calamares/modules/calamares-fix-bootentry.sh
+++ b/raveos-calamares-theme/etc/calamares/modules/calamares-fix-bootentry.sh
@@ -11,9 +11,12 @@ ENTRYDIR="/boot/loader/entries"
# chroot/mount-namespace context that detection can silently come back
# empty, producing a loader entry with no "root=" in its options line
# (system then drops to an emergency shell on boot: "Failed to mount ''
-# on real root"). By this point in the install sequence /etc/fstab is
-# already correctly generated, so use it as the authoritative source and
-# patch any entry that is missing root=.
+# on real root"). On btrfs it can also come back in findmnt's bracket form
+# ("/dev/vda2[/@]"), which blkid cannot resolve -- that produces a
+# syntactically present but unusable root= (emergency shell: "Failed to
+# mount '/dev/vda2[/@]' on real root"). By this point in the install
+# sequence /etc/fstab is already correctly generated, so use it as the
+# authoritative source and patch both the missing and malformed cases.
ROOT_UUID="$(findmnt -no UUID / || true)"
if [ -z "${ROOT_UUID}" ]; then
@@ -31,6 +34,11 @@ for f in "${ENTRYDIR}"/*.conf; do
[ -f "$f" ] || continue
if grep -qE '^options[[:space:]].*\broot=' "$f"; then
+ if grep -qE 'root=[^[:space:]]*\[' "$f"; then
+ echo ">>> [fix-bootentry] Fixing malformed (findmnt-style) root= in: $f"
+ sed -i -E "s#root=[^[:space:]]*\[[^]]*\]#root=UUID=${ROOT_UUID}#" "$f"
+ continue
+ fi
echo ">>> [fix-bootentry] Already has root=, skipping: $f"
continue
fi