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

Failed to install generation.: No such file or directory (os error 2) #413

Open
oxalica opened this issue Dec 11, 2024 · 3 comments
Open

Comments

@oxalica
Copy link

oxalica commented Dec 11, 2024

I'm using lanzaboote for quite some time. Today I did a UEFI update which invalidates secure boot state. I re-enter the setup mode, sudo sbctl enroll-keys, toggle to secure boot user mode, and finally reboot and login with SB enabled -- everything is good so far.

Until now I want to tweak some config, but nixos-rebuild boot fails with a confusing error:

> sudo nixos-rebuild boot --flake .#invar
building the system configuration...
Installing Lanzaboote to "/boot"...
Failed to install generation.: No such file or directory (os error 2)
Failed to install bootloader
warning: error(s) occurred while switching to the new configuration
Output with --verbose
> sudo nixos-rebuild boot --flake .#invar --install-bootloader
$ nix --extra-experimental-features nix-command flakes build --out-link /tmp/nixos-rebuild.Avvmlj/nixos-rebuild .#nixosConfigurations."invar".config.system.build.nixos-rebuild -v
$ exec /nix/store/z9r4al5y5cbpfmzgz253q294lsqsc3hk-nixos-rebuild/bin/nixos-rebuild boot --flake .#invar -v
building the system configuration...
Building in flake mode.
$ nix --extra-experimental-features nix-command flakes build .#nixosConfigurations."invar".config.system.build.toplevel -v --out-link /tmp/nixos-rebuild.v8bGvl/result
$ nix-env -p /nix/var/nix/profiles/system --set /nix/store/hljpamlv5bmcwdq8cv4kv5c022799c00-nixos-system-invar-20241211.706adc0
$ systemd-run -E LOCALE_ARCHIVE -E NIXOS_INSTALL_BOOTLOADER= --collect --no-ask-password --pipe --quiet --service-type=exec --unit=nixos-rebuild-switch-to-configuration --wait true
Using systemd-run to switch configuration.
$ systemd-run -E LOCALE_ARCHIVE -E NIXOS_INSTALL_BOOTLOADER= --collect --no-ask-password --pipe --quiet --service-type=exec --unit=nixos-rebuild-switch-to-configuration --wait /nix/store/hljpamlv5bmcwdq8cv4kv5c022799c00-nixos-system-invar-20241211.706adc0/bin/switch-to-configuration boot
Installing Lanzaboote to "/boot"...
Failed to install generation.: No such file or directory (os error 2)
Failed to install bootloader
warning: error(s) occurred while switching to the new configuration

The result is the same with or without --install-bootloader.

It seems something went wrong when installing Lanzaboote bootloader, but the error message is quite vague. When I switch back from lanzaboote to systemd-boot, then nixos-rebuild boot completes successfully without warnings (except for unrelated repo-is-dirty).

This is my config&rev: oxalica/nixos-config@706adc0 . It's using lanzaboote v0.4.1

With lanzaboote master 2f48272, the error message changes slightly:

Installing Lanzaboote to "/boot"...
Failed to install generation 432: Get stub name: No such file or directory (os error 2)
Failed to install bootloader
warning: error(s) occurred while switching to the new configuration
My ESP is mounted on `/boot`, and here's its content:
/boot
├── EFI
│   ├── BOOT
│   │   └── BOOTX64.EFI
│   ├── Linux
│   │   ├── nixos-generation-429-gbazhj3v4ojtkdcy6w2tgdqgte2g76gur5rkom647ittzemeam7q.efi
│   │   ├── nixos-generation-430-f7yqr6yyhrydzuh3g7ufy4whvo5nyvyajsleiiwveiltfzggdq5q.efi
│   │   ├── nixos-generation-431-ejikyunb34qofvlnr3hm2qkkkayae2wzqz6clo6usrtlnvbabebq.efi
│   │   ├── nixos-generation-432-v3dtlqgfiq2k3scel5ft3rtk37yeh3k2brkxejg5dtnudu3fyopq.efi
│   │   └── nixos-generation-433-z5nxpbk5bpuzulzyo3ahpajx4oohxgpexk25qtije3qk6g6fcz7a.efi
│   ├── nixos
│   │   ├── 25iy82004n9ifk802sdr2186wgnx90zz-initrd-linux-6.6.63-initrd.efi
│   │   ├── azhf6ggvdzq0b7qy3xsk9psdxs7cdfm9-linux-6.6.63-bzImage.efi
│   │   ├── bz25w3pmafhdvk11d2fx8n7ii22npir3-linux-6.6.63-bzImage.efi
│   │   ├── initrd-6.6.63-eat6vfprtnuzbeo4ko54a7atqai7kxhyixuzkwoksarwhwzexbaq.efi
│   │   ├── kernel-6.6.63-lgunuywacu63o3ix6e567d5bmv3tgmb6filuv5lsnpdxa7n3qy5q.efi
│   │   └── ll9jg8f8yl3h52bkc7nvlhbqz90498cg-initrd-linux-6.6.63-initrd.efi
│   └── systemd
│       └── systemd-bootx64.efi
└── loader
    ├── entries
    │   ├── nixos-generation-432.conf
    │   ├── nixos-generation-433.conf
    │   ├── nixos-generation-434.conf
    │   ├── nixos-generation-435.conf
    │   ├── nixos-generation-436.conf
    │   ├── nixos-generation-437.conf
    │   └── nixos-generation-438.conf
    ├── loader.conf
    └── random-seed
@tomasharkema
Copy link

I just had this problem too. It appears sbctl wants to move the keys to /var/lib/sbctl... https://github.com/Foxboron/sbctl/blob/cd6dd1c6a02f5b4b3b93669e78671b656ddcfe67/config/config.go#L107C19-L107C34

@MithicSpirit
Copy link

You need to adjust your boot.lanzaboote.pkiBundle to the new directory. The docs should probably be updated to reflect that.

@oxalica
Copy link
Author

oxalica commented Dec 12, 2024

I just had this problem too. It appears sbctl wants to move the keys to /var/lib/sbctl... https://github.com/Foxboron/sbctl/blob/cd6dd1c6a02f5b4b3b93669e78671b656ddcfe67/config/config.go#L107C19-L107C34

You need to adjust your boot.lanzaboote.pkiBundle to the new directory. The docs should probably be updated to reflect that.

Thanks for the info. Changing it fixes for me.

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

No branches or pull requests

3 participants