Why is my wlan device being renamed?

9,082

It's being renamed so that it has a consistent name regardless of what order network devices are probed/connected (otherwise, if you had two USB wifi devices, which is wlan0 and wlan1 would potentially change every boot — or when doing it by MAC address, replacing a NIC suddenly made eth0 become eth1 causing all kinds of failure). More details & rationale can be found at https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/

To disable it, Debian provides two methods. Quoting from /usr/share/doc/udev/README.Debian.gz):

  • Put "net.ifnames=0" into the kernel command line (e. g. in /etc/default/grub's GRUB_CMDLINE_LINUX_DEFAULT, then run "update-grub").

  • Disable the default *.link rules with "ln -s /dev/null /etc/systemd/network/99-default.link" and rebuild the initrd with "update-initramfs -u".

The name shouldn't have anything to do with iwconfig failing.

Share:
9,082

Related videos on Youtube

maja
Author by

maja

Updated on September 18, 2022

Comments

  • maja
    maja over 1 year

    This is a selection from my dmesg:

    rtl8192cu 1-3:1.0 wlx10bef501e1cd: renamed from wlan0
    wlx10bef501e1cd: authenticate with 90:94:e4:e7:99:cc
    wlx10bef501e1cd: send auth to 90:94:e4:e7:99:cc (try 1/3)
    wlx10bef501e1cd: authenticated
    wlx10bef501e1cd: aborting authentication with 90:94:e4:e7:99:cc by local choice (Reason: 3=DEAUTH_LEAVING)
    

    Where that particular error is linked to device names being too long a string, as probably emerges by this attempt at connection:

    ___@DESK:~$ sudo iwconfig wlx10bef501e1cd essid dlink_DIR-506L key s:___{pass}___
    Error for wireless request "Set Encode" (8B2A) :
        SET failed on device wlx10bef501e1cd ; Invalid argument.
    

    The dongle as in the output of lsusb is a:

    Bus 001 Device 002: ID 2001:3308 D-Link Corp. DWA-121 802.11n Wireless N 150 Pico Adapter [Realtek RTL8188CUS]
    

    At the same time, that device (a wifi usb dongle) was used to successfully install Debian as a net install, with the same long string being the id showed by the installation GUI during download of the packages.

    I tried to rename the device by creating a rule in /etc/udev/rules.d/70-persistent-net.rules without success (I used at the output of udevadm info and saved the attempt below amongst others, where "1-3" is the third device on bus one).

    SUBSYSTEM=="usb",ACTION=="add",DRIVERS=="usb",ATTRS{product}=="802.11n WLAN Adapter",ATTR{dev_id}=="0x0",ATTR{type}=="1",KERNEL=="1-3",NAME="wlan1"
    

    Why is that device being renamed to such a problematic id in the first place? Instead of trying to patch the situation later down the line is there a way I can just avoid wlan0 to be renamed?


    After accepting an answer for this question I realized the answers for How can I change the default “ens33” network device to old “eth0” on Fedora 19? include the solution for this problem, but the process described there also include steps that are not strictly required to solve this question.

    I'm not sure if this qualifies as a duplicate or not.

    • dirkt
      dirkt over 5 years
      Your udev rule is wrong (use SUBSYTEM=="net" or you'll be renaming the raw usb device, not the network interface. Note you need to match on several hierarchy levels, so DRIVERS may be wrong). I've no idea why you get such a long name, the usual suspect is rules provided by systemd. And a udev rule with higher priority is how to avoid id.
    • maja
      maja over 5 years
      @dirk I was using SUBSYTEM=="net" without getting any results, what do you think should be the correct rule and in which file should I save it?
  • Rui F Ribeiro
    Rui F Ribeiro over 5 years
  • derobert
    derobert over 5 years
    @RuiFRibeiro Could be, though it's a different distro.
  • maja
    maja over 5 years
    @derobert I don't know what the expected behavior should be, but after adding "net.ifnames=0"to the grub configuration and obtaining a device named with a shorter string now I can connect to the internet without an itch
  • maja
    maja over 5 years
    I'm sure that renaming the device to any other short id would have worked, but since this is my own home desktop I fell confident just using it as is for now