Udev/upgrade

From Gentoo Wiki
Jump to: navigation, search
Warning
Be careful when upgrading udev, you will need to consider the changes listed below; ignoring them can break your system!

udev 171 to 204

The following special attention is required:

  • CONFIG_DEVTMPFS=y must be set in the kernel, for which you need at least Linux kernel 2.6.32.
  • If there is a /dev line in /etc/fstab, it must have the devtmpfs filesystem type or it will conflict with the above options.
  • Remove udev-postmount from any runlevels, it is not necessary. Exception: Note that sys-fs/eudev still has the udev-postmount init script in use with USE="rule-generator"

otherwise delete it together with /etc/udev/rules.d/70-persistent-cd.rules as both are from the now deleted rule_generator that doesn't exist anymore.

  • The new Predictable Network Interface Names will be used by default, unless the kernel commandline contains net.ifnames=0. (If you had earlier used the method of masking out /etc/udev/rules.d/80-net-name-slot.rules, it will not work in v209 and newer releases.)
  • If you use Linux 3.8 or higher you should be able to disable USE="firmware-loader" and let kernel do the loading instead. However, you can still use USE="firmware-loader" on newer kernels too.
  • Any file you haven't created or edited yourself in /etc/udev/rules.d should be backupped and removed as it's likely an relic from old udev installation.

For more details, read the full news article /usr/portage/metadata/news/2013-03-29-udev-upgrade/2013-03-29-udev-upgrade.en.txt and the post install output of emerging udev.

udev 204 to 208

The following special attention is required:

  • Since this version, kernel with accept4() function support is mandatory. It's supported for amd64, ia64, mips, sparc and x86 in 2.6.32.61. All others, like ARM, will need a newer kernel like 3.0 for the function.
  • It's no longer the job of the /dev manager, like udev, to create /dev nodes for static kernel modules such as /dev/fuse or /dev/snd/seq. Instead they are now created by the kmod-static-nodes init script which is part of sys-apps/kmod since version 15. Make sure you add the init script to the "sysinit" runlevel.

udev 208 to 212

The following special attention is required:

  • Since this version, kernel settings CONFIG_FHANDLE=y and CONFIG_NET=y are mandatory. Kernel setting CONFIG_DMIID=y is recommended for amd64/ia64/x86, for example, keyboard rules.
  • File /lib/udev/rules.d/80-net-name-slot.rules was replaced with /lib/udev/rules.d/80-net-setup-link.rules. If you are currently using an empty (or single-comment) /etc/udev/rules.d/80-net-name-slot.rules to disable predictable network interface names, you should now use 80-net-setup-link.rules. eg:
cd /etc/udev/rules.d/ && ln 80-net-name-slot.rules 80-net-setup-link.rules

..to keep the override both pre- and post-upgrade; you can then:

rm /etc/udev/rules.d/80-net-name-slot.rules

..once you have upgraded. The hardlink can be made now, in order to protect against not noticing the upgrade in a busy or non-professional situation.

  • However, 80-net-setup-link.rules is only a trigger for the actual configuration file 99-default.link at /lib/systemd/network/ which you can override at /etc/systemd/network/
  • The most reliable way of disabling the new network interface scheme is still the kernel bootline parameter: net.ifnames=0

Example interface IDs

The default naming precedence rules are these:

  1. Names incorporating Firmware/BIOS provided index numbers for on-board devices (ID_NET_NAME_ONBOARD, example: eno1)
  2. Names incorporating Firmware/BIOS provided PCI Express hotplug slot index numbers (ID_NET_NAME_SLOT, example: ens1)
  3. Names incorporating physical/geographical location of the connector of the hardware (ID_NET_NAME_PATH, example: enp2s0)
  4. Names incorporating the interfaces's MAC address (ID_NET_NAME_MAC, example: enx78e7d1ea46da)
  5. Classic, unpredictable kernel-native ethX naming (example: eth0)

(Rule 4 is disabled by default.) So, if your output is like this:

user $ udevadm test-builtin net_id /sys/class/net/eth0 2> /dev/null
ID_NET_NAME_MAC=enxd4a8xxxxxxxx
ID_NET_NAME_ONBOARD=eno1
ID_NET_NAME_PATH=enp1s0f1

The interface will be named eno1, because ID_NET_NAME_ONBOARD takes precedence over ID_NET_NAME_PATH.

Things to think of

  • /etc/conf.d/net
  • Renaming init scripts
  • Replacing init scripts in runlevels (via rc-update)
  • iptables configuration
  • vnstat configuration
  • samba configuration

A quick way to get a list of files that will need to be updated can be found using the following:

user $ grep -r 'eth0' /etc/* | grep -v '#'

Fixing network interfaces

This shows how you can fix your network-interfaces, if they don't work anymore (or before they stop working, if you didn't switch to the new udev yet). It is only applicable to simple setups, like one ethernet and one wifi interface. If you have a more complicated setup (like more ethernet adapters) I assume you already know what to do.

Renaming init scripts

If you are still running the old udev and are up to enabling the new one, execute

user $ udevadm test-builtin net_id /sys/class/net/eth0 2> /dev/null
ID_NET_NAME_MAC=enxd4a8xxxxxxxx
ID_NET_NAME_PATH=enp1s0f1

Take the ID_NET_NAME_PATH-item (here enp1s0f1) and execute

user $ ln -s net.lo /etc/init.d/net.enp1s0f1

If you have a wifi-interface do this for this interface,too!

If you are already running the new udev and the network is down, execute

user $ ls -la /sys/class/net
total 0
drwxr-xr-x  2 root root 0 Apr  2 19:42 ./
drwxr-xr-x 49 root root 0 Apr  2 19:42 ../
lrwxrwxrwx  1 root root 0 Apr  2 19:42 enp1s0f1 -> ../../devices/pci0000:00/0000:00:1c.1/0000:02:00.0/net/enp1s0f1/
lrwxrwxrwx  1 root root 0 Apr  2 19:42 lo -> ../../devices/virtual/net/lo/
lrwxrwxrwx  1 root root 0 Apr  2 19:42 sit0 -> ../../devices/virtual/net/sit0/

Look which link points to a pci-device (here enp1s0f1) and execute

user $ ln -s net.lo /etc/init.d/net.enp1s0f1

If you have a wifi-interface do this for this interface,too!

Replacing init scripts in runlevels (via rc-update)

user $ rc-update delete net.eth0 default
user $ rc-update add net.enp1s0f1 default

Same for the wifi-interface again, if necessary.