Contents
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:
- Programs, libraries and data under /usr are not available in the early stages of booting
- Programs in /bin and /sbin can not assume /usr is available
- init scripts need to cope with /usr being unavailable in early boot
- This causes particular problems with shared libraries, PAM modules, NSS module dependencies, etc. as well as locale availability.
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
- Remount r/o
- Check
- Remount r/w
- Remount r/o at shutdown and don't umount
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
- Update initramfs to mount /usr
Update util-linux to skip /usr with the -R option (697002)
- 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
- so they are properly tagged.
Patches
initramfs-tools
initscripts (sysvinit)
TODO
