Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"lvm2-activation-generator: lvmconfig failed" displayed during boot etc. #103188

Closed
omasanori opened this issue Nov 9, 2020 · 10 comments · Fixed by #103876
Closed

"lvm2-activation-generator: lvmconfig failed" displayed during boot etc. #103188

omasanori opened this issue Nov 9, 2020 · 10 comments · Fixed by #103876

Comments

@omasanori
Copy link
Contributor

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

  • system: "x86_64-linux"
  • host os: Linux 5.4.75-hardened, NixOS, 20.09.1648.bc7c121a569 (Nightingale)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.7
  • channels(root): "nixos-20.09.1648.bc7c121a569"
  • channels(omasanori): ""
  • nixpkgs: /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:
@Mic92
Copy link
Member

Mic92 commented Nov 9, 2020

cc @ajs124

@ajs124
Copy link
Member

ajs124 commented Nov 9, 2020

I'll try to find some time to look into this, as I might be responsible for this.

@scalavision
Copy link
Contributor

scalavision commented Nov 9, 2020

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 ..

@Mic92
Copy link
Member

Mic92 commented Nov 10, 2020

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.

@ajs124
Copy link
Member

ajs124 commented Nov 10, 2020

Yeah, so this was most likely caused by 1a1e723, 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.

@omasanori
Copy link
Contributor Author

+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.

@Mic92
Copy link
Member

Mic92 commented Nov 12, 2020

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.

@ajs124
Copy link
Member

ajs124 commented Nov 12, 2020

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?

@grahamc
Copy link
Member

grahamc commented Nov 13, 2020

Maybe it would be possible to fix/patch(&upstream) the generator?

@Mic92
Copy link
Member

Mic92 commented Nov 15, 2020

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: #103876

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants