Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 363971 - sys-apps/openrc: Mount tmpfs on /run if directory exists and not already mounted
Summary: sys-apps/openrc: Mount tmpfs on /run if directory exists and not already mounted
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: OpenRC Team
URL: https://lwn.net/Articles/436012/
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2011-04-17 21:13 UTC by Amadeusz Żołnowski (RETIRED)
Modified: 2011-04-19 08:36 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
0001-Mount-tmpfs-on-run-if-directory-exists-and-not-alrea.patch (0001-Mount-tmpfs-on-run-if-directory-exists-and-not-alrea.patch,1.37 KB, patch)
2011-04-17 21:15 UTC, Amadeusz Żołnowski (RETIRED)
Details | Diff
openrc-0.8.2-dont-umount-rundir-on-shutdown.patch (openrc-0.8.2-dont-umount-rundir-on-shutdown.patch,303 bytes, patch)
2011-04-18 02:15 UTC, Lars Wendler (Polynomial-C) (RETIRED)
Details | Diff
0001-Mount-tmpfs-on-run-if-directory-exists-and-not-alrea.patch (0001-Mount-tmpfs-on-run-if-directory-exists-and-not-alrea.patch,1.37 KB, patch)
2011-04-18 07:20 UTC, Amadeusz Żołnowski (RETIRED)
Details | Diff
Mount-tmpfs-on-run-and-create-run-lock.patch (0001-Mount-tmpfs-on-run-and-create-run-lock.patch,1.79 KB, patch)
2011-04-18 15:47 UTC, Amadeusz Żołnowski (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Amadeusz Żołnowski (RETIRED) gentoo-dev 2011-04-17 21:13:55 UTC
/run needs handling by OpenRC.  We need to mount tmpfs on /run when directory exists.  /run is used among others by udev and dracut, but they fall back to /dev/.{udev,initramfs} if /run doesn't exists.  Note that /run may be already mounted by dracut.

Read more about /run on LWN.net: https://lwn.net/Articles/436012/

It's related to bug #361349.

Reproducible: Always
Comment 1 Amadeusz Żołnowski (RETIRED) gentoo-dev 2011-04-17 21:15:15 UTC
Created attachment 270321 [details, diff]
0001-Mount-tmpfs-on-run-if-directory-exists-and-not-alrea.patch
Comment 2 William Hubbs gentoo-dev 2011-04-18 00:38:34 UTC
I looked further at this patch, and I'm concerned about the use of mountpoint.

Mountpoint is part of the sysvinit package, so this patch will force a dependency on sysvinit. I would prefer to find another way to do this so we do not require this dependency.
Comment 3 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2011-04-18 02:15:18 UTC
Created attachment 270327 [details, diff]
openrc-0.8.2-dont-umount-rundir-on-shutdown.patch

openrc also needs this patch or else udev init script fails to stop udev properly on shutdown.

For the "mountpoint" command issue I suggest to simply replace the command with "mountinfo" (you can even keep the -q option).
Comment 4 Amadeusz Żołnowski (RETIRED) gentoo-dev 2011-04-18 07:20:13 UTC
Created attachment 270341 [details, diff]
0001-Mount-tmpfs-on-run-if-directory-exists-and-not-alrea.patch

Polynomial-C, thanks!

This one uses mountinfo instead of mountpoint. I have tested all three cases:

  - /run doesn't exist;
  - /run exists but is not a mount point;
  - /run exists and is a mount point (/run mounted by dracut in initramfs-time);

and it's OK.
Comment 5 Amadeusz Żołnowski (RETIRED) gentoo-dev 2011-04-18 15:47:09 UTC
Created attachment 270397 [details, diff]
Mount-tmpfs-on-run-and-create-run-lock.patch

Added creation of /run/lock with privileges compliant with /var/run.
Comment 6 William Hubbs gentoo-dev 2011-04-18 22:49:27 UTC
Commits ede4d1c and 64ef51a apply the patches from this bug with a
slight modification.

I added a chmod command to change the mode for /run/lock to match
/var/lock; e.g. 775.

This will be part of openrc-0.8.3.
Comment 7 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2011-04-18 23:22:32 UTC
Why does this bug block the stablereq tracker? As /run is a relatively new concept, are udev/dracut versions even marked stable yet that would use it?
Comment 8 William Hubbs gentoo-dev 2011-04-19 00:17:57 UTC
You are right, it doesn't need to block the tracker.

I tested the code myself before I put it into git, and it is
fully backward compatible (if /run doesn't exist, nothing is done), so
that is why I went ahead and committed it.
Comment 9 Amadeusz Żołnowski (RETIRED) gentoo-dev 2011-04-19 08:36:22 UTC
(In reply to comment #6)
> Commits ede4d1c and 64ef51a apply the patches from this bug with a
> slight modification.
> 
> I added a chmod command to change the mode for /run/lock to match
> /var/lock; e.g. 775.
> 
> This will be part of openrc-0.8.3.

I did chown and chmod independently of creation of /run/lock intentionally.  Please consider the case when /run/lock is created in initramfs-time with different owner/privileges. Shouldn't happen, but my approach assures that it will be OK.