Nixos-rebuild switch vs build vs boot - NetworkManager-wait-online.service fails

Hello

while nixos-rebuild build / boot runs fine.

nixos-rebuild build --show-trace

building Nix...
building the system configuration...

nixos-rebuild switch -p “with hardware config t940”

building Nix...
building the system configuration...
updating GRUB 2 menu...
lsblk: /dev/mapper/no*[0-9]: not a block device
lsblk: /dev/mapper/block*[0-9]: not a block device
lsblk: /dev/mapper/devices*[0-9]: not a block device
lsblk: /dev/mapper/found*[0-9]: not a block device
File descriptor 16 (socket:[61238]) leaked on vgs invocation. Parent PID 4493: grub-probe
File descriptor 16 (socket:[61238]) leaked on vgs invocation. Parent PID 4493: grub-probe
File descriptor 16 (socket:[61238]) leaked on vgs invocation. Parent PID 4571: grub-probe
File descriptor 16 (socket:[61238]) leaked on vgs invocation. Parent PID 4571: grub-probe
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 20.04 LTS (20.04) on /dev/mapper/vgCrypt-rootubuntu
activating the configuration...
setting up /etc...
reloading user units for sddm...
reloading user units for ae...
setting up tmpfiles
warning: the following units failed: NetworkManager-wait-online.service

● NetworkManager-wait-online.service - Network Manager Wait Online
   Loaded: loaded (/nix/store/dxdb51vfp4dgspdv8injb1pw7l9xhyiq-network-manager-1.22.10/etc/systemd/system/NetworkManager-wait-online.service; enabled; vendor preset: enabled)
  Drop-In: /nix/store/znxxw2llmffcnmlkg8mb6pvairwk9mfd-system-units/NetworkManager-wait-online.service.d
           └─overrides.conf
   Active: failed (Result: exit-code) since Wed 2020-06-17 15:31:28 CEST; 18ms ago
     Docs: man:nm-online(1)
  Process: 6062 ExecStart=/nix/store/dxdb51vfp4dgspdv8injb1pw7l9xhyiq-network-manager-1.22.10/bin/nm-online -s -q --timeout=30 (code=exited, status=1/FAILURE)
 Main PID: 6062 (code=exited, status=1/FAILURE)
       IP: 0B in, 0B out
      CPU: 32ms

Jun 17 15:30:58 nixos systemd[1]: Starting Network Manager Wait Online...
Jun 17 15:31:28 nixos systemd[1]: NetworkManager-wait-online.service: Main process exited, code=exited, status=1/FAILURE
Jun 17 15:31:28 nixos systemd[1]: NetworkManager-wait-online.service: Failed with result 'exit-code'.
Jun 17 15:31:28 nixos systemd[1]: Failed to start Network Manager Wait Online.
warning: error(s) occurred while switching to the new configuration

What can I do to get a switch performed?


update:
It looks like it is failing if DHCP for enp is retring non stop.

Jun 18 09:08:00 nixos nixos[12970]: switching to system configuration /nix/store/jwxq8lpb8jg58vakld6sn4sx2c50xssb-nixos-system-nixos-20.03.2157.db31e48c5c8 failed (status 4)
→ there is no new generation created when it fails

network services don’t restart with switch because it would also interrupt ssh connections. I’m not aware of a way to force to restart all systemd units.

Hello jonringer,

thanks for the info.
Well, if I actively nixos-rebuild why should I want to keep any current ssh connection?

I did a garbage-collection and the rebuild switch worked. There were no NetworkManager-wait-online.service - failed so I cannot see that nixos is stable and reproducable (as well randomly there are DHCP issues even in conofiguration.nix it is set to false )

I have a remote machine which I ssh into, and the switch logic works there.

Ah, then it probably wasn’t related. You can use journalctl to view the logs of a given systemd unit, it should give you more context as to why the original service failed to restart.