Hello guys! I’m trying to setup wireguard but I’m getting the following error message:
× 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/8j8c4r234r5j735k1j27z1jf0zk2k2qa-system-units/systemd-networkd-wait-online.service.d
└─overrides.conf
Active: failed (Result: exit-code) since Fri 2023-09-29 20:39:22 CEST; 89ms ago
Docs: man:systemd-networkd-wait-online.service(8)
Process: 934764 ExecStart=/nix/store/1zmmnm0r0bdga398rl7fc7s4hkyqxjk4-systemd-254.3/lib/systemd/systemd-networkd-wait-online --timeout=120 (code=exited, status=1/FAILURE)
Main PID: 934764 (code=exited, status=1/FAILURE)
IP: 0B in, 0B out
CPU: 10ms
Sep 29 20:37:22 pc systemd[1]: Starting Wait for Network to be Configured...
Sep 29 20:39:22 pc systemd-networkd-wait-online[934764]: Timeout occurred while waiting for network connectivity.
Sep 29 20:39:22 pc systemd[1]: systemd-networkd-wait-online.service: Main process exited, code=exited, status=1/FAILURE
Sep 29 20:39:22 pc systemd[1]: systemd-networkd-wait-online.service: Failed with result 'exit-code'.
Sep 29 20:39:22 pc systemd[1]: Failed to start Wait for Network to be Configured.
I’m using nix-flakes to config my system.
This is in my flake.nix:
Ok, after taking a look into journalctl -fe I found this line:
pc systemd-networkd[12795]: /nix/store/v9fh7i1v3f74bgc90r9zlblxqfdfh6yq-source/secrets/wireguard.age has 0444 mode that is too permissive, please adjust the ownership and access mode.
looks like that the symlink from agenix is a problem.
ok, I found the culprit for this, I chose the wrong attribute… so the permission stuff is fixed, however, this systemd-networkd-wait-online still gets a timeout error
systemd-networkd-wait-online can timeout and fail if there are no network interfaces available for it to manage. When systemd-networkd is enabled but a different service is responsible for managing the system’s internet connection (for example, NetworkManager or connman are used to manage WiFi connections), this service is unnecessary and can be disabled.
I set systemd.network.wait-online.enable = false and my sytem boild succeeds but networkctl still doesn’t show me the wg0 interface.
Ah, you misunderstand; yes, that is an error, but by that time the build has already succeeded and nix switched to the new generation. Your build has always worked, just systemd decided to tell you that it’s failing to manage your network interfaces, and nix will display the errors of units that fail while you are switching to the new configuration. I believe it even does so if the unit failed previously and simply has not been successfully restarted yet.
Another solution is to set this option, so it will only complain if no interfaces have internet: NixOS Search
Or you can add specific interfaces you don’t want to check for internet connection because they aren’t intended to get one before the system is fully up (like wg0) with this option: NixOS Search
@TornaxO7 I had the same and it was a permission problem. It appears systemd.networkd runs as a specific user so if you adjust the secret’s permissions accordingly it works. In my (sops-nix) case: