-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
boot.initrd.network.ssh.hostRSAKey
breaks activation if removed
#34262
Comments
@Baughn could you paste the dropbear-specific config-section? :) |
Sure, but it's a little complicated. We talked this over on IRC. For anyone following along, http://ix.io/EG7 has the relevant configuration with the failed bits commented out, in emergency-shell.nix. |
After a lot of digging, it seems the problem is here: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py#L84 Specifically, write_entry gets called in a loop, for every generation. This fails when the host key has already been removed from the system. It's theoretically fixable by not updating the initrd unnecessarily, but it might be easier to document it and wait for secrets-in-nix-store to exist. There's another bug which would block that fix. Assuming this initrd secret is the only difference between the configurations, their respective initrds will have the same hash -- and so the same filename in /boot. That wouldn't cause trouble for initrd ssh, but should be fixed anyway. |
From the looks of #8, we won't be getting a perfect solution anytime soon. That leaves the options of "fixing" systemd-boot (which would make it more fragile), or simply documenting the bug in the hostess key and related attributes. I'm inclined towards the latter. |
I ran into this issue while setting up a new nixos machine and was completely puzzled by the error until i figured what was going on. I think at the very least the error could be more helpful. |
Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly:
|
What’s the state of this issue today? I have not modified this setting recently on any of my systems, but hitting this issue while re-installing a system could lead to confusion. |
Self reply: I’ve re-organised yesterday the files in my config repository, moving my dropbear host RSA key—and correctly updating the relevant configuration line, forgetting about this issue. I’ve lost something like 40 minutes trying to remember how to fix it. For others—and maybe future self—who encounter this issue, follows a procedure that works to move the key file:
|
I marked this as stale due to inactivity. → More info |
(For stalebot) This issue is still relevant. |
I've resolved this to my satisfaction for my own systems, using Agenix to handle the SSH keys. It's not a true fix, but if you come across this bug in 2022 you might try that. |
Issue description
After first setting hostRSAKey and rebuilding the system, if the file is subsequently removed (and the setting commented out) then activation will fail.
It appears that all generations use the same initrd, instead of creating a separate file for each. This is true even when they should be separate. My best guess would be that the hostRSAKey is not included in the hash.
On a sidenote, while fixing the problem (using nix-collect-garbage -d), I arrived at a situation where the most-recent GRUB boot entry referred to a system configuration that no longer existed. I'm not sure how.
Technical details
"x86_64-linux"
Linux 4.14.14, NixOS, 18.03.git.d492cdc789c (Impala)
yes
relaxed
nix-env (Nix) 1.11.16
"nixos-18.03pre126063.95880aaf062"
/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs
The text was updated successfully, but these errors were encountered: