Differences between revisions 6 and 7
Revision 6 as of 2014-08-05 08:45:48
Size: 3479
Editor: XTaran
Comment: This will break quite a number of existing Debian installations.
Revision 7 as of 2014-10-09 15:57:39
Size: 4034
Editor: BenHutchings
Comment: Update to describe actual implementation and remaining problems for initscripts
Deletions are marked like this. Additions are marked like this.
Line 19: Line 19:
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. In the initramfs, we check the root filesystem before mounting it. Once it is mounted, the /etc/fstab on the root filesystem can be read, and if it contains an entry for /usr, we check and mount it.
Line 21: Line 21:
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. As fsck will sanity-check timestamps, we also include everything in the initramfs needed to set the system time correctly if the the RTC holds local time.
Line 23: Line 23:
The initscripts themselves need updating to treat /usr like the root filesystem The -R option of /sbin/fsck, used to check all filesystems except the root filesystem, could be updated so that it will also ignore /usr, or else at boot the checkfs script will try to fsck a mounted /usr. Alternatively the initscripts can use the -M option.

It was proposed that the initscripts should be updated to treat /usr like the root filesystem:
Line 28: Line 30:
 * Remount r/o at shutdown and don't umount  * Remount r/o at shutdown and don't umount

But this doesn't work because e2fsck and probably other fsck implementations don't allow checking a filesystem mounted anywhere other than /.
Line 42: Line 46:
 1. Update initramfs to mount /usr
 1. Update util-linux to skip /usr with the -R option (DebianBug:697002)
 1. Update initscripts to fsck /usr in checkroot and remount r/o when shutting down
 1. Update initramfs to fsck and mount /usr (./)
 1. Update initscripts to use the fsck -M option (DebianBug:697002)
 1. Update initscripts to remount r/o when shutting down
Line 63: Line 67:
Similar changes have been made in initramfs 0.117 and various regressions were fixed in 0.118. This now works with systemd, but mounting of /usr is disabled when using any other init.

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

In the initramfs, we check the root filesystem before mounting it. Once it is mounted, the /etc/fstab on the root filesystem can be read, and if it contains an entry for /usr, we check and mount it.

As fsck will sanity-check timestamps, we also include everything in the initramfs needed to set the system time correctly if the the RTC holds local time.

The -R option of /sbin/fsck, used to check all filesystems except the root filesystem, could be updated so that it will also ignore /usr, or else at boot the checkfs script will try to fsck a mounted /usr. Alternatively the initscripts can use the -M option.

It was proposed that the initscripts should be updated to treat /usr like the root filesystem:

  • Remount r/o
  • Check
  • Remount r/w
  • Remount r/o at shutdown and don't umount

But this doesn't work because e2fsck and probably other fsck implementations don't allow checking a filesystem mounted anywhere other than /.

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. This will break quite a number of existing Debian installations.

Required changes

  1. Update initramfs to fsck and mount /usr (./)

  2. Update initscripts to use the fsck -M option (697002)

  3. Update initscripts to remount r/o when shutting down

Bug reports

When filing bugs, please use

User: rleigh@debian.org
Usertags: usrinitramfs
  • so they are properly tagged.

User tagged bugs

Patches

initramfs-tools

Work in progress (git)

Similar changes have been made in initramfs 0.117 and various regressions were fixed in 0.118. This now works with systemd, but mounting of /usr is disabled when using any other init.

initscripts (sysvinit)

TODO