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

Re: /run vs. /lib/run



In article <[🔎] 20051220120943.GA21166@localhost.localdomain>,
Anthony Towns  <aj@azure.humbug.org.au> wrote:
>/var/run has always been the right place in the namespace; it's just
>not been usable for technical reasons. If we fix the technical reasons,
>all is good.

Well there is on more technical solution that might have been overlooked.
Why not create /var/run on the root file system even if /var is
mounted over it later on.

You can do something like:

- at bootup: mount -t tmpfs tmpfs /var/run

- S01, S02, S10 ..

- then:

  cd /var/run
  ( cd /; mount -a )
  if ! [ . -ef /var/run ]
  then
	mount --move . /var/run
  fi
  cd /

This works at least on 2.6. It keeps the shell process' working
directory in /var/run. Even if mount -a mounts something over it,
the shell process' working directory is still the tmpfs. Then you
just move the mount to the real /var/run .

This means that /var/run is always writable.

Postinst can create a /var/run "under" /var in a number of ways-
for example by mounting the root file system a second time somewhere,
or by calling a process that uses clone(CLONE_NEWNS), umounts /var
and mkdirs /var/run.

Mike.



Reply to: