Describe the bug
While the configuration contains no settings related to LVM, lvm2-activation-generator
is launched during boot, nixos-rebuild switch
and so on, and the "lvm2-activation-generator: lvmconfig failed" message is logged in the journal.
Expected behavior
At least, lvm2-activation-generator
does not produce error messages. It might be better if the service is not activated if the system does not use LVM at all.
Additional context
#917164 - "lvm2-activation-generator: lvmconfig failed" message at boot time - Debian Bug report logs may or may not be relevant.
Metadata
"x86_64-linux"
Linux 5.4.75-hardened, NixOS, 20.09.1648.bc7c121a569 (Nightingale)
yes
yes
nix-env (Nix) 2.3.7
"nixos-20.09.1648.bc7c121a569"
""
/nix/var/nix/profiles/per-user/root/channels/nixos
Maintainer information:
# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
cc @ajs124
I'll try to find some time to look into this, as I might be responsible for this.
I got this error when running reboot
in the console. It just froze, didn't reboot. Hitting enter put me back into the shell. Doing shutdown -h now worked. Very strange ..
I got this error when running
reboot
in the console. It just froze, didn't reboot. Hitting enter put me back into the shell. Doing shutdown -h now worked. Very strange ..
I strongly suspect that your freeze was not caused by this warning message.
Yeah, so this was most likely caused by 1a1e7237de905ecbc990d17af8ff87a667aa312c, which combined with the rest of #93024 leads to systemd being aware of lvm2 things. lvm2 was already in services.udev.packages
and environment.systemPackages
for anything that's not a container, before this, but now it's also in systemd.packages
.
As for why this happens, it looks like it's this line of code, which fails when lvmconfig --type full
does not return what it expects. Since we do not install the default lvm config, it fails like so:
Cannot clone NULL config node.
Failed to clone current config tree.
The easiest solution to this is probably to install the default config file to /etc
. There is a problem with that though.
If we use environment.etc."lvm/lvm.conf".source
, we cannot use .text
anymore to append any settings. We also cannot "copy" the defaults into .text
e.g. with readFile
, because that would be import from derivation.
So the remaining option is to simply set some default settings, which also kind of sucks, because then we need to track upstream on those, but it's probably our best option.
If you have any other/better ideas, I'd gladly go for those, but if nobody does, I'll go with specifying some defaults, in a few days.
+1 to importing upstream defaults as it seems the safest option if it tracks upstream properly, even though it will certainly increase the maintenance cost.
I also would just create a lvm.conf
default configuration if it is not possible to disable lvm2-activation-generator somehow if lvm is not used.
Detecting if lvm is used sadly isn't trivial. For filesystems (in fileSystems.
) we can just look at the fsType
and enable the respective kernel modules and tools, but how would that be done for lvm?
Maybe it would be possible to fix/patch(&upstream) the generator?
lvm seems to have its default hard coded so we don't need to copy over the whole file. To fix the loading error I just added an almost empty configuration to make the warning go away: https://github.com/NixOS/nixpkgs/pull/103876