Mount /usr in the initramfs

Introduction

Traditionally, /usr has been mounted in mountall, as for any filesystem in /etc/fstab other than the root filesystem (or special filesystems like /proc and /dev). This has several implications:

If /usr could be guaranteed to be available by mounting it in the initramfs, these problems can also be overcome. This permits all shared libraries, PAM modules, NSS modules etc. to function at once. It also allows locales to be used at once as well. Additionally, it is possible to use C++ (libstdc++ is under /usr), and interpreters such as perl and python, etc. In short, it makes a large number of things possible which were previously not possible, and this will both allow greater flexibility in what can run in the early stages of booting, as well as removing a large number of special cases and hairy logic which existed solely to cope with /usr not being available.

Initial implementation

The change to the initramfs is fairly simple. Once the root filesystem is mounted, the /etc/fstab on the root filesystem can be read, and then if it contains an entry for /usr, we mount it.

The -R option of /sbin/fsck, used to check all filesystems except the root filesystem needs updating so that it will also ignore /usr, or else at boot the checkfs script will try to fsck a mounted /usr.

The initscripts themselves need updating to treat /usr like the root filesystem

Caveats

The main caveat is that if you use a separately mounted /usr, you must use an initramfs to mount it. While not using an initramfs will continue to be supported, this will only work if you have /usr on the root filesystem (i.e. it's a single mount). This is because mounting /usr in the traditional way will cause startup to fail since it's mounted too late (this will only happen once init scripts start relying on /usr to be available immediately).

initramfs

No initramfs

root only

Supported

Supported

root and /usr

Supported

Broken

The initramfs will support / and /usr mounts on local/local and nfs/nfs. However, it it not yet clear if this will extend to local/nfs and/or nfs/local.

Required changes

  1. Update initramfs to mount /usr
  2. Update util-linux to skip /usr with the -R option (697002)

  3. Update initscripts to fsck /usr in checkroot and remount r/o when shutting down

Bug reports

When filing bugs, please use

User: rleigh@debian.org
Usertags: usrinitramfs

User tagged bugs

Patches

initramfs-tools

Work in progress (git)

initscripts (sysvinit)

TODO