-
-
Notifications
You must be signed in to change notification settings - Fork 15k
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
Services depending on keys.target
can cause hanging boots on NixOS containers
#67265
Comments
Hi, Thanks for the detailed write-up. I have added the While it would be great to have a proper replacement, finding one isn't easy for the reasons described above. Since nixops does cover this in its documentation now (it didn't back then), I am in favor of removing the |
Absolutely agree that this shouldn't go into 19.03, but yeah I'm also in favour of making the change on master before the feature freeze (7th September) :) |
Thanks for the feedback! I'll open a PR tomorrow which removes the dependencies to However I'd keep this issue open after that until we've discussed whether |
The `keys.target` is used to indicate whether all NixOps keys were successfully uploaded on an unattended reboot. However this can cause startup issues e.g. with NixOS containers (see NixOS#67265) and can block boots even though this might not be needed (e.g. with a dovecot2 instance running that doesn't need any of the NixOps keys). As described in the NixOps manual[1], dependencies to keys should be defined like this now: ``` nix { systemd.services.myservice = { after = [ "secret-key.service" ]; wants = [ "secret-key.service" ]; }; } ``` However I'd leave the issue open until it's discussed whether or not to keep `keys.target` in `nixpkgs`. [1] https://nixos.org/nixops/manual/#idm140737322342384
The actual issue has been fixed for 19.09 already, so this should be closable now. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/issues-using-nixos-container-to-set-up-an-etcd-cluster/8438/2 |
Describe the bug
When starting an imperative NixOS container which is deployed using the
container
backend from NixOps with several secrets uploaded using thedeployment.keys
module and adovecot2
unit fromservices.dovecot
installed, the boot times out and causes the container to fail as it's waiting for an infinite amount of time forkeys.target
(which is a systemd-target that indicates whether all keys from NixOps were successfully uploaded).This happens because several modules from nixpkgs (including dovecot) wait for
keys.target
by default, but are wanted bymulti-user.target
which causes the system to wait until the unit is started up (which is supposed to happenkeys.target
is reached).The problem with NixOS containers is that they don't have a proper uplink until the
[email protected]
is completely started when using scripted networking as theve-<name>
interface on the host side is configured after the container is started up:nixpkgs/nixos/modules/virtualisation/containers.nix
Lines 178 to 235 in 578d712
With the container being unreachable until start-up is done, it's impossible to send keys on an unattended reboot to containers to ensure that
keys.target
is properly reached (which makes the system wait fordovecot2.service
as it currently depends onkeys.target
). The timeout ofdovecot2
keeps the container from properly starting up.In my case the issue wouldn't exist if
dovecot2.service
didn't depend onkeys.target
as I only deploy secrets forservices.borgbackup
currently, so it's completely unnecessary fordovecot2.service
to wait for that target.My current workaround looks like this:
To Reproduce
Steps to reproduce the behavior:
deployment.targetEnv = "container";
deployment.keys
and a dovecot instance usingservices.dovecot
Expected behavior
I originally expected that no service would wait for the keys on its own without explicitly configuring it to do so as the nixops manual recommends to use the
<key-name>-key.service
units and recommends to explicitly add those to the units in question.However one might argue as well that the actual issue is the broken uplink for NixOS containers at boot, so I'd like to gather some opinions before filing a patch :)
Maintainer information:
CCing @edolstra @hrdinka (for dovecot2) and @lheckemann (as we talked about this earlier that day)
The text was updated successfully, but these errors were encountered: