/srv/irclogs.ubuntu.com/2020/11/17/#netplan.txt

BPetitSurbleHello everyone, I have a small issue with netplan (I think) on my Focal Fossa PC and I am not sure if it is a bug or just a wrong use from my side, am I in the right place?08:06
kjetilhosure09:23
BPetitSurbleI am in the following situation: I have a bunch of identical machines to install, so I made an install script to be able to do so.In terms of network, my install script does:- rename network interfaces by adding a udev rule,- turn off NetworkManager with nmcli networking off,- stop the NetworkManager service,- run sudo udevadm control09:26
BPetitSurble--reload-rules && sudo udevadm trigger --action=add,- then restart the NetworkManager service,- and finally it runs nmcli networking onUp until this point, everything is ok: my interfaces are renamed and I have a connection established, but then I want to start managing my interfaces by adding a netplan yaml configuration and running sudo netplan09:26
BPetitSurbleapply.Unfortunately so far that command does not succeed, erroring out on the fact udevadm settle command is returning error code 1.If I reboot the PC then the configuration seems to be applied though.My problem is that I would expect to be able to avoid rebooting the PC to apply my configuration.09:26
BPetitSurbleoh09:26
BPetitSurbleindentation whent of09:27
BPetitSurble*off09:27
BPetitSurbleI will repost bit by bit09:27
BPetitSurbleI am in the following situation: I have a bunch of identical machines to install, so I made an install script to be able to do so.09:27
BPetitSurbleIn terms of network, my install script does:09:27
BPetitSurble- rename network interfaces by adding a udev rule,09:27
BPetitSurble- turn off NetworkManager with nmcli networking off,09:28
BPetitSurble- stop the NetworkManager service,09:28
BPetitSurble- run sudo udevadm control --reload-rules && sudo udevadm trigger --action=add,09:28
BPetitSurble- then restart the NetworkManager service,09:28
BPetitSurble- and finally it runs nmcli networking on09:28
BPetitSurbleUp until this point, everything is ok: my interfaces are renamed and I have a connection established, but then I want to start managing my interfaces by adding a netplan yaml configuration and running sudo netplan apply.09:28
BPetitSurbleUnfortunately so far that command does not succeed, erroring out on the fact udevadm settle command is returning error code 1.09:28
BPetitSurbleIf I reboot the PC then the configuration seems to be applied though.09:28
BPetitSurbleMy problem is that I would expect to be able to avoid rebooting the PC to apply my configuration (so that my install script can continue in one go)09:29
BPetitSurbleMy netplan version is the most recent available to Ubuntu 20.04: 0.100-0ubuntu4~20.04.309:32
slyonBPetitSurble: would you mind adding a "&& sudo udevadm settle" command after your "udevadm trigger"? That way we can see if this is somehow related. and your script waits with starting up the network for all interfaces to be created09:35
slyonwhy are you renaming and restarting the NetworkManager service manually? Netplan is able to do that for you as well..09:35
BPetitSurbleI did try manually sudo udevadm settle by itself and it is timing out and returning 1, but I can do it as part of the script as well it will just take a bit more time.09:37
slyonThats fine. no need to put it as part of the script then.09:37
slyonBut it shows that this problem is most probably unrelated to netplan, but might be related to the udev rules you put in there. Does 'udevadm settle' also fail/timeout if you did not add your udev rule?09:38
BPetitSurbleI do the renaming separately because I had a bit of script already reading mac addresses of the machines that I install and use a pattern to automatically create the udev rules for naming them (the vendor of the machines I have to install has a pattern between mac addresses and physical position of the eth sockets on their mother board)09:39
BPetitSurbleOk I will try this09:40
slyonOk. You might also consider filling the "match.macaddress" setting in the netplan YAML from your script extracting the MAC addresses and setting the "set-name" field accordingly (https://netplan.io/reference/#common-properties-for-physical-device-types) that way you would not need all that manual nmcli/NetworkManager/udevadm magic as netplan could just do that for you09:43
BPetitSurbleI see, I guess I can try to generate the netplan .yaml configuration automatically instead of generating the udev files09:44
slyonRight, that might make things easier, as it is more of a "standard way" to do those things.09:45
BPetitSurbleOk, I am reinstalling a machine to a default state, I will try to check udevadm settle before adding the rule, then I will try to make one configuration manually on another clean machine to see if it succeeds without reboot09:48
BPetitSurbleIt may take a while10:11
slyonSure, take your time.10:24
BPetitSurbleOk, so here are some first results:12:14
BPetitSurble1) as suggested from a fresh ubuntu without adding the .rules file sudo udevadm settle does not hang12:14
BPetitSurble2) I tried from a fresh install applying a netplan configuration with maching on the mac address, and it does not hang, but the interface does not seem to get renamed12:16
BPetitSurbleIn case number 2 after reboot though the interfaces have the correct name12:17
BPetitSurbleWhich is back to the original problem I had, trying to make it work without reboot12:21
slyonOkay, so the error returned my "udevadm settle" must be somehow related to the udev rules you're adding. Therefore, I'd prefer to work on method (2):12:25
slyonare the interfaces renamed when you put them down, before running 'netplan apply'? I.e.: sudo ip link set eth0 down (adopt to your interface names)12:25
BPetitSurbleOk will try now12:26
BPetitSurbleSo again on a fresh install of Ubuntu 20.04, I copied my configuration file, ran sudo ip link set xxx down to all choices auto completed, then ran sudo netplan apply12:43
BPetitSurbleInterfaces are pulled up again but not renamed12:43
BPetitSurbleCould I have botched my configuration?12:43
BPetitSurble*my config file12:44
slyondid you make sure the interfaces are actually down before running 'netplan apply' (via 'ip link')?12:44
slyonI'm not sure how the different networking daemons (NetworkManager, systemd-networkd, ...) reacht if you pull their active interfaces. Maybe they need to be stopped as well. (But I think no fresh install is needed)12:45
BPetitSurbleSorry  I got disconnected, I may have missed a message or two12:50
slyondid you make sure the interfaces are actually down before running 'netplan apply' (via 'ip link')?12:50
slyonI'm not sure how the different networking daemons (NetworkManager, systemd-networkd, ...) reacht if you pull their active interfaces. Maybe they need to be stopped as well. (But I think no fresh install is needed)12:50
BPetitSurbleOk I will try that right now12:50
BPetitSurbleSo after using sudo iplink set xxx down to all my interfaces, ip link show tells me they are in state down12:56
BPetitSurbleMy network manager is NetworkManager, I tried having it stop managing network with nmcli networking down12:57
BPetitSurble* nmcli networking off12:57
BPetitSurbleand I tried stopping it service also12:58
BPetitSurblebefore running netplan apply12:58
BPetitSurblein both cases it seems I had the same result12:58
slyonhmm... I'm not an expert in udev, but this seems strange, as according to this post it should work when the interfaces are down: https://unix.stackexchange.com/questions/205010/centos-7-rename-network-interface-without-rebooting Are you able to manually rename the interface according the those commands from stackexchange?13:00
slyoni.e. the 3 "ip link set..." commands from the accepted answer13:01
BPetitSurbleIndeed I am able to do so13:01
BPetitSurbleI may have made a mistake in my netplan config file?13:02
slyonBut you said it works after reboot, right? So it should be correct and seems to be a runtime issue instead13:02
BPetitSurbleElse I am not sure13:02
BPetitSurbleYes It does13:02
slyonCan you maybe paste the output of 'sudo netplan --debug apply'? So we can see what it is trying to do?13:05
BPetitSurbleHere it is: https://pastebin.ubuntu.com/p/mdK9MPR6P3/13:09
BPetitSurbleI reused my previous configuration and added the match fields in it13:19
slyonyeah... looks okay so far.13:26
slyonWould you mind switching your renderer/backend to 'renderer: networkd' in all of your netplan YAML files? maybe it's a problem with the NM backend, as I think this feature is primarily used in server setups, where the systemd-networkd backend is in use13:27
BPetitSurbleOk, I guess I also should disable NetwokManager Service and enable the systemd-networkd one?13:28
slyonyes. But this is just guessing right now, I'm not sure what's going on there13:28
BPetitSurbleok13:29
BPetitSurbleI replace to networkd following basically these steps: https://gist.github.com/docent-net/803d5379846fd6aba7d713:39
BPetitSurbleAnd replaced the renderer in both config files found under /etc/netpla13:39
BPetitSurbleBut netplan --debug apply gave me about the same result13:40
slyonhmm... But renaming the interfaces manually, independently of anything else, works. Right? e.g.:13:41
slyon/sbin/ip link set eth1 down13:41
slyon/sbin/ip link set eth1 name eth12313:41
slyon/sbin/ip link set eth123 up13:41
BPetitSurbleIt did13:41
BPetitSurbleNow that I use networkd I cannot seem to pull up my previous interface13:42
BPetitSurbleBut even though I cannot seem to pull it up in this configuration, manually renaming works13:45
BPetitSurble(renamed but also does not go up)13:45
slyonActually... the "DEBUG:Skipping non-physical interface: enp6s0" part of your log looks interesting... as enp6s0 actually IS a physical interface and should not be skipped. You might have found a bug in netplan...13:47
BPetitSurbleOh13:49
BPetitSurbleInterresting13:49
BPetitSurbleAlso a small update on my comment about going up after using networkd (in case it is useful) the interface seems to go up as shown by sudo ip link show when I use sudo /sbin/ip link set xxx up instead of sudo ip link set xxx up13:52
BPetitSurbleIn case it might be a bug, should I post on the netplan Launchpad?13:53
slyonBPetitSurble: Yes, that would be very helpful. Please open a bug report on the netplan Launchpad.13:55
BPetitSurbleThank you very much for your support today, I will open that tomorrow as it is quite late in my timezone already13:55
BPetitSurbleAgain thank you13:55
slyonThank you too for your research!13:55
BPetitSurbleAnd goodbye13:55
slyonbye13:56
=== akp55_ is now known as akp55__
user217_hello. I cant ping hostnames from vps , is it becouse my netplan config is wrong ?19:15

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