Closed nh2 closed 6 months ago
Side observation:
Using nofail
, e.g.
options = [
"x-systemd.device-timeout=5s"
"nofail"
];
makes nixos-rebuild switch
always succed, independent of the timeout setting. This may be what you want to use if the device may be attached or not at any given time, and you don't want nixos-rebuild
to fail.
Note that this doesn't simply ignore the timeout error: It also makes that nixos-rebuild switch
does not wait for the operation to finish, e.g. nixos-rebuild
terminates, and then 5 seconds (the configured timeout) later journalctl
shows the timeout as expiring.
@nh2 on non-NixOS, how do you signal systemd you updated /etc/fstab
? I wonder if changing attributes of (already mounted) mountpoints is properly supported there…
@nh2 on non-NixOS, how do you signal systemd you updated
/etc/fstab
?
@flokli systemd.generator suggests
After editing
/etc/fstab
, the user should invokesystemctl daemon-reload
. This will re-run all generators and cause systemd to reload units from disk.
Our activation script apparently does more than just invoking systemctl daemon-reload
- it also traverses over the list of mounts. When mount options are changed, systemctl reload $foo.mount
is also invoked: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/system/activation/switch-to-configuration.pl#L311
I propose tracing this a bit, and seeing if the behaviour is correct or not.
I marked this as stale due to inactivity. → More info
I've set options = [ "x-systemd.device-timeout=5s" ]
on my root disk and swap and then switched and didn't run into this. I assume this is no longer relevant, so I am going to close.
Summary
fileSystems."/data".options = [ "x-systemd.device-timeout=5s" ];
and then undoing it changes whethernixos-rebuild
fails or succeeds.CC @flokli who I know knows systemd quite well.
Details
I made an AWS EC2 instance with an EBS volume mounted:
If I detach the volume from the VM, and run
nixos-rebuild switch
, it generally runs through (though taking a minute waiting for the timeout of the missing device):If I add to the config a shorter timeout:
then
ixos-rebuild
fails:If I subsequently remove the
options = [ "x-systemd.device-timeout=5s" ]
again,nixos-rebuild switch
continues failing, in contrast to now being the same config before which did not fail.I think this is bad: Same configs should result in same behaviour.
After rebooting the machine, the whole thing repeats:
nixos-rebuild switch
succeeds in presence of the timeout, and after the timeout is changed withx-systemd.device-timeout
once, and then this is undone again, it continues failing until the next reboot.Please find below the
journalctl
outputs of the two cases.First situtation, where it succeeds after the timeout:
Later situtation, where it fails after the timeout: