nixpkgs icon indicating copy to clipboard operation
nixpkgs copied to clipboard

limine: autoGenerateKeys won't work with hosts using impermanence

Open tomwrw opened this issue 7 months ago • 4 comments

Nixpkgs version

  • Unstable (26.05)

Describe the bug

With limine boot loader, if using autoGenerateKeys in an impermanence-based setup, the activation script that should fire doesn't.

Looking at the limine-install.py, on line 560 there is this code:

if config('secureBoot', 'enable'):
            sbctl = os.path.join(str(config('secureBoot', 'sbctl')), 'bin', 'sbctl')
            if not os.path.exists("/var/lib/sbctl") and config('secureBoot', 'autoGenerateKeys'):
                print('auto generating keys')

The script will only fire if the /var/lib/sbctl directory doesn't exist. However, on impermanent systems, this folder needs to be marked as persisted, and as such, the directory is present (and empty) prior to the script running, and symlinked to the persisted directory.

I think a decent fix would be to instead look for the existence of the keys subdirectory instead. Something like below perhaps?

if config('secureBoot', 'enable'):
            sbctl = os.path.join(str(config('secureBoot', 'sbctl')), 'bin', 'sbctl')
            if not os.path.exists("/var/lib/sbctl/keys") and config('secureBoot', 'autoGenerateKeys'):
                print('auto generating keys')

Steps to reproduce

Deploy a host with impermanence enabled and /var/lib/sbctl persisted. Limine will not autoGenerateKeys.

Expected behaviour

The script should fire and generate/enroll keys.

Screenshots

No response

Relevant log output


Additional context

No response

System metadata

  • system: "x86_64-linux"
  • host os: Linux 7.0.1-cachyos, NixOS, 26.05 (Yarara), 26.05.20260422.0726a0e
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.34.6
  • nixpkgs: /nix/store/75bkaivfbwq3x8cs7155hag7hs1chjcx-source

Notify maintainers

@JohnRTitor @lzcunt @Prince213 @programmerlexi @ryand56

Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a :+1: reaction to issues you find important.

tomwrw avatar Apr 29 '26 15:04 tomwrw

This is resolved in #514762.

programmerlexi avatar Apr 29 '26 16:04 programmerlexi

Lovely. Thank you!

tomwrw avatar Apr 30 '26 06:04 tomwrw

Closing due to linked PR fix.

tomwrw avatar Apr 30 '26 06:04 tomwrw

The PR still needs to be reviewed and merged, so this is not a fixed issue

programmerlexi avatar May 06 '26 14:05 programmerlexi