Software Management/Upgrade/Devs Rpm

From openSUSE


Contents

Removing devs.rpm

This is about getting rid of devs.rpm when upgrading an older distribution. Read on.

Motivation

With the introduction of udev, device nodes (filesystem entries below /dev) are dynamically created. The /dev directory is now residing in a temporary filesystem (tmpfs) created at bootup and contains only nodes for actually existing devices.

Before udev, the devs.rpm package contained all kinds of device nodes as a static list. This list was never complete and adding a device (just think of USB sticks) required explicit creation of a matching device node.

It ain't easy

Newer distribution do not need the devs.rpm package at all. So it should just be deleted, no ?

Lets look at how a distribution upgrade is performed to see why it ain't easy.

(short explanation, just covering the relevant facts)

  1. A minimal system (the instsys, containing YaST and some tools) is loaded into RAM
  2. YaST is started and finds the right filesystem partitions for the old distribution
  3. The partitions are mounted below /mnt
  4. YaST runs rpm --root=/mnt ... to perform the upgrade
  5. After all packages are upgraded a chroot /mnt is performed so all further commands are executed in the updated(!) distribution
  6. The system is rebooted and the upgraded distribution starts

Steps 4 and 5 above need a closer look.

When doing package upgrades, unneeded packages are removed first then the new packages are installed.

As the devs.rpm is no longer needed, it will be removed

When the grub.rpm package is upgraded, it re-writes the bootloader. This is normal upgrade behaviour since you want the newest bootloader when upgrading the grub package.

Some bootloaders (e.g. grub) may even stop working if the first stage of the bootloader is not re-written, because after the upgrade with rpm the new stage2 in the file system may be incompatible with the old stage1 in the first block of the boot drive.

Bootloaders cannot guarantee compatibility between these stages across versions. The main reasons are that there is only a miniscule amount of space available for stage1, while features change, hardware support needs to be added or can be removed etc.

grub needs access to devices to write the bootloader. However all /dev entries are removed together with the devs.rpm package

After 'chroot'ing to the upgraded system in step 5, no devices are accessible.

All in all just removing devs.rpm doesn't work

Solution

When doing a fresh install, all devices from the instsys are made available in the installed system via a bind mount.

The same solution should be applicable for the distribution upgrade. However, it can't be done for step 4 above since removal of devs.rpm would remove device nodes.

The bind mount for /dev/ must be done immediately before executing the chroot call. This will ensure all devices from the instsys are available in the freshly upgraded system. Here grub must be run again to install the newest bootloader. This approach is also taken during installation, so the needed code is already existing.

Remaining issues

  • The described solution needs tool (== YaST) support. A distribution upgrade with other tools (e.g. plain rpm) needs special precautions (manual bind mount of /dev)
  • Running grub in its %post section will fail since no device nodes are available during package upgrade. The YAST_IS_RUNNING environment variable should be evaluated in order to prevent running grub in its %post section.

External links

Bug 144773

Feature #301903: Dropping devs.rpm (no public access)