[arch-projects] [initscripts][filesystem][RFC] making initscripts in charge of /dev/{pts, shm}

Tom Gundersen teg at jklm.no
Fri Apr 22 08:56:34 EDT 2011


Hi guys,

I have been wanting to add support for bootlogd to initscripts, so we
can capture error messages during boot. This requires /dev/pts to be
mounted very early in boot, similarly to /dev, /proc, /sys and /run. I
figured we might as well treat /dev/{pts,shm} exactly the same as
these other directories to make our lives easier.

This would essentially mean that we can now ship with an empty fstab
and since we are now in charge of these mounts rather than the user,
other packages can rely on both their existence and that they have
sensible mount options.

Comments?

Cheers,

Tom


>From c0a3cb16031cfed9714704e82a06c68d2f9c2a3d Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg at jklm.no>
Date: Tue, 29 Mar 2011 15:14:33 +0200
Subject: [PATCH] /dev: mount /dev/pts and /dev/shm during early boot

This has two purposes:

1) it allows boot services like bootlogd (that needs /dev/pts) to be
started very early in boot, and
2) by setting the standard options in rc.sysinit rather than in fstab we
have control over them and can easily integrate them with other packages
and make adjustments to fix bugs. This brings /dev/{pts,shm} into line
with how handle /dev, /proc, /sys and /run.

I could not think of any usecases where someone might want to override
the default settings, but if there is a need we could add support for
this too (I think we should avoid this as much as possible, but if there
are valid reasons I will not object).

With this patch /dev/{pts,shm} can (and probably should) be removed from
the default fstab file, and fstab should only contain entries for the
mountpoints the user has specified during install, like /boot, /home and
/var. It will now be possible to boot a working system with an empty fstab.

Cc: Pierre Schmitz <pierre at archlinux.org>
Signed-off-by: Tom Gundersen <teg at jklm.no>
---
 rc.sysinit |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/rc.sysinit b/rc.sysinit
index 21b4eb1..d45156e 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -16,7 +16,7 @@ run_hook sysinit_start
 # export standard PATH (will be overridden later when /etc/profile is
sourced, but is usefull for UDev)
 export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

-# mount /dev, /proc, /sys, /run (the api filesystems)
+# mount /dev, /proc, /sys, /run, /dev/pts and /dev/shm (the api filesystems)
 if ! /bin/mountpoint -q /dev; then
 	if grep -q devtmpfs /proc/filesystems 2>/dev/null; then
 		/bin/mount -n -t devtmpfs udev /dev -o mode=0755,size=10M,nosuid
@@ -30,6 +30,8 @@ fi
 /bin/mountpoint -q /proc    || /bin/mount -n -t proc proc /proc -o
nosuid,noexec,nodev
 /bin/mountpoint -q /sys     || /bin/mount -n -t sysfs sysfs /sys -o
nosuid,noexec,nodev
 /bin/mountpoint -q /run     || /bin/mount -n -t tmpfs tmpfs /run -o
mode=755,size=10M,nosuid,noexec,nodev
+/bin/mountpoint -q /dev/pts || /bin/mount -n -t devpts devpts
/dev/pts -o mode=620,gid=5,nosuid,noexec
+/bin/mountpoint -q /dev/shm || /bin/mount -n -t tmpfs tmpfs
/dev/tmpfs -o mode=1777,nosuid,nodev

 # start up our mini logger until syslog takes over
 /sbin/minilogd
-- 
1.7.4.4


More information about the arch-projects mailing list