BPetitSurble | Hello 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 |
---|---|---|
kjetilho | sure | 09:23 |
BPetitSurble | I 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 control | 09: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 netplan | 09:26 |
BPetitSurble | apply.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 |
BPetitSurble | oh | 09:26 |
BPetitSurble | indentation whent of | 09:27 |
BPetitSurble | *off | 09:27 |
BPetitSurble | I will repost bit by bit | 09:27 |
BPetitSurble | I 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 |
BPetitSurble | In 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 on | 09:28 |
BPetitSurble | Up 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 |
BPetitSurble | Unfortunately so far that command does not succeed, erroring out on the fact udevadm settle command is returning error code 1. | 09:28 |
BPetitSurble | If I reboot the PC then the configuration seems to be applied though. | 09:28 |
BPetitSurble | My 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 |
BPetitSurble | My netplan version is the most recent available to Ubuntu 20.04: 0.100-0ubuntu4~20.04.3 | 09:32 |
slyon | BPetitSurble: 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 created | 09:35 |
slyon | why are you renaming and restarting the NetworkManager service manually? Netplan is able to do that for you as well.. | 09:35 |
BPetitSurble | I 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 |
slyon | Thats fine. no need to put it as part of the script then. | 09:37 |
slyon | But 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 |
BPetitSurble | I 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 |
BPetitSurble | Ok I will try this | 09:40 |
slyon | Ok. 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 you | 09:43 |
BPetitSurble | I see, I guess I can try to generate the netplan .yaml configuration automatically instead of generating the udev files | 09:44 |
slyon | Right, that might make things easier, as it is more of a "standard way" to do those things. | 09:45 |
BPetitSurble | Ok, 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 reboot | 09:48 |
BPetitSurble | It may take a while | 10:11 |
slyon | Sure, take your time. | 10:24 |
BPetitSurble | Ok, so here are some first results: | 12:14 |
BPetitSurble | 1) as suggested from a fresh ubuntu without adding the .rules file sudo udevadm settle does not hang | 12:14 |
BPetitSurble | 2) 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 renamed | 12:16 |
BPetitSurble | In case number 2 after reboot though the interfaces have the correct name | 12:17 |
BPetitSurble | Which is back to the original problem I had, trying to make it work without reboot | 12:21 |
slyon | Okay, 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 |
slyon | are 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 |
BPetitSurble | Ok will try now | 12:26 |
BPetitSurble | So 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 apply | 12:43 |
BPetitSurble | Interfaces are pulled up again but not renamed | 12:43 |
BPetitSurble | Could I have botched my configuration? | 12:43 |
BPetitSurble | *my config file | 12:44 |
slyon | did you make sure the interfaces are actually down before running 'netplan apply' (via 'ip link')? | 12:44 |
slyon | I'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 |
BPetitSurble | Sorry I got disconnected, I may have missed a message or two | 12:50 |
slyon | did you make sure the interfaces are actually down before running 'netplan apply' (via 'ip link')? | 12:50 |
slyon | I'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 |
BPetitSurble | Ok I will try that right now | 12:50 |
BPetitSurble | So after using sudo iplink set xxx down to all my interfaces, ip link show tells me they are in state down | 12:56 |
BPetitSurble | My network manager is NetworkManager, I tried having it stop managing network with nmcli networking down | 12:57 |
BPetitSurble | * nmcli networking off | 12:57 |
BPetitSurble | and I tried stopping it service also | 12:58 |
BPetitSurble | before running netplan apply | 12:58 |
BPetitSurble | in both cases it seems I had the same result | 12:58 |
slyon | hmm... 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 |
slyon | i.e. the 3 "ip link set..." commands from the accepted answer | 13:01 |
BPetitSurble | Indeed I am able to do so | 13:01 |
BPetitSurble | I may have made a mistake in my netplan config file? | 13:02 |
slyon | But you said it works after reboot, right? So it should be correct and seems to be a runtime issue instead | 13:02 |
BPetitSurble | Else I am not sure | 13:02 |
BPetitSurble | Yes It does | 13:02 |
slyon | Can you maybe paste the output of 'sudo netplan --debug apply'? So we can see what it is trying to do? | 13:05 |
BPetitSurble | Here it is: https://pastebin.ubuntu.com/p/mdK9MPR6P3/ | 13:09 |
BPetitSurble | I reused my previous configuration and added the match fields in it | 13:19 |
slyon | yeah... looks okay so far. | 13:26 |
slyon | Would 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 use | 13:27 |
BPetitSurble | Ok, I guess I also should disable NetwokManager Service and enable the systemd-networkd one? | 13:28 |
slyon | yes. But this is just guessing right now, I'm not sure what's going on there | 13:28 |
BPetitSurble | ok | 13:29 |
BPetitSurble | I replace to networkd following basically these steps: https://gist.github.com/docent-net/803d5379846fd6aba7d7 | 13:39 |
BPetitSurble | And replaced the renderer in both config files found under /etc/netpla | 13:39 |
BPetitSurble | But netplan --debug apply gave me about the same result | 13:40 |
slyon | hmm... But renaming the interfaces manually, independently of anything else, works. Right? e.g.: | 13:41 |
slyon | /sbin/ip link set eth1 down | 13:41 |
slyon | /sbin/ip link set eth1 name eth123 | 13:41 |
slyon | /sbin/ip link set eth123 up | 13:41 |
BPetitSurble | It did | 13:41 |
BPetitSurble | Now that I use networkd I cannot seem to pull up my previous interface | 13:42 |
BPetitSurble | But even though I cannot seem to pull it up in this configuration, manually renaming works | 13:45 |
BPetitSurble | (renamed but also does not go up) | 13:45 |
slyon | Actually... 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 |
BPetitSurble | Oh | 13:49 |
BPetitSurble | Interresting | 13:49 |
BPetitSurble | Also 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 up | 13:52 |
BPetitSurble | In case it might be a bug, should I post on the netplan Launchpad? | 13:53 |
slyon | BPetitSurble: Yes, that would be very helpful. Please open a bug report on the netplan Launchpad. | 13:55 |
BPetitSurble | Thank you very much for your support today, I will open that tomorrow as it is quite late in my timezone already | 13:55 |
BPetitSurble | Again thank you | 13:55 |
slyon | Thank you too for your research! | 13:55 |
BPetitSurble | And goodbye | 13:55 |
slyon | bye | 13: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!