Re: [systemd-devel] [EXT] Re: [systemd‑devel] Finding network interface name in different distro
On Wed, Oct 19, 2022 at 5:27 AM Ulrich Windl < ulrich.wi...@rz.uni-regensburg.de> wrote: > >>> Lennart Poettering schrieb am 19.10.2022 um > 12:21 > in > Nachricht : > > [...] > > Uninstall biosdevname. It's 2022. > > Make Lennart happy: Uninstall everything except systemd ;-) > > (Sorry, I couldn't resist) > That made me laugh this morning - thanks! Although I like systemd, it was funny :) > > > > It's a bit contradictory to install it explicitly and then turn it off > > via biosdevname=0... > > > > Lennart > > > > ‑‑ > > Lennart Poettering, Berlin > > > >
[systemd-devel] Antw: [EXT] Re: [systemd‑devel] Finding network interface name in different distro
>>> Lennart Poettering schrieb am 19.10.2022 um 12:21 in Nachricht : [...] > Uninstall biosdevname. It's 2022. Make Lennart happy: Uninstall everything except systemd ;-) (Sorry, I couldn't resist) > > It's a bit contradictory to install it explicitly and then turn it off > via biosdevname=0... > > Lennart > > ‑‑ > Lennart Poettering, Berlin
Re: [systemd-devel] Finding network interface name in different distro
On Di, 18.10.22 09:10, Greg Oliver (oliver.g...@gmail.com) wrote: > On Fri, Oct 14, 2022 at 7:42 PM Etienne Champetier < > champetier.etie...@gmail.com> wrote: > > > Hi All, > > > > When changing distro or distro major versions, network interfaces' > > names sometimes change. > > For example on some Dell server running CentOS 7 the interface is > > named em1 and running Alma 8 it's eno1. > > > > I'm looking for a way to find the new interface name in advance > > without booting the new OS. > > One way I found is to unpack the initramfs, mount bind /sys, chroot, > > and then run > > udevadm test-builtin net_id /sys/class/net/INTF > > Problem is that it doesn't give me right away the name according to > > the NamePolicy in 99-default.link > > > > Is there a command to get the future name right away ? > > > > I do not like the biosdevname introduced stuff for machines with 4 or less > interfaces, so another option is to disable the auto-naming: > > biosdevname=0 net.ifnames=0 biosdevname is pretty much obsoleted by systemd's own network naming. Usually, if you have more than a single interface you want the systemd naming though because otherwise probing order is usually undefined and thus your "eth0" might sometimes be "eth1" and vice versa... > on the kernel cmdline will do it. Also, the biosdevname package needs to > be installed. This will yield the traditional ethX, wlanX, etc interface > names that are ordered by default the way they used to be. Of course, this > does not scale well when you have hotplug devices with many pci ports and > ethernet cards if you ever need to replace one card. Just my $.02 Uninstall biosdevname. It's 2022. It's a bit contradictory to install it explicitly and then turn it off via biosdevname=0... Lennart -- Lennart Poettering, Berlin
Re: [systemd-devel] Finding network interface name in different distro
On Di, 18.10.22 11:10, Etienne Champetier (champetier.etie...@gmail.com) wrote: > > > I think I found what I need: > > > bash-4.4# udevadm test /sys/class/net/em1 2>/dev/null | awk -F= > > > '/ID_NET_NAME=/ {print $2}' > > > eno1 > > > > The name depends on local and distro policy, systemd version, > > kernel version and selected network naming scheme level (see > > systemd.net-naming-scheme man page) > > When running in a chroot of the new system, only the kernel varies, > we have the right policy, naming scheme level and systemd version. > For "classic" amd64 servers does the kernel really have an impact on > naming ? As kernels are improved and developed they tend to expose more sysfs attributes on devices, that the udev interface naming logic might pick up then. > > Use "udevadm info /sys/class/net/" to query the udev db for > > automatically generated names. > > > > Relevant udev props to look out for are: > > > > ID_NET_NAME_FROM_DATABASE > > ID_NET_NAME_ONBOARD > > ID_NET_NAME_SLOT > > ID_NET_NAME_PATH > > ID_NET_NAME_MAC > > > > These using hwdb info, firmware info, slot info, device path info or > > MAC addresss for naming. > > What I'm looking for is I think ID_NET_NAME, > ie I don't want to read the policy myself and then go find the right > ID_NET_NAME_* > sadly ID_NET_NAME is not always present, so I don't have a good > solution for now. > (I'm assuming policy kernel can be ignored on amd64 servers, maybe > I'm wrong) udev will rename interfaces it finds based on the data in ID_NET_NAME. I the ID_NET_NAME prop is never set, then udev won't rename the interface. Lennart -- Lennart Poettering, Berlin
Re: [systemd-devel] Finding network interface name in different distro
Le mar. 18 oct. 2022 à 10:11, Greg Oliver a écrit : > > On Fri, Oct 14, 2022 at 7:42 PM Etienne Champetier > wrote: >> >> Hi All, >> >> When changing distro or distro major versions, network interfaces' >> names sometimes change. >> For example on some Dell server running CentOS 7 the interface is >> named em1 and running Alma 8 it's eno1. >> >> I'm looking for a way to find the new interface name in advance >> without booting the new OS. >> One way I found is to unpack the initramfs, mount bind /sys, chroot, >> and then run >> udevadm test-builtin net_id /sys/class/net/INTF >> Problem is that it doesn't give me right away the name according to >> the NamePolicy in 99-default.link >> >> Is there a command to get the future name right away ? > > > I do not like the biosdevname introduced stuff for machines with 4 or less > interfaces, so another option is to disable the auto-naming: > > biosdevname=0 net.ifnames=0 > > on the kernel cmdline will do it. Also, the biosdevname package needs to be > installed. This will yield the traditional ethX, wlanX, etc interface names > that are ordered by default the way they used to be. Of course, this does > not scale well when you have hotplug devices with many pci ports and ethernet > cards if you ever need to replace one card. Just my $.02 I can't change the naming, and often have additional NICs (10/25G) My full use case is to automate the installation of 'appliances' software based on Linux that only have manual ISO install as deployment option. For that I boot on a live system based on Alma 8, download the ISO, unpack it and run their install script a bit modified. Manual and automated install must be bit for bit identical, no changes in the appliance allowed. One info that I need to properly create the network config is the future interface name.
Re: [systemd-devel] Finding network interface name in different distro
Le dim. 16 oct. 2022 à 08:32, Lennart Poettering a écrit : > > On Fr, 14.10.22 22:24, Etienne Champetier (champetier.etie...@gmail.com) > wrote: > > > Le ven. 14 oct. 2022 ą 20:41, Etienne Champetier > > a écrit : > > > > > > Hi All, > > > > > > When changing distro or distro major versions, network interfaces' > > > names sometimes change. > > > For example on some Dell server running CentOS 7 the interface is > > > named em1 and running Alma 8 it's eno1. > > > > > > I'm looking for a way to find the new interface name in advance > > > without booting the new OS. > > > One way I found is to unpack the initramfs, mount bind /sys, chroot, > > > and then run > > > udevadm test-builtin net_id /sys/class/net/INTF > > > Problem is that it doesn't give me right away the name according to > > > the NamePolicy in 99-default.link > > > > > > Is there a command to get the future name right away ? > > > > I think I found what I need: > > bash-4.4# udevadm test /sys/class/net/em1 2>/dev/null | awk -F= > > '/ID_NET_NAME=/ {print $2}' > > eno1 > > The name depends on local and distro policy, systemd version, > kernel version and selected network naming scheme level (see > systemd.net-naming-scheme man page) When running in a chroot of the new system, only the kernel varies, we have the right policy, naming scheme level and systemd version. For "classic" amd64 servers does the kernel really have an impact on naming ? or is it more for other arch with device tree ? > Use "udevadm info /sys/class/net/" to query the udev db for > automatically generated names. > > Relevant udev props to look out for are: > > ID_NET_NAME_FROM_DATABASE > ID_NET_NAME_ONBOARD > ID_NET_NAME_SLOT > ID_NET_NAME_PATH > ID_NET_NAME_MAC > > These using hwdb info, firmware info, slot info, device path info or > MAC addresss for naming. What I'm looking for is I think ID_NET_NAME, ie I don't want to read the policy myself and then go find the right ID_NET_NAME_* sadly ID_NET_NAME is not always present, so I don't have a good solution for now. (I'm assuming policy kernel can be ignored on amd64 servers, maybe I'm wrong) I just found someone with similar needs https://github.com/systemd/systemd/issues/23661 Etienne > > Lennart > > -- > Lennart Poettering, Berlin
Re: [systemd-devel] Finding network interface name in different distro
On Fri, Oct 14, 2022 at 7:42 PM Etienne Champetier < champetier.etie...@gmail.com> wrote: > Hi All, > > When changing distro or distro major versions, network interfaces' > names sometimes change. > For example on some Dell server running CentOS 7 the interface is > named em1 and running Alma 8 it's eno1. > > I'm looking for a way to find the new interface name in advance > without booting the new OS. > One way I found is to unpack the initramfs, mount bind /sys, chroot, > and then run > udevadm test-builtin net_id /sys/class/net/INTF > Problem is that it doesn't give me right away the name according to > the NamePolicy in 99-default.link > > Is there a command to get the future name right away ? > I do not like the biosdevname introduced stuff for machines with 4 or less interfaces, so another option is to disable the auto-naming: biosdevname=0 net.ifnames=0 on the kernel cmdline will do it. Also, the biosdevname package needs to be installed. This will yield the traditional ethX, wlanX, etc interface names that are ordered by default the way they used to be. Of course, this does not scale well when you have hotplug devices with many pci ports and ethernet cards if you ever need to replace one card. Just my $.02 > > Thanks > Etienne >
Re: [systemd-devel] Finding network interface name in different distro
On Fr, 14.10.22 22:24, Etienne Champetier (champetier.etie...@gmail.com) wrote: > Le ven. 14 oct. 2022 à 20:41, Etienne Champetier > a écrit : > > > > Hi All, > > > > When changing distro or distro major versions, network interfaces' > > names sometimes change. > > For example on some Dell server running CentOS 7 the interface is > > named em1 and running Alma 8 it's eno1. > > > > I'm looking for a way to find the new interface name in advance > > without booting the new OS. > > One way I found is to unpack the initramfs, mount bind /sys, chroot, > > and then run > > udevadm test-builtin net_id /sys/class/net/INTF > > Problem is that it doesn't give me right away the name according to > > the NamePolicy in 99-default.link > > > > Is there a command to get the future name right away ? > > I think I found what I need: > bash-4.4# udevadm test /sys/class/net/em1 2>/dev/null | awk -F= > '/ID_NET_NAME=/ {print $2}' > eno1 The name depends on local and distro policy, systemd version, kernel version and selected network naming scheme level (see systemd.net-naming-scheme man page) Use "udevadm info /sys/class/net/" to query the udev db for automatically generated names. Relevant udev props to look out for are: ID_NET_NAME_FROM_DATABASE ID_NET_NAME_ONBOARD ID_NET_NAME_SLOT ID_NET_NAME_PATH ID_NET_NAME_MAC These using hwdb info, firmware info, slot info, device path info or MAC addresss for naming. Lennart -- Lennart Poettering, Berlin
Re: [systemd-devel] Finding network interface name in different distro
Le ven. 14 oct. 2022 à 20:41, Etienne Champetier a écrit : > > Hi All, > > When changing distro or distro major versions, network interfaces' > names sometimes change. > For example on some Dell server running CentOS 7 the interface is > named em1 and running Alma 8 it's eno1. > > I'm looking for a way to find the new interface name in advance > without booting the new OS. > One way I found is to unpack the initramfs, mount bind /sys, chroot, > and then run > udevadm test-builtin net_id /sys/class/net/INTF > Problem is that it doesn't give me right away the name according to > the NamePolicy in 99-default.link > > Is there a command to get the future name right away ? I think I found what I need: bash-4.4# udevadm test /sys/class/net/em1 2>/dev/null | awk -F= '/ID_NET_NAME=/ {print $2}' eno1
[systemd-devel] Finding network interface name in different distro
Hi All, When changing distro or distro major versions, network interfaces' names sometimes change. For example on some Dell server running CentOS 7 the interface is named em1 and running Alma 8 it's eno1. I'm looking for a way to find the new interface name in advance without booting the new OS. One way I found is to unpack the initramfs, mount bind /sys, chroot, and then run udevadm test-builtin net_id /sys/class/net/INTF Problem is that it doesn't give me right away the name according to the NamePolicy in 99-default.link Is there a command to get the future name right away ? Thanks Etienne