How does "biosdevname" work?

I know the purpose of the "biosdevname" function on Linux, but I'm not sure how exactly this works.

I tested it with Ubuntu 14.04 and Ubuntu 14.10 (both 64-bit server releases) and it seems that they allow it by default - right after the system starts up, my network interface has a name, for example p4p1 instead of eth0 , without configuration it is necessary. As I understand it, in order for biosdevname be enabled, the BOTH of these two conditions must be met:

  • boot parameter biosdevname=1 should be passed to the kernel
  • biosdevname must be installed

As I mentioned, both Ubuntu 14.04 and 14.10 seem to offer biosdevname as the default function: they come with the biosdevname package already installed, I did not need to change grub.cfg either - GRUB_CMDLINE_LINUX_DEFAULT has no parameters and my network interface still has BIOS name ( p*p* ) instead of kernel name ( eth* .)

Later I wanted to restore the name of the old device and the interesting part begins. I decided to experiment a bit while trying to disable biosdevname . Since the biosdevname package is required to work (or therefore I read it here and there), I assumed that removing it would be enough to disable it, so I typed:

 sudo apt-get purge biosdevname 

To my surprise, after rebooting, my network interface was still p4p1, , so biosdevname clearly worked, although the biosdevname package was destroyed.

As a next step, I applied the appropriate changes to /etc/network/interfaces in to restore the old name of my network interface (deleted entry for p4p1 and added entry for eth0 ). As a result, after another reboot, ifconfig did not report either eth0 or p4p1 , which was further evidence that the OS still understood BIOS names instead of kernel names.

It turned out that I also had to explicitly change the GRUB entry to GRUB_CMDLINE_LINUX_DEFAULT=biosdevname=0 and update GRUB to get the expected result ( biosdevname disabled and the old network interface name is restored).

My question is : how biosdevname work without the biosdevname package? Is in the end it not required? If so, what exactly provides biosdevname functionality and how does it work?

+6
source share
1 answer

The reason biosdevname continues to annoy you even after you remove the package is because it itself installed the ramdisk initrd source file.

When deleting, the file / usr / share / initramfs -tools / hooks / biosdevname is deleted, but there is no postrm script in the package, so update-initramfs is not executed, and biosdevname is still present in the / boot / initrd directory ... the file used on The first step in starting the system.

You can completely get rid of it as follows:

 $ sudo update-initramfs -u 
+8
source

Source: https://habr.com/ru/post/978640/


All Articles