/srv/irclogs.ubuntu.com/2022/04/21/#netplan.txt

StyXmanschopin: ack07:25
Guest9223Hi. I'm having some issues with a Hetzner server: after the apt update && apt upgrade && reboot netplan doesn't set the default gateway anymore -> I can only access it via a KVM. Any ideas what I can do or how to debug this? I compared the config to another server and I don't see any differences. Actually I never touched the default netplan config15:40
Guest9223from Hetzner until now ;-)15:40
Guest9223That command brought the machine back online (the "onlink" was required, otherwise it gave me an error): sudo ip route add default via 1.2.3.4 (gateway IP) dev enp7s0 onlink15:42
Guest9223I started systemd-networkd in debug mode according to the docs here and the machine was disconnected and the default gateway is gone again: https://wiki.ubuntu.com/DebuggingSystemd15:43
Guest9223Now I'm connected via the KVM and have no idea how to fix that and what causes that behavior...15:44
slyoncan you show your config from /etc/netplan/*.yaml?15:44
Guest9223slyon: sure... give me a minute15:45
Guest9223slyon: here: https://pastebin.com/HmnUcHVL15:49
Guest9223It also matches the Hetzner docs here: https://docs.hetzner.com/de/robot/dedicated-server/network/net-config-debian-ubuntu/15:49
slyonThank you, could you please also show the output of `networkctl status enp7s0` just to see if that is passed through correctly15:52
Guest9223sure, one sec15:52
slyonand maybe "route" and "route -6"15:52
slyonerr. "ip route" and "ip -6 route" that is15:53
Guest9223route is empty, route -6 says "/proc/net/ipv6_route: No such file or directory \ INET6 (IPv6) not configured in this system15:54
Guest9223netowrkctl isn't so easy, I can't copy & paste anything and it includes public IPs... but I see "State: routable (failed)15:55
slyonthe route output is interesting. "route" being empty should not be the case, as there is a default route defined in netplan, and also some ipv6 addresses and a gateway, so it should exist15:57
Guest9223ip route and ip -6 route are both empty15:57
slyonnetworkctl: failed, is interesting, too. in this case you should check your journalctl -u systemd-networkd (you put that already into debug mode which is good)15:58
Guest9223Somehow it failes to set that route... I did it manually last time and the machine was online immediatly again until I started systemd-networkd in debug mode15:58
Guest9223It's Ubuntu 20.04 HWE (Hetzner installimage) btw and everything patched as of yesterday.15:59
Guest9223lemme try journalctl...15:59
Guest9223Btw. when I run lib/systemd/systemd-networkd it shows "Enumeration completed \ enp7s0: Could not set address: Operation not supported \ enp7s0: Failed16:01
slyonthat's probably the problem.. but I'm not sure what "Operation not supported" means. are there any more hints in journalctl?16:06
slyonyou didn't put any custom networkd configuration or systemd override, right?16:06
Guest9223In journalctl I see that error message the first time appeared yesterday after the reboot... So seems that something is broken16:07
Guest9223Nope, I didn't touch that file until today when I started to investigate it but still I didn't modify anything. I was running netplan generate and apply but nothing (to my knowledge) should have modified anything here16:08
Guest9223And WireGuard was set up which I disabled, just in case16:08
Guest9223I saw that netplan was updated end of March... I would almost say that it broke something -> I have a few other servers but I don't want to reboot them now until this is solved because they are productive ;-)16:09
slyonto me it looks like netplan is doing it's job. but networkd is somehow failing to comunicate with the kernel... so it might be a kernel or systemd-networkd issue :-/ did you updates for those packages as well?16:12
slyoncould you try booting an older kernel image?16:12
Guest9223Here is a screenshot of journalctl -> the upper part before the empty line is the last successful one: https://imgur.com/BfCgsOL16:13
slyoncould you maybe paste a (redacted) version of /run/systemd/network/10-netplan-enp7s0.network ?16:14
Guest9223I've updated everything available yesterday, ~24h ago. I also checked for new updates today after setting the route manually -> nothing new16:14
Guest9223sure, one sec16:14
slyonI could try to apply that on a 20.04 machine and see if it produces the same issue..16:14
Guest9223https://imgur.com/7UH7TW916:17
Guest9223The IP address match the one from /etc/netplan/01... and I also coudn'T see any difference on another server (besides diffferent IP addresses, ofc)16:18
ddstreetGuest9223 your ip address has netmask /32 so it can't reach your gateway, of course16:19
ddstreetif you actually want the /32 netmask for some reason then you need to add a specific route to the gateway before actually adding the default route16:19
Guest9223Regarding kernel updates: I just used apt update && apt upgrade, nothing was installed manually, no modules etc.16:19
ddstreetbut you almost certainly don't actually want a /32 subnet16:21
Guest9223ddstreet: well it is mentioned and explained like this in the Hetzner docs: https://docs.hetzner.com/de/robot/dedicated-server/network/net-config-debian-ubuntu/ + another server has the same netmask and that one is working fine. So maybe something was changed here with a recent update and the Hetzner docs are outdated?16:22
ddstreetok it's fine to do that - i.e. the 'point to point' stuff they talk about - but you do have to define the route to the gateway16:22
Guest9223What I mean: they set/recommend it like that, I think to protect from (accidental or malicious) IP changes and duplicate IP addresses with other customers - that'S how I understand their docs16:22
ddstreetthat's what the 'on-link' does, it says 'ok kernel i know you have no route to this ip, but don't worry it really is on your link local so just pretend you can route to it'16:23
ddstreetif systemd isn't properly handling the setting there might be a systemd bug16:24
Guest9223Yeah that explains why it errored out without the "online" parameter and it was working for a few months like that -> I think January 24th 2022 or so16:24
ddstreetah16:24
ddstreetGuest9223 in your .network file the param is misspelled16:24
ddstreetit's GatewayOnLink not GatewayOnlink16:24
ddstreetchange the L capitalization and it should work ok16:24
ddstreetnot sure if netplan is using the wrong cap?16:24
Guest9223Lemme check...16:25
Guest9223Is it enough to edit the .network file? Because I get the same error and on another (not yet rebooted) server it is also lowercase16:26
ddstreetno, it looks like there's a bug in netplan where it's using the wrong spelling16:26
Guest9223So something is case sensitive and not recognizing the key you mean?16:27
ddstreetuntil that's fixed, i guess you could add a drop-in file, e.g. if the netplan-generated file is named '10-netplan-enp7s0.network' then create a file /etc/systemd/network/10-netplan-enp7s0.network.d/override.conf' and make its content:16:28
ddstreet[Route]16:28
ddstreetGatewayOnLink=true16:28
ddstreet(just those lines)16:28
ddstreetthen i think if you reboot it shoudl work16:28
slyonddstreet: netplan is rendering it as "GatewayOnlink=true".. but that didn't change since 2018... and it was actually changed from GatewayOnLink -> GatewayOnlink in that commit d419c7b816:28
ddstreetah ok that's interesting then16:28
Guest92Got disconnected... did my GitHub message make it?16:29
slyonGuest92: no, i don't think so16:31
Guest92https://github.com/canonical/netplan/search?q=GatewayOnLink shows GatewayOnlink only, lowercase16:32
slyonnetplan is rendering it as "GatewayOnlink=true".. but that didn't change since 2018... and it was actually changed from GatewayOnLink -> GatewayOnlink in that commit d419c7b816:32
ddstreetGuest92 i'm wrong, as slyon said either spelling is ok16:32
ddstreetso ignore me, might be the kernel as he said :)16:33
Guest92Seems that systemd-networkd is accepting both: https://github.com/systemd/systemd/search?q=GatewayOnLink16:33
slyonI got to drop now. I think this problem is most probably related to networkd or kernel (as the error message told us: "Enumeration completed \ enp7s0: Could not set address: Operation not supported \ enp7s0: Failed")16:33
Guest92That one is correct: https://github.com/systemd/systemd/blob/2afb2f4a9d6a497dfbe1983fbe1bac297a8dc52b/src/network/networkd-route.c#L234816:33
Guest92Hm... I'm not a kernel dev... any idea what to do now? ;-)16:34
Guest92I can set the route manually via ip route add... but that lasts only until the next reboot16:34
ddstreetslyon fyi systemd is only keeping the 'Onlink' spelling for backwards compat, the correct usage is 'GatewayOnLink' per upstream commit 9cb8c5593443d24c19e40bfd4fc06d672f8c554c16:39
Guest92Ok, so a little bug discovered (it should be GatewayOnLink in the .network file) but that probably isn't the issue here? :-)16:41
ddstreetright it's definitely not the issue for you16:42
ddstreetcan you share the output of 'ip a' after it fails? it's unable to set your static ip, which is strange16:44
ddstreetand check your kernel logs, e.g. 'journalctl -b -k'16:51
Guest92One sec... I enabled IPv6 again in /etc/default/ufw and enabled more logging for systemd-networkd16:51
Guest92Just rebooting and seeing what will happen now...16:51
Guest92https://imgur.com/lhVCC4R16:54
Guest92Still dead after reboot...16:54
ddstreetbut you still get the 'Could not set address' error?17:00
ddstreetthe address looks set17:00
Guest92I see some ACPI Errors in the journalctl -b -k output and the last line is "enp7s0... Link is Up, Full Duplex etc.17:02
ddstreetno errors from networkd?17:02
Guest92Nope... but still the same error in journalctl -u systemd-networkd17:03
Guest92But much more debug output now... shall I upload that? I can set the route manually to get the machine online17:03
ddstreetsure17:03
Guest92There we go: https://pastebin.com/8KUYndZw17:10
Guest92I just replace the first 3 parts of the IP, the last part is the original17:10
ddstreetGuest92 do you have ipv6 disabled?17:18
ddstreetlike, in the kernel cmdline?17:18
Guest92AFAIR I disabled it only via /etc/default/ufw but not sure... how to check that?17:19
ddstreetwell first check /proc/cmdline17:19
ddstreetto make sure you didn't disable ipv6 globally17:20
Guest92Yeah, looks disabled: BOOT_IMAGE=/vmlinuz-5.13.0-40-generic root=/dev/mapper/vg0-root ro ipv6.disable=1 nomodeset consoleblank=017:20
Guest92Ah I remember... seems I disabled it via grub: GRUB_CMDLINE_LINUX="ipv6.disable=1"17:21
ddstreetok...and you're telling networkd to set up an ipv6 address?17:21
Guest92Ok, lemme check... I'll enable it and reboot...17:22
Guest92Holy moly! That was the problem! ;-)17:26
ddstreetyeah, hard for networkd to add the ipv6 addr you asked it to add, when ipv6 is disabled :)17:27
Guest92Besides that mistake on my behalf... shouldn't it set up IPv4 at least or somehow detect that? I found another issue here with a similar case: https://github.com/systemd/systemd/issues/1265617:27
Guest92And... do you guys accept coffee or donations somehow? ;-)17:28
ddstreetnetworkd doesn't do 'partially configured', if part of the interface setup fails it's considered 'failed'17:28
ddstreetso since setting (one of) the addresses failed, networkd didn't bother to continue with the next step, adding the route for the interface17:29
Guest92I see... BIG BIG BIG thank you to help me figuring this out! :-)17:34

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!