This commit is contained in:
2026-07-24 21:12:17 +02:00
parent 4b3f790cd0
commit ffeb6c1007
+26 -7
View File
@@ -5,13 +5,27 @@
# `fileSystems.*` entries, so hardware-configuration.nix must NOT define # `fileSystems.*` entries, so hardware-configuration.nix must NOT define
# fileSystems for "/" or "/boot". # fileSystems for "/" or "/boot".
# #
# ⚠️ Root is btrfs (was ext4): the disk previously held a CachyOS btrfs root, # ⚠️ disko's `mkfs` create step SKIPS formatting when `blkid` still detects a
# and disko's `mkfs` create step SKIPS formatting when `blkid` still # filesystem signature on the freshly-cut partition:
# detects a filesystem signature on the freshly-cut partition. A stale #
# btrfs superblock survives `wipefs`+repartition inside the new root # if ! (blkid "$device" -o export | grep -q '^TYPE='); then
# partition's range, so an ext4 root got skipped and `mount -t ext4` # mkfs.btrfs "$device" -f # ← -f only runs WHEN this line runs
# then failed on the leftover btrfs bytes ("bad superblock"). btrfs's # fi
# create runs `mkfs.btrfs -f`, which reformats past any stale signature. #
# The disk previously held a CachyOS btrfs root. The whole-disk `wipefs`
# disko runs before partitioning clears the signature at the OLD layout's
# offsets, but `sgdisk --clear --align-end` then re-cuts the partitions, so
# a stale btrfs superblock survives at the NEW root partition's own 64 KiB
# offset. `blkid` sees TYPE=btrfs, `mkfs` is skipped entirely, and the
# later `mount` fails on the leftover bytes ("wrong fs type / bad
# superblock"). Switching ext4→btrfs did NOT fix this: `mkfs.btrfs -f` is
# never reached, because the guard is on whether `mkfs` runs at all, not on
# its flags. The ESP hits the same trap (its `mkfs.vfat` gets skipped too).
#
# Fix: `preCreateHook = wipefs --all --force "$device"` on each partition's
# content. The hook runs AFTER sgdisk re-cuts the partition but BEFORE the
# `blkid` guard, so it erases the stale signature at the FINAL offset;
# `blkid` then comes back empty and `mkfs` actually runs.
# #
# ⚠️ This disk is WIPED on install. This is the Kingston SA400 SSD that # ⚠️ This disk is WIPED on install. This is the Kingston SA400 SSD that
# currently holds CachyOS (btrfs root+subvols on sdb2, ESP on sdb1). # currently holds CachyOS (btrfs root+subvols on sdb2, ESP on sdb1).
@@ -34,6 +48,8 @@
format = "vfat"; format = "vfat";
mountpoint = "/boot"; mountpoint = "/boot";
mountOptions = [ "umask=0077" ]; mountOptions = [ "umask=0077" ];
# erase any stale signature before disko's blkid format-guard (above)
preCreateHook = ''wipefs --all --force "$device"'';
}; };
}; };
root = { root = {
@@ -42,6 +58,9 @@
type = "btrfs"; type = "btrfs";
extraArgs = [ "-f" ]; extraArgs = [ "-f" ];
mountpoint = "/"; mountpoint = "/";
# erase the stale CachyOS btrfs superblock before disko's blkid
# format-guard, otherwise mkfs.btrfs is skipped (see header comment)
preCreateHook = ''wipefs --all --force "$device"'';
}; };
}; };
}; };