Handling of renamed interfaces
Andrei Borzenkov
arvidjaar at gmail.com
Thu Jan 4 07:23:46 UTC 2024
On 03.01.2024 23:26, Beniamino Galvani wrote:
> On Wed, Jan 03, 2024 at 08:23:58PM +0300, Andrei Borzenkov wrote:
>> I was looking at forum post where user had to restart NetworkManager after
>> boot to get working network. It seems that the system is too fast and
>> interfaces get renamed by udev after NetworkManager has been started and saw
>> the interfaces under the original name. Like
>>
>> ...
>> Jan 03 17:51:39 XPS-Station NetworkManager[1088]: <info> [1704297099.0481]
>> device (wlan0): interface index 2 renamed iface from 'wlan0' to 'wlp58s0'
>> ...
>> Jan 03 17:51:39 XPS-Station NetworkManager[1088]: <info> [1704297099.0850]
>> device (wlp58s0): state change: unmanaged -> unavailable (reason 'managed',
>> sys-iface-state: 'external')
>>
>> So NM treats them as external and ignores. After restart NM starts with new
>> interface names and continues.
>>
>> Is it expected behavior? I do not see any practical way to synchronize
>> interface renaming with starting of NM. Is it possible to tell NM to
>> continue handling interfaces under the new name?
>
>> The full log after boot is available as:
>
>
> Hi,
>
> NM waits that udev has renamed the interface before starting to
> manage it. It does so by using libudev which monitors the netlink
> events generated by udev.
>
udev already has renamed this interface. No more events are going to
appear. Nor do I understand how NM can predict the future and know that
interface is going to be renamed and wait for this event.
> You can see that in the log above, where the interface moves from
> "unmanaged" to "unavailable" just after the rename. In "unavailable",
> the WiFi device is waiting for wpa_supplicant to initialize the
> interface, and you should see that it moves to "disconnected" some
> time later.
>
No, it never moves to this state.
> For an overview of device states see:
>
> https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/1.45.9-dev/docs/internal/device.md#device-states
>
Quoting this link
EXTERNAL: the interface is not touched by NM.
Which is exactly what we observe - after renaming interface (not device)
state becomes "external" and NM ignores it.
> If the device stays in "unavailable", please enable trace logging in
> NM to debug why (set level=trace in the [logging] section of
> /etc/NetworkManager/NetworkManager.conf and restart the service).
>
> Beniamino
More information about the Networkmanager
mailing list