forked from mirrors/nixpkgs
nixos-generate-config: add dm-snapshot module if LVM is detected
Without this, the system becomes unbootable if the user creates a LVM snapshot and reboots. Fixes https://github.com/NixOS/nixpkgs/issues/33646 (The same kind of problem was fixed in RHEL a few years back: https://bugzilla.redhat.com/show_bug.cgi?id=1287940)
This commit is contained in:
parent
9e45f6feac
commit
4213e48dd9
|
@ -264,6 +264,11 @@ if (scalar @bcacheDevices > 0) {
|
|||
push @initrdAvailableKernelModules, "bcache";
|
||||
}
|
||||
|
||||
# Prevent unbootable systems if LVM snapshots are present at boot time.
|
||||
if (`lsblk -o TYPE` =~ "lvm") {
|
||||
push @initrdKernelModules, "dm-snapshot";
|
||||
}
|
||||
|
||||
my $virt = `systemd-detect-virt`;
|
||||
chomp $virt;
|
||||
|
||||
|
@ -526,6 +531,7 @@ sub multiLineList {
|
|||
}
|
||||
|
||||
my $initrdAvailableKernelModules = toNixStringList(uniq @initrdAvailableKernelModules);
|
||||
my $initrdKernelModules = toNixStringList(uniq @initrdKernelModules);
|
||||
my $kernelModules = toNixStringList(uniq @kernelModules);
|
||||
my $modulePackages = toNixList(uniq @modulePackages);
|
||||
|
||||
|
@ -545,6 +551,7 @@ my $hwConfig = <<EOF;
|
|||
imports =${\multiLineList(" ", @imports)};
|
||||
|
||||
boot.initrd.availableKernelModules = [$initrdAvailableKernelModules ];
|
||||
boot.initrd.kernelModules = [$initrdKernelModules ];
|
||||
boot.kernelModules = [$kernelModules ];
|
||||
boot.extraModulePackages = [$modulePackages ];
|
||||
$fsAndSwap
|
||||
|
|
Loading…
Reference in a new issue