[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /run vs. /lib/run

On Mon, Dec 19, 2005 at 08:45:45PM -0800, Russ Allbery wrote:
> > (TBH, I'd be much happier just making the technical changes necessary to
> > ensure /var is mounted early -- keeps the filesystem sane, and it's just
> > a simple matter of programming, rather than arguing over what's ugly.
> Yeah, I agree with this too.

So why don't we go with this? Thomas?

Here are the cases:

    (a) /var on /, mounted rw during normal operation
    (b) /var a local fs, separate to /
    (c) / and /var separate NFS mounts
    (d) / local, /var an NFS mount
    (e) /var local, can't be mounted 'til a writable fs is available

For (a) you just need to wait until S10checkroot.sh has finished.
For (b) you need to wait until S35mountall.sh has finished.

For (d) and (e) you need special handling; using /run as a tmpfs and
setting up /var/run -> /run symlinks on both / and /var. That's pretty
special handling, and probably needs something like shared subtrees to
be done automatically at upgrade time (http://lwn.net/Articles/159077/).

For (c) you could either do the same handling as (d) and (e), or just expect
the admin to mount it rw as part of bootup.

As far as the "but programmers/admins might be confused" concern goes;
adding a brief /run/README at bootup seems feasible.

That'd mean:

	/var is available after:
		S10checkroot.sh (/var on rootfs)
		S35mountall.sh (/var local)
		S40hotplug (/var local, but requires hotplug drivers)
		S45mountnfs.sh (/var on NFS not mounted before init)

	/var/run is thus available after one of:

And /var/run is used before /var is necessarily available by (on my system):


Hrm. Special casing in mountvirtfs and mountnfs.sh could be:

		if touch /var/run/.rw_var_run >/dev/null 2>&1; then
			rm -f /var/run/.rw_var_run
		elif [ "$EARLY_RUN_FS" ] && [ -d "$EARLY_RUN_FS" ]; then
			echo "Mounting /var/run tmpfs on $EARLY_RUN_FS..."
			mount -t tmpfs tmpfs "$EARLY_RUN_FS"
			ln -s . "$EARLY_RUN_FS/run"
			mount --bind "$EARLY_RUN_FS" /var
			touch /var/.bind_var
			echo "Error: no early writable filesystem available"
			# ...

		if [ -e /var/.bind_var ]; then
			rm -f /var/.bind_var /var/run
			umount /var
		# ... mount -a

at which point you only need to mkdir $EARLY_FUN_FS and ensure /var/run is
a symlink to it when setting up that behaviour on upgrade. Alternatively
you could just make the directory and "mount --bind $EARLY_RUN_FS
/var/run" after mounting /var. (If $EARLY_RUN_FS is /run, you'd have to
work out in advance when it's needed so as not to add useless stuff to / when
it's not needed; adding a pointless dir to /etc or /lib would likely be okay

Note that in that scenario programs are FHS compliant in that they only
access files throug the /var/run namespace, and if an admin prefers
/etc/run or /lib/run, it's just a matter of local configuration rather
than recompiling apps.


Attachment: signature.asc
Description: Digital signature

Reply to: