I saw udev-197-r3 when it just got marked as stable (19 Jan 2013) a couple days ago, but I held up the urgency of updating a system package, because I felt it might be tricky or even disastrous. For package like sys-fs/udev you have to be extra careful, it’s way beyond my weekly update process, or you may need to dig up a rescue CD.

Especially when you see the version number jump as high as an Olympic High Jump gold medal winner, 171 to 197, that really put me at super high alert, much above bloodily red SEVERE level.

But it turned out t’s not so scary at all.

I want to point out few things before I show you what I did.

  • DEVTMPFS in kernel (CONFIG_DEVTMPFS) is now required. You can’t skip this part.
  • initramfs will still not be required when current udev is working without it, even you have a separate /usr. As long as current udev is working, udev-197 will have no problem with no initramfs.
  • sys-apps/module-init-tools is replaced with sys-apps/kmod.

1   Enabling DEVTMPFS

First thing first, re-compile your kernel with DEVTMPFS support. So once new udev is emerged, you can restart to see if it works right away.

To check if you have it, run:

$ grep CONFIG_DEVTMPFS /usr/src/linux/.config
CONFIG_DEVTMPFS=y

If you don’t have that line, then re-compile your kernel, you can find the option under Device Drivers > Generic Driver Options.

Symbol: DEVTMPFS [=n]
Type  : boolean
Prompt: Maintain a devtmpfs filesystem to mount at /dev
  Defined at drivers/base/Kconfig:24
  Depends on: HOTPLUG [=y]
  Location:
    -> Device Drivers
      -> Generic Driver Options

Note that normally you do not need the automatic mount of devtmpfs DEVTMPFS_MOUNT: Automount devtmpfs at /dev, after the kernel mounted the rootfs, udev-mount service will take care of that. There may be a reason why Gentoo wiki suggests that, since I don’t have it before and the service mounts it, my system is fine without it.

Once it’s done, reboot with new kernel and continue the process.

2   emerge -pvuDt system

Calculating dependencies... done!
[nomerge       ]  sys-fs/udev-197-r3 [171-r9] USE="acl%* hwdb keymap* kmod%* openrc%* -doc% -gudev -introspection (-selinux) -static-libs% (-action_modeswitch%) (-build%) (-debug%) (-edd%) (-extras%) (-floppy%) (-rule_generator%*) (-test%)"
[ebuild  N     ]   sys-fs/udev-init-scripts-19-r1  5 kB
[ebuild     U  ]    virtual/udev-197 [171] USE="hwdb keymap* -gudev -introspection (-selinux) -static-libs (-acl%*)" 0 kB
[ebuild     U  ]     sys-fs/udev-197-r3 [171-r9] USE="acl%* hwdb keymap* kmod%* openrc%* -doc% -gudev -introspection (-selinux) -static-libs% (-action_modeswitch%) (-build%) (-debug%) (-edd%) (-extras%) (-floppy%) (-rule_generator%*) (-test%)" 2,008 kB
[ebuild  N     ]      sys-apps/kmod-12-r1  USE="lzma tools zlib -debug -doc -static-libs" 1,246 kB
[ebuild     U  ]      sys-apps/hwids-20130114 [20121119] USE="udev%*" 1,437 kB
[blocks B      ] <sys-fs/udev-186 ("<sys-fs/udev-186" is blocking sys-fs/udev-init-scripts-19-r1)
[blocks B      ] sys-apps/module-init-tools ("sys-apps/module-init-tools" is blocking sys-apps/kmod-12-r1)
[blocks B      ] sys-apps/kmod ("sys-apps/kmod" is blocking sys-apps/module-init-tools-3.16-r2)

Total: 5 packages (3 upgrades, 2 new), Size of downloads: 4,694 kB
Conflict: 2 blocks (2 unsatisfied)

 * Error: The above package list contains packages which cannot be
 * installed at the same time on the same system.

  (sys-apps/kmod-12-r1::gentoo, ebuild scheduled for merge) pulled in by
    >=sys-apps/kmod-12 required by (sys-fs/udev-197-r3::gentoo, ebuild scheduled for merge)

  (sys-apps/module-init-tools-3.16-r2::gentoo, installed) pulled in by
    >=sys-apps/module-init-tools-3.2 required by (virtual/modutils-0::gentoo, installed)

2.1   Resolving sys-apps/module-init-tools blocking

Now the module-init-tools is replaced with kmod, so simply un-emerge it:

$ sudo emerge -C sys-apps/module-init-tools

You will be prompted that it’s dangerous since this package is part of system set, but you know the drill here. Just do it. The new tools will be provided when kmod is emerged, it will be fine.

Note for sys-fs/lvm2.

2.2   Cleaning up USE flags

(-action_modeswitch%) (-build%) (-debug%) (-edd%) (-extras%) (-floppy%) (-rule_generator%*) (-test%)

As you can see there are lots of USE flags have been remove in this update, so if you have additional USE flags for sys-fs/udev, then it’s time to clean up and make sure the flags match with virtual/udev if you have manually set them in package.use.

3   sudo emerge -quD system

I didn’t run into any trouble, emerge printed out the following messages:

* Messages for package sys-fs/udev-197-r3:

*   DEVTMPFS is not set in this kernel. Udev will not run.
* Please check to make sure these options are set correctly.
* Failure to do so may cause unexpected problems.
*
* Upstream has removed the persistent-cd rules
* generator. If you need persistent names for these devices,
* place udev rules for them in /etc/udev/rules.d.
*
* udev-197 and newer introduces a new method of naming network
* interfaces. The new names are a very significant change, so
* they are disabled by default on live systems.
* Please see the contents of /etc/udev/rules.d/80-net-name-slot.rules for more
* information on this feature.
*
* You need to restart udev as soon as possible to make the upgrade go
* into effect.
* The method you use to do this depends on your init system.
*
* Old versions of installed libraries were detected on your system.
* In order to avoid breaking packages that depend on these old libs,
* the libraries are not being removed.  You need to run revdep-rebuild
* in order to remove these old dependencies.  If you do not have this
* helper program, simply emerge the 'gentoolkit' package.
*
*   # revdep-rebuild --library '/lib64/libudev.so.0' && rm '/lib64/libudev.so.0'
*
* For more information on udev on Gentoo, writing udev rules, and
*          fixing known issues visit:
*          http://www.gentoo.org/doc/en/udev-guide.xml

* Messages for package sys-fs/udev-init-scripts-19-r1:

* The udev-postmount service has been removed because the reasons for
* its existance have been removed upstream.
* Please remove it from your runlevels.

3.1   DEVTMPFS

As you can see at the first line, I didn’t have DEVTMPFS enabled at the time of emerge, so I could only pray everything would go well after reboot since I couldn’t just restart udev to test.

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

This part you can safely skip since this feature is not enabled by default. The content of this file is shown as follows:

#
# Udev 197 and above has implemented predictable network interface names
# for hardware network interfaces. This new scheme does not affect
# stacked network interfaces such as bonds, bridges or vlans.
#
# This file is here to prevent your interfaces from being renamed automatically,
# because the new names will be drastically different from the eth*, wlan*, etc
# names you are used to working with.
#
# To activate this function, move this file to a name that doesn't end in.rules,
# or remove it then reboot your system.
#
# If you want to deactivate this function, install a udev rules file as
# /etc/udev/rules.d/80-net-name-slot.rules then reboot your system.
#
# This functionality has not been tested with gentoo. In fact, we are aware that
# things will break if you activate it.
#
# If you are not comfortable testing this, leave this file as is. We will
# publish a news item when you can migrate.
#
# If you do want to activate and help us come up with a migration plan, feel
# free to do so and report bugs.
# Your bugs should block the following tracker:
# https://bugs.gentoo.org/show_bug.cgi?id=450938
#
# Before you activate this function, it is important that you fully understand
# the following documentation:
#
# http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames
#
# Also, be aware that you can get the attributes of your network interface that
# would be used to name the interface in the new scheme by doing the following
# with this version of udev running:
#
# udevadm test-builtin net_id /sys/class/net/ifname 2> /dev/null
#
# for example, on my system, I can find that eth0's new name would be enp1s5.
#

If you want to try this, then rename remove .rules from this filename. I am not adventurous and the warning is quote clear:

# This functionality has not been tested with gentoo. In fact, we are aware that
# things will break if you activate it.

Although we can skip this part, but you now should know storm may be coming in the future. Or just some difficulties and configuration updating works ahead for us.

3.3   revdep-rebuild --library '/lib64/libudev.so.0' && rm '/lib64/libudev.so.0'

It also detected I had few packages build against /lib64/libudev.so.0, so re-emerge was needed. After that, the shared object was no longer needed.

I also ran additional revdep-rebuild to make sure everything is re-emerged as needed.

3.4   sudo rc-update del udev-postmount

Although rc-update show doesn’t show udev-postmount service, I still could run the command for removal successfully.

4   Thoughts

To be honesty, I felt it’s quite a rush stabilizing for documentation part. The udev guide clearly has not got updated, last updated was on December 25, 2012, DEVTMPFS is a point for that statement even the emerge process does check kernel configuration. Someone filed a bug about the guide for the guide.

Some people may follow the wiki page, they will have no problem on that since DEVTMPFS is suggested in kernel configuration. However, the list of USE flags are still incomplete for udev-197, kmod is one of them.

Anyway, there really isn’t any big issues, at least not for me. As long as you follow the emerge message you should be fine, just remember don’t update such package when they just become stable unless you know you can resolve problem on an un-bootable system after problematic updates. Keep in mind, when in doubt, Google it, check bug reports, read forums; still in doubt, wait for a while. Don’t rush to get your system up-to-date.

Lastly, you may want to read this post by a Gentoo developer Samuli Suominen (ssuominen) about his thoughts of and the direction of udev may be heading as well as some other packages.

Time to remove old kernels, they don’t have DEVTMPFS useless with new udev.