Skip to content

Commit

Permalink
types *: run udevadm settle after partprobe
Browse files Browse the repository at this point in the history
  • Loading branch information
Lassulus authored and mergify[bot] committed Sep 13, 2023
1 parent 38daf3c commit 689873a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/make-disk-image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ let
ln -sfn ${systemToInstall.config.system.build.etc}/etc/udev/rules.d /etc/udev/rules.d
mkdir -p /dev/.mdadm
${pkgs.systemdMinimal}/lib/systemd/systemd-udevd --daemon
partprobe
udevadm trigger --action=add
udevadm settle
partprobe
# populate nix db, so nixos-install doesn't complain
export NIX_STATE_DIR=$TMPDIR/state
Expand Down
2 changes: 1 addition & 1 deletion lib/types/gpt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ in
--typecode=${toString partition._index}:${partition.type} \
${config.device}
# ensure /dev/disk/by-path/..-partN exists before continuing
partprobe
udevadm trigger --subsystem-match=block
udevadm settle
partprobe
${lib.optionalString (partition.content != null) partition.content._create}
'') sortedPartitions)}
Expand Down
2 changes: 1 addition & 1 deletion lib/types/mdadm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
--force \
--homehost=any \
"''${disk_devices[@]}"
partprobe
udevadm trigger --subsystem-match=block
udevadm settle
partprobe
# for some reason mdadm devices spawn with an existing partition table, so we need to wipe it
sgdisk --zap-all /dev/md/${config.name}
${lib.optionalString (config.content != null) config.content._create}
Expand Down
4 changes: 2 additions & 2 deletions lib/types/table.nix
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,19 @@
parted -s ${config.device} -- mkpart ${partition.part-type} ${diskoLib.maybeStr partition.fs-type} ${partition.start} ${partition.end}
''}
# ensure /dev/disk/by-path/..-partN exists before continuing
partprobe
udevadm trigger --subsystem-match=block
udevadm settle
partprobe
${lib.optionalString partition.bootable ''
parted -s ${config.device} -- set ${toString partition._index} boot on
''}
${lib.concatMapStringsSep "" (flag: ''
parted -s ${config.device} -- set ${toString partition._index} ${flag} on
'') partition.flags}
# ensure further operations can detect new partitions
partprobe
udevadm trigger --subsystem-match=block
udevadm settle
partprobe
${lib.optionalString (partition.content != null) partition.content._create}
'') config.partitions)}
'';
Expand Down
2 changes: 1 addition & 1 deletion lib/types/zfs_volume.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
zfs create ${config._parent.name}/${config.name} \
${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-o ${n}=${v}") config.options)} \
-V ${config.size}
partprobe
udevadm trigger --subsystem-match=block
udevadm settle
partprobe
${lib.optionalString (config.content != null) config.content._create}
'';
};
Expand Down

0 comments on commit 689873a

Please sign in to comment.