Commit 8115e2b0 authored by Emily's avatar Emily
Browse files

nixos-generate-config: prefer `/dev/mapper` paths for mounts

Currently, we generate `/dev/disk/by-uuid` paths for encrypted LUKS
volumes, which makes it impossible to determine that they are waiting
on a Device Mapper device at boot. Using `/dev/mapper` paths ensures
that systemd stage 1 waives its standard mount timeout for these
volumes to allow the user more time to enter the LUKS password.
parent bdcd2628
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -344,7 +344,12 @@ sub findStableDevPath {

    my $st = stat($dev) or return $dev;

    foreach my $dev2 (glob("/dev/stratis/*/*"), glob("/dev/disk/by-uuid/*"), glob("/dev/mapper/*"), glob("/dev/disk/by-label/*")) {
    foreach my $dev2 (
        glob("/dev/stratis/*/*"),
        glob("/dev/mapper/*"),
        glob("/dev/disk/by-uuid/*"),
        glob("/dev/disk/by-label/*"),
    ) {
        my $st2 = stat($dev2) or next;
        return $dev2 if $st->rdev == $st2->rdev;
    }