numtide / nixos-facter-modules

A series of NixOS modules to be used in conjunction with https://github.com/numtide/nixos-facter [maintainer=@numtide]
https://numtide.github.io/nixos-facter-modules/
MIT License
61 stars 5 forks source link

networkd being enabled breaks switching to new generation #62

Open britter opened 3 hours ago

britter commented 3 hours ago

Describe the bug

After updating to rev 505386dda29452140f93734509b03de57986af57 I can't nixos-rebuild switch anymore on my laptop. Switch fails with

$ sudo nixos-rebuild switch --flake .
building the system configuration...
activating the configuration...
setting up /etc...
reloading user units for bene...
restarting sysinit-reactivation.target
warning: the following units failed: systemd-networkd-wait-online.service

× systemd-networkd-wait-online.service - Wait for Network to be Configured
     Loaded: loaded (/etc/systemd/system/systemd-networkd-wait-online.service; enabled; preset: enabled)
    Drop-In: /nix/store/bbb5i83nv425cm9r2kadx8mvlglv2vwx-system-units/systemd-networkd-wait-online.service.d
             └─overrides.conf
     Active: failed (Result: exit-code) since Mon 2024-11-18 10:42:18 CET; 58ms ago
       Docs: man:systemd-networkd-wait-online.service(8)
    Process: 64823 ExecStart=/nix/store/h05qs7dk5i6490ji0f9fndia9q2wwjac-systemd-255.9/lib/systemd/systemd-networkd-wait-online --timeout=120 (code=exited, status=1/FAILURE)
   Main PID: 64823 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
        CPU: 6ms

Nov 18 10:40:18 pulse-14 systemd[1]: Starting Wait for Network to be Configured...
Nov 18 10:42:18 pulse-14 systemd-networkd-wait-online[64823]: Timeout occurred while waiting for network connectivity.
Nov 18 10:42:18 pulse-14 systemd[1]: systemd-networkd-wait-online.service: Main process exited, code=exited, status=1/FAILURE
Nov 18 10:42:18 pulse-14 systemd[1]: systemd-networkd-wait-online.service: Failed with result 'exit-code'.
Nov 18 10:42:18 pulse-14 systemd[1]: Failed to start Wait for Network to be Configured.
warning: error(s) occurred while switching to the new configuration

I'm think this is related to the change introduced in https://github.com/numtide/nixos-facter-modules/commit/b4beb32149a16d15220e307ca4c9d7ff4eddc3ce in combination with https://github.com/numtide/nixos-facter-modules/commit/cbbb0f780bddc5648ca4ee33a6c788e07c971776 (the latter fixing the enabled state of the module).

To Reproduce

Not sure it's possible to reproduce it without my machine. I guess you could build a vm from https://github.com/britter/nix-configuration rev aca40ed12989136e8807a2a572cf3c22e199d284. Enabling this configuration fails unless facter.detected.dhcp.enable = false.

Expected behavior Using facter-modules does not break networking or switching to a new generation.

System information

Additional context

Mic92 commented 1 hour ago

That's actually an issue with networkd. We have disabled the wait-online.target everywhere without having had any downsides: https://github.com/nix-community/srvos/blob/e26a814735f50034e35dff637efad2d502698d09/nixos/common/networking.nix#L16

Not sure if we should do the same here.

britter commented 58 minutes ago

Can't tell. I guess you had a reason for enabling it in https://github.com/numtide/nixos-facter-modules/commit/b4beb32149a16d15220e307ca4c9d7ff4eddc3ce.