On Sat, Apr 23, 2011 at 10:07:28AM +1000, Kel Modderman wrote: > On Sat, 23 Apr 2011 04:27:00 AM Roger Leigh wrote: > > Hi Kel and other sysvinit developers, > > > > I've attached a further update for your consideration, which fixes a > > few issues. If it's OK with you, this could be uploaded to > > experimental (with your changes folded into the same version in the > > changelog) as 2.88dsf-13.5. Unless you'd prefer to do a maintainer > > upload. > > > > The logic used for mounting filesystems is duplicated entirely between > > the various scripts doing mounting, and the mtab script used to > > generate the initial mtab. This includes the domtab() function, which > > is almost entirely identical to domount() with the use of -f with mount. > > This patch removes the duplication, and uses the same codepaths for > > both mounting and mtab generation, which will make the scripts much > > more robust when making any changes. > > Great improvement.
[...] > In my opnion: do not hesitate to upload this to experimental and continue the > improvement of the transition to /run. I've uploaded sysvinit_2.88dsf-13.5 to experimental. The patch against SVN is attached. This only differs from the previous patch by one character (s/50%/20%/ for a size limit check). Regards, Roger -- .''`. Roger Leigh : :' : Debian GNU/Linux http://people.debian.org/~rleigh/ `. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/ `- GPG Public Key: 0x25BFB848 Please GPG sign your mail.
diff --git a/debian/changelog b/debian/changelog
index bd28bab..45bcd8e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,60 @@
-sysvinit (2.88dsf-14) UNRELEASED; urgency=low
+sysvinit (2.88dsf-13.5) experimental; urgency=low
+ [ Roger Leigh ]
+ * Non-maintainer upload.
+ * Unify mount logic shared between mountkernfs.sh, mountdevsubfs.sh
+ and mtab.sh
+ - all functions use domount() from /lib/init/mount-functions. This
+ merges in the functionality of domtab() in mtab.sh, which was
+ almost entirely identical. domount is now capable of mounting and
+ remounting (with and without mtab updates) as well as updating
+ /etc/mtab.
+ - mtab.sh calls mountkernfs.sh and mountdevsubfs with an "mtab"
+ argument to do the mtab generation for early mounts. This means
+ that the mount logic is not needlessly duplicated, and does not
+ require two copies to be kept exactly in sync. This reduces the
+ risk of problems as a consequence of subtle differences between
+ the two scripts.
+ - mount options may be specified in either /etc/default/tmpfs or
+ in /etc/fstab, and will supersede hard coded defaults. The
+ the values in fstab (if any) will supersede those in
+ /etc/default/tmpfs should an entry be present. These values are
+ also used for remounting, which means that filesystems mounted in
+ an initramfs and moved onto the root filesystem prior to init
+ starting will be remounted with the correct user-specified
+ options.
+ - Improve robustness of stat checks when comparing directories.
+ - mountkernfs.sh and mountdevsubfs.sh are idempotent, so allow for
+ repeated invocation. This is needed to allow the same code to
+ be used for mounting, remounting and mtab generation.
+ - Enabling RAMLOCK, RAMSHM and RAMTMP in /etc/default/rcS is no longer
+ required if the filesystems are present in /etc/fstab
+ * /etc/default/tmpfs is deprecated
+ - If changing the default size limits, adding an entry to /etc/fstab
+ is preferred compared with editing /etc/default/tmpfs. This also
+ permits modifying the default mount options, and setting additional
+ mount options.
+ - If /etc/default/tmpfs has been modified from the defaults, any
+ needed entries will be created in /etc/fstab on upgrade, to
+ preserve the settings from /etc/default/tmpfs. The entries in
+ /etc/fstab will subsequently override the settings in
+ /etc/default/tmpfs.
+ * The mount options for /run are made stricter when possible. For
+ example, if /run/shm is a separate filesystem, it may be safely
+ mounted with "noexec".
+ * Compatibility symbolic links are relative, not absolute. e.g.
+ /var/lock is ../run/lock rather than /run/lock. This means that if
+ you're using a chroot from the host system, you'll always be using
+ locations in the chroot, rather than the host, when following the
+ links.
+ * Updated documentation in initscripts README.Debian and rcS(5).
+
+ [ Kel Modderman ]
* Consider rpcbind as alternative to portmap in mountnfs ifupdown
script. Thanks to Jamie Heilman and Arthur de Jong.
(Closes: #620788)
- -- Kel Modderman <[email protected]> Sun, 17 Apr 2011 07:14:54 +1000
+ -- Roger Leigh <[email protected]> Fri, 22 Apr 2011 15:25:25 +0100
sysvinit (2.88dsf-13.4) experimental; urgency=low
diff --git a/debian/initscripts.postinst b/debian/initscripts.postinst
index abb37c7..db2a7ee 100755
--- a/debian/initscripts.postinst
+++ b/debian/initscripts.postinst
@@ -5,6 +5,10 @@
set -e
+. /lib/init/vars.sh
+. /lib/init/tmpfs.sh
+. /lib/init/mount-functions.sh
+
case "$1" in
configure)
PREV_VER=$2
@@ -48,6 +52,9 @@ guest_environment() {
return 0
}
+# If the device/inode are the same, a bind mount already exists or the
+# transition is complete, so set up is not required. Otherwise bind
+# mount $SRC on $DEST.
bind_mount ()
{
SRC=$1
@@ -56,6 +63,9 @@ bind_mount ()
FSTYPE=""
OPTS=""
+ ssrc="$(/usr/bin/stat -L --format="%d %i" "$SRC" 2>/dev/null || :)"
+ sdest="$(/usr/bin/stat -L --format="%d %i" "$DEST" 2>/dev/null || :)"
+
case "$(uname -s)" in
Linux) FSTYPE=$SRC; OPTS="-orw -obind" ;;
*FreeBSD) FSTYPE=nullfs; OPTS="-orw" ;;
@@ -64,25 +74,59 @@ bind_mount ()
esac
# Bind mount $SRC on $DEST
- if mount -t $FSTYPE "$SRC" "$DEST" $OPTS ; then
- return 0
+ if [ -n "$ssrc" ] && [ "$ssrc" != "$sdest" ]; then
+ [ -d "$DEST" ] || mkdir "$DEST"
+ if mount -t $FSTYPE "$SRC" "$DEST" $OPTS ; then
+ return 0
+ fi
+ return 1
fi
- return 1
+ return 0
}
compat_link () {
SRC=$1
DEST=$2
- echo "guest environment detected: Linking $DEST to $SRC"
- ( rm -fr $DEST &&
- ln -fs $SRC $DEST) ||
- { echo "Can't symlink $DEST to $SRC; please fix manually."; return 1; }
+ ssrc="$(/usr/bin/stat -L --format="%d %i" "$SRC" 2>/dev/null || :)"
+ sdest="$(/usr/bin/stat -L --format="%d %i" "$DEST" 2>/dev/null || :)"
+
+ if [ -n "$ssrc" ] && [ "$ssrc" != "$sdest" ]; then
+ echo "guest environment detected: Linking $DEST to $SRC"
+ ( rm -fr $DEST &&
+ ln -fs $SRC $DEST) ||
+ { echo "Can't symlink $DEST to $SRC; please fix manually."; return 1; }
+ fi
return 0
}
+# Migrate settings from /etc/default/tmpfs to fstab. This is to allow
+# sharing of settings between sysvinit initscripts and systemd. It is
+# a one time only migration. /etc/default/tmpfs will be removed for
+# wheezy, and this migration function should be removed in wheezy+1.
+# Creation of an fstab entry is only done if the size limits do not
+# match the defaults, i.e. have been locally modified.
+tmpfs_fstab_migrate () {
+ if [ -n "$RUN_SIZE" ] && [ "$RUN_SIZE" != "10%" ]; then
+ RUNEXEC=
+ if read_fstab_entry /run/shm || [ yes = "$RAMSHM" ] ; then
+ RUNEXEC=',noexec'
+ fi
+ # TODO: Add -onodev once checkroot no longer creates a device node.
+ domount fstab tmpfs shmfs /run tmpfs "-onosuid$RUNEXEC$RUN_OPT" 2>&1 >>/etc/fstab
+ fi
+ if [ yes = "$RAMLOCK" ] && [ -n "$LOCK_SIZE" ] && [ "$LOCK_SIZE" != "5242880" ]; then
+ # Locally modified.
+ domount fstab tmpfs shmfs /run/lock tmpfs "-onodev,noexec,nosuid$LOCK_OPT" 2>&1 >>/etc/fstab
+ fi
+ if [ yes = "$RAMSHM" ] && [ -n "$SHM_SIZE" ] && [ "$SHM_SIZE" != "20%" ]; then
+ # Locally modified.
+ domount fstab tmpfs shmfs /run/shm tmpfs "-onosuid,nodev$SHM_OPT" 2>&1 >>/etc/fstab
+ fi
+}
+
#
# Initialize rcS default file.
#
@@ -164,7 +208,7 @@ update-rc.d stop-bootlogd start 99 2 3 4 5 . >/dev/null || exit $?
#
# Remove scripts that were left behind by older glibc (<< 2.3.2.ds1-12)
-# versions. We have the same functionality in mount{kern,devsub}fs.sh
+# versions. We have the same functionality in mount{kern,devsub}fs.sh
#
#
# In 2.86.ds1-10 the "mountvirtfs" script was replaced by
@@ -187,14 +231,6 @@ done
# without a system restart.
#
-# Device and inode of directories:
-svarrun="$(/usr/bin/stat -L --format="%d %i" /var/run)"
-svarlock="$(/usr/bin/stat -L --format="%d %i" /var/lock)"
-sdevshm="$(/usr/bin/stat -L --format="%d %i" /dev/shm)"
-# May not exist yet
-srun="$(/usr/bin/stat -L --format="%d %i" /run 2>/dev/null || :)"
-srunlock="$(/usr/bin/stat -L --format="%d %i" /run/lock 2>/dev/null || :)"
-srunshm="$(/usr/bin/stat -L --format="%d %i" /run/shm 2>/dev/null || :)"
# If in a chroot or vserver environment (i.e. a guest, which does not
# run rcS scripts), do not do any messing around with mounts, and
# don't migrate /var/run, /var/lock or /dev/shm. Bind mounting would
@@ -206,60 +242,29 @@ srunshm="$(/usr/bin/stat -L --format="%d %i" /run/shm 2>/dev/null || :)"
# locations and create compatibilty symlinks at their convenience
# following the upgrade.
if guest_environment; then
- if [ ! -f /run/.ramfs ] && [ "$svarrun" != "$srun" ]; then
- # Symlink /var/run from /run
- if compat_link /var/run /run; then
- # Symlink /var/lock from /run/lock
- if [ "$svarlock" != "$srunlock" ]; then
- compat_link /var/lock /run/lock
- fi
-
- # Symlink /dev/shm from /run/shm
- if [ "$sdevshm" != "$srunshm" ]; then
- compat_link /dev/shm /run/shm
- fi
- fi
+ # Symlink /var/run from /run
+ # Note var/run is relative
+ if compat_link var/run /run; then
+ # Symlink /var/lock from /run/lock
+ # Note that it's really /var/run/lock
+ compat_link ../../var/lock /run/lock
+
+ # Symlink /dev/shm from /run/shm
+ # Note that it's really /var/run/shm
+ compat_link ../../dev/shm /run/shm
fi
-# Not a chroot. If /run/.run-transition does not exist then
-# skip. /run/.run-transition should not exist either before
-# or after the transition. This file is used to ensure we
-# don't perform the initial migration more than once if
-# initscripts is upgraded again before a system restart (and
-# hence transition completion).
-elif [ ! -f /run/.run-transition ]; then
- # If /run/.ramfs exists, then a ramfs already exists,
- # and we assume it's all set up correctly. If the
- # device/inode are the same, it's not set up entirely
- # correctly, but a bind mount already exists for some
- # reason, so again assume set up is not required.
- if [ ! -f /run/.ramfs ] && [ "$svarrun" != "$srun" ]; then
- # Bind mount /var/run on /run
- if bind_mount /var/run /run; then
- # Bind mount /var/lock on /run/lock
- [ -d /run/lock ] || mkdir /run/lock
- if [ "$svarlock" != "$srunlock" ]; then
- bind_mount /var/lock /run/lock
- fi
-
- # Bind mount /dev/shm on /run/shm
- [ -d /run/shm ] || mkdir /run/shm
- if [ "$sdevshm" != "$srunshm" ]; then
- bind_mount /dev/shm /run/shm
- fi
- fi
+# Host system, not a chroot.
+else
+ if bind_mount /var/run /run; then
+ bind_mount /var/lock /run/lock
+ bind_mount /dev/shm /run/shm
fi
- # Create a /run/.run-transition stamp file. This is
- # to ensure we don't repeat the above setup if the
- # package is upgraded again prior to a system reboot.
- # On reboot, it will be deleted by the init scripts
- # and the transition will be completed. This means
- # the transition will complete at the sysadmin's
- # convenience, since the system will function
- # identically before and after a reboot.
echo "Please reboot to complete migration to tmpfs-based /run" > /run/.run-transition
fi
+tmpfs_fstab_migrate
+
#
# When installing for the first time or upgrading from a version
# before or equal to 2.88dsf-14, a reboot is needed to make the /run
diff --git a/debian/src/initscripts/doc/README.Debian b/debian/src/initscripts/doc/README.Debian
index d9d6ba6..56ad2e7 100644
--- a/debian/src/initscripts/doc/README.Debian
+++ b/debian/src/initscripts/doc/README.Debian
@@ -2,28 +2,21 @@ tmpfs
-----
Tmpfs can be used as virtual memory filesystem. glibc 2.2 and above
-expects a tmpfs to be mounted at /dev/shm (/run/shm) for POSIX shared
-memory, this is done automatically by /etc/init.d/mountdevsubfs.sh
-early in the boot process. You can limit tmpfs max size by setting the
-SHM_SIZE variable to a desired size in the /etc/default/tmpfs file to
-prevent tmpfs from using up all system memory.
-
-A size limit for the tmpfs filesystem mounted over /run can be set via
-the RUN_SIZE variable in the /etc/default/tmpfs file. Likewise, a
-size limit for the tmpfs filesystem mounted over /run/lock can be set
-via the LOCK_SIZE variable (if enabled with RAMLOCK=yes) and for
-/run/shm via the SHM_SIZE variable (if enabled with RAMSHM=yes).
-Additionally, a size limit for the tmpfs filesystem mounted over /tmp
-can be set via the TMP_SIZE variable (if enabled with RAMTMP=yes).
+expects a tmpfs to be mounted at /run/shm (/dev/shm) for POSIX shared
+memory; this is done automatically by /etc/init.d/mountdevsubfs.sh
+early in the boot process. A tmpfs will also be mounted on /run as a
+writable location available from early boot. Optionally, tmpfs
+filesystems may be mounted on /run/lock and /tmp. The tmpfs
+filesystems to be mounted are configured in /etc/default/rcS. Please
+see rcS(5) for details.
+
+Size limits may be set of any of the ram file systems (tmpfs) mounted
+on /run, /run/lock, /run/shm or /tmp. Please see rcS(5) for details.
Note that /tmp may be a symlink to e.g. /run/tmp, making it possible
to use a single tmpfs for all writable filesystems other than /var;
the directory pointed to by the symlink will be created if it does not
already exist.
-If TMPFS_SIZE is set in /etc/default/tmpfs, it will be used as the
-default value for SHM_SIZE, RUN_SIZE, LOCK_SIZE and
-TMP_SIZE. Otherwise, kernel defaults are used.
-
sendsigs process omission interface
-----------------------------------
diff --git a/debian/src/initscripts/etc/default/tmpfs b/debian/src/initscripts/etc/default/tmpfs
index b3303ad..c053e36 100644
--- a/debian/src/initscripts/etc/default/tmpfs
+++ b/debian/src/initscripts/etc/default/tmpfs
@@ -1,17 +1,29 @@
-# Defaults for tmpfs filesystems mounted in early boot, before
+# Size defaults for tmpfs filesystems mounted in early boot, before
# filesystems from /etc/fstab are mounted.
#
+# NOTE: This file is deprecated. Please see rcS(5) for details on how
+# to configure tmpfs size limits.
+#
# _SIZE variables are the maximum size (in bytes) that tmpfs
# filesystems can use. The size will be rounded down to a multiple of
# the page size, 4096 bytes. If no size is set, TMPFS_SIZE will be
# used as the default.
+#
+# Note that more complex mount options may be used by the creation of a
+# suitable entry in /etc/fstab. For example:
+# tmpfs /run tmpfs size=10% 0 0
+# is equivalent to RUN_SIZE=10%, and will override the RUN_SIZE
+# setting. This will allow additional options such as nr_blocks and
+# nr_inodes to be used, and also adjustment of the mode, nodev,
+# nosuid, noexec options should any change from the defaults be
+# necessary.
# TMPFS_SIZE: maximum size for all tmpfs filesystems if no specific
# size is provided. If no value is provided here, the kernel default
# will be used.
TMPFS_SIZE=20%
-# RUN_SIZE: maximum size of /run (/var/run)
+# RUN_SIZE: maximum size of /run (was previously /var/run)
#
# Defaults to 10% core memory; the size required varies widely
# depending upon the demands of the software being run; this heuristic
@@ -20,13 +32,13 @@ TMPFS_SIZE=20%
# is hundreds of KiB, maximum is tens of MiB.
RUN_SIZE=10%
-# LOCK_SIZE: maximum size of /run/lock (/var/lock)
+# LOCK_SIZE: maximum size of /run/lock (was previously /var/lock)
#
# Typical usage: tens of KiB; maximum hundreds of KiB. Default of
# 5MiB should ensure the limit is never reached.
LOCK_SIZE=5242880 # 5MiB
-# SHM_SIZE: maximum size of /run/shm (/dev/shm)
+# SHM_SIZE: maximum size of /run/shm (was previously /dev/shm)
#
# No default size; the size required varies widely depending upon the
# demands of the software being run.
diff --git a/debian/src/initscripts/etc/init.d/mountdevsubfs.sh b/debian/src/initscripts/etc/init.d/mountdevsubfs.sh
index 18f1c45..3e10e29 100755
--- a/debian/src/initscripts/etc/init.d/mountdevsubfs.sh
+++ b/debian/src/initscripts/etc/init.d/mountdevsubfs.sh
@@ -27,29 +27,30 @@ KERNEL="$(uname -s)"
. /lib/lsb/init-functions
. /lib/init/mount-functions.sh
+# May be run several times, so must be idempotent.
+# $1: Mount mode, to allow for remounting and mtab updating
+mount_filesystems () {
+ MNTMODE="$1"
-do_start () {
- #
# Mount a tmpfs on /run/shm
- #
if [ ! -d /run/shm ]
then
mkdir --mode=755 /run/shm
[ -x /sbin/restorecon ] && /sbin/restorecon /run/shm
fi
- SHM_OPT=
- [ "${SHM_SIZE:=$TMPFS_SIZE}" ] && SHM_OPT=",size=$SHM_SIZE"
- [ "${SHM_MODE:=$TMPFS_MODE}" ] && SHM_OPT="$SHM_OPT,mode=$SHM_MODE"
- if [ yes = "$RAMSHM" ] ; then
- domount tmpfs shmfs /run/shm tmpfs "-onosuid,nodev$SHM_OPT"
+ if [ yes = "$RAMSHM" ] || read_fstab_entry /run/shm tmpfs; then
+ domount "$MNTMODE" tmpfs shmfs /run/shm tmpfs "-onosuid,nodev$SHM_OPT"
else
chmod "$SHM_MODE" /run/shm
fi
- #
+ # Migrate early, so /dev/shm is available from the start
+ if [ "$MNTMODE" = mount_noupdate ] || [ "$MNTMODE" = mount ]; then
+ run_migrate /dev/shm /run/shm ../run/shm
+ fi
+
# Mount /dev/pts
- #
if [ "$KERNEL" = Linux ]
then
if [ ! -d /dev/pts ]
@@ -57,21 +58,23 @@ do_start () {
mkdir --mode=755 /dev/pts
[ -x /sbin/restorecon ] && /sbin/restorecon /dev/pts
fi
- domount devpts "" /dev/pts devpts "-onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE"
+ domount "$MNTMODE" devpts "" /dev/pts devpts "-onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE"
fi
}
case "$1" in
"")
echo "Warning: mountdevsubfs should be called with the 'start' argument." >&2
- do_start
+ mount_filesystems mount_noupdate
;;
start)
- do_start
+ mount_filesystems mount_noupdate
+ ;;
+ mtab)
+ mount_filesystems mtab
;;
restart|reload|force-reload)
- echo "Error: argument '$1' not supported" >&2
- exit 3
+ mount_filesystems remount
;;
stop)
# No-op
diff --git a/debian/src/initscripts/etc/init.d/mountkernfs.sh b/debian/src/initscripts/etc/init.d/mountkernfs.sh
index 2525108..85a02fb 100755
--- a/debian/src/initscripts/etc/init.d/mountkernfs.sh
+++ b/debian/src/initscripts/etc/init.d/mountkernfs.sh
@@ -18,7 +18,11 @@ PATH=/sbin:/bin
. /lib/lsb/init-functions
. /lib/init/mount-functions.sh
-do_start () {
+# May be run several times, so must be idempotent.
+# $1: Mount mode, to allow for remounting and mtab updating
+mount_filesystems () {
+ MNTMODE="$1"
+
# Needed to determine if root is being mounted read-only.
read_fstab
@@ -26,34 +30,31 @@ do_start () {
# Get some writable area available before the root is checked
# and remounted.
#
- RW_OPT=
- [ "${RW_SIZE:=$TMPFS_SIZE}" ] && RW_OPT=",size=$RW_SIZE"
- [ "${RW_MODE:=$TMPFS_MODE}" ] && RW_OPT="$RW_OPT,mode=$RW_MODE"
- domount tmpfs shmfs /lib/init/rw tmpfs "-onosuid$RW_OPT"
- touch /lib/init/rw/.ramfs
-
- RUN_OPT=
- [ "${RUN_SIZE:=$TMPFS_SIZE}" ] && RUN_OPT=",size=$RUN_SIZE"
- [ "${RUN_MODE:=$TMPFS_MODE}" ] && RUN_OPT="$RUN_OPT,mode=$RUN_MODE"
- domount tmpfs shmfs /run tmpfs "-onosuid$RUN_OPT"
- touch /run/.ramfs
+ domount "$MNTMODE" tmpfs shmfs /lib/init/rw tmpfs "-onosuid$RW_OPT"
+ [ -f /lib/init/rw/.ramfs ] || touch /lib/init/rw/.ramfs
+
+ # If /run/shm is separately mounted, /run can be safely mounted noexec.
+ RUNEXEC=
+ if [ yes = "$RAMSHM" ] || read_fstab_entry /run/shm tmpfs; then
+ RUNEXEC=',noexec'
+ fi
+ # TODO: Add -onodev once checkroot no longer creates a device node.
+ domount "$MNTMODE" tmpfs shmfs /run tmpfs "-onosuid$RUNEXEC$RUN_OPT"
+ [ -f /run/.ramfs ] || touch /run/.ramfs
# Make lock directory as the replacement for /var/lock
- mkdir --mode=755 /run/lock
+ [ -d /run/lock ] || mkdir --mode=755 /run/lock
# Mount /run/lock as tmpfs if enabled. This prevents user DoS
# of /run by filling /run/lock at the expense of using an
# additional tmpfs.
- LOCK_OPT=
- [ "${LOCK_SIZE:=$TMPFS_SIZE}" ] && LOCK_OPT=",size=$LOCK_SIZE"
- [ "${LOCK_MODE:=$TMPFS_MODE}" ] && LOCK_OPT="$LOCK_OPT,mode=$LOCK_MODE"
- if [ yes = "$RAMLOCK" ] ; then
- domount tmpfs shmfs /run/lock tmpfs "-onodev,noexec,nosuid$LOCK_OPT"
+ if [ yes = "$RAMLOCK" ] || read_fstab_entry /run/lock tmpfs; then
+ domount "$MNTMODE" tmpfs shmfs /run/lock tmpfs "-onodev,noexec,nosuid$LOCK_OPT"
else
chmod "$LOCK_MODE" /run/lock
fi
- touch /run/lock/.ramfs
+ [ -f /run/lock/.ramfs ] || touch /run/lock/.ramfs
# If /tmp is a symlink, make sure the linked-to directory exists.
if [ -L /tmp ] && [ ! -d /tmp ]; then
@@ -64,7 +65,10 @@ do_start () {
# If root is read only, default to mounting a tmpfs on /tmp,
# unless one is due to be mounted from fstab.
if [ rw != "$rootmode" ]; then
- if will_mount /tmp ; then
+ # If there's an entry in fstab for /tmp (any
+ # filesystem type, not just tmpfs), then we don't need
+ # a tmpfs on /tmp by default.
+ if read_fstab_entry /tmp ; then
:
else
RAMTMP="yes"
@@ -72,13 +76,11 @@ do_start () {
fi
# Mount /tmp as tmpfs if enabled.
- TMP_OPT=
- [ "${TMP_SIZE:=$TMPFS_SIZE}" ] && TMP_OPT=",size=$TMP_SIZE"
- [ "${TMP_MODE:=$TMPFS_MODE}" ] && TMP_OPT="$TMP_OPT,mode=$TMP_MODE"
- if [ yes = "$RAMTMP" ] ; then
- domount tmpfs shmfs /tmp tmpfs "-onodev,nosuid$TMP_OPT"
+ if [ yes = "$RAMTMP" ] || read_fstab_entry /tmp tmpfs; then
+ domount "$MNTMODE" tmpfs shmfs /tmp tmpfs "-onodev,nosuid$TMP_OPT"
else
- if [ rw = "$rootmode" ]; then
+ # When root is still read only, this will fail.
+ if [ mount_noupdate != "$MNTMODE" ] && [ rw = "$rootmode" ]; then
chmod "$TMP_MODE" /tmp
fi
fi
@@ -87,13 +89,13 @@ do_start () {
# Note: /run transition: Move from /lib/init/rw to /run.
# /lib/init/rw will be removed following transition of
# /lib/init/rw users to /run.
- mkdir --mode=755 /lib/init/rw/sendsigs.omit.d/
- mkdir --mode=755 /run/sendsigs.omit.d/
+ [ -d /lib/init/rw/sendsigs.omit.d ] || mkdir --mode=755 /lib/init/rw/sendsigs.omit.d/
+ [ -d /run/sendsigs.omit.d ] || mkdir --mode=755 /run/sendsigs.omit.d/
#
# Mount proc filesystem on /proc
#
- domount proc "" /proc proc "-onodev,noexec,nosuid"
+ domount "$MNTMODE" proc "" /proc proc "-onodev,noexec,nosuid"
#
# Mount sysfs on /sys
@@ -101,21 +103,23 @@ do_start () {
# Only mount sysfs if it is supported (kernel >= 2.6)
if grep -E -qs "sysfs\$" /proc/filesystems
then
- domount sysfs "" /sys sysfs "-onodev,noexec,nosuid"
+ domount "$MNTMODE" sysfs "" /sys sysfs "-onodev,noexec,nosuid"
fi
}
case "$1" in
"")
echo "Warning: mountkernfs should be called with the 'start' argument." >&2
- do_start
+ mount_filesystems mount_noupdate
;;
start)
- do_start
+ mount_filesystems mount_noupdate
+ ;;
+ mtab)
+ mount_filesystems mtab
;;
restart|reload|force-reload)
- echo "Error: argument '$1' not supported" >&2
- exit 3
+ mount_filesystems remount
;;
stop)
# No-op
diff --git a/debian/src/initscripts/etc/init.d/mtab.sh b/debian/src/initscripts/etc/init.d/mtab.sh
index 1ee9396..18c9bc7 100644
--- a/debian/src/initscripts/etc/init.d/mtab.sh
+++ b/debian/src/initscripts/etc/init.d/mtab.sh
@@ -29,109 +29,6 @@ KERNEL="$(uname -s)"
. /lib/lsb/init-functions
. /lib/init/mount-functions.sh
-# Note any changes here must also be made in domount in mount-functions.
-# $1: file system type
-# $2: alternative file system type (or empty string if none)
-# $3: mount point
-# $4: mount device name
-# $5... : extra mount program options
-domtab ()
-{
- MTPT="$3"
- KERNEL="$(uname -s)"
- # Figure out filesystem type
- FSTYPE=
- OPTS=
- if [ "$1" = proc ]
- then
- case "$KERNEL" in
- Linux|GNU) FSTYPE=proc;;
- *FreeBSD) FSTYPE=linprocfs ;;
- *) FSTYPE=procfs ;;
- esac
- elif [ "$1" = bind ]
- then
- case "$KERNEL" in
- Linux) FSTYPE=$4; OPTS="-obind" ;;
- *FreeBSD) FSTYPE=nullfs ;;
- GNU) FSTYPE=firmlink ;;
- *) FSTYPE=none ;;
- esac
- elif [ "$1" = tmpfs ]
- then # always accept tmpfs, to mount /run before /proc
- case "$KERNEL" in
- GNU) FSTYPE=none ;; # for now
- *) FSTYPE=$1 ;;
- esac
- elif grep -E -qs "$1\$" /proc/filesystems
- then
- FSTYPE=$1
- elif grep -E -qs "$2\$" /proc/filesystems
- then
- FSTYPE=$2
- fi
-
- if [ ! "$FSTYPE" ]
- then
- if [ "$2" ]
- then
- log_warning_msg "Filesystem types '$1' and '$2' are not supported. Skipping mount."
- else
- log_warning_msg "Filesystem type '$1' is not supported. Skipping mount."
- fi
- return
- fi
-
- # We give file system type as device name if not specified as
- # an argument
- if [ "$4" ] ; then
- DEVNAME=$4
- else
- DEVNAME=$FSTYPE
- fi
-
- # Get the options from /etc/fstab.
- if [ -f /etc/fstab ]
- then
- exec 9<&0 </etc/fstab
-
- while read TAB_DEV TAB_MTPT TAB_FSTYPE TAB_OPTS TAB_REST
- do
- case "$TAB_DEV" in ""|\#*) continue ;; esac
- [ "$MTPT" = "$TAB_MTPT" ] || continue
- [ "$FSTYPE" = "$TAB_FSTYPE" ] || continue
- case "$TAB_OPTS" in
- noauto|*,noauto|noauto,*|*,noauto,*)
- exec 0<&9 9<&-
- return
- ;;
- ?*)
- OPTS="$OPTS -o$TAB_OPTS"
- ;;
- esac
- break
- done
-
- exec 0<&9 9<&-
- fi
-
- if [ ! -d "$MTPT" ]
- then
- return
- fi
-
- if ! mountpoint -q "$MTPT"
- then
- return # Not mounted
- fi
-
- # Already recorded?
- if ! grep -E -sq "^([^ ]+) +$MTPT +" /etc/mtab < /dev/null
- then
- mount -f -t $FSTYPE $5 $OPTS $DEVNAME $MTPT < /dev/null
- fi
-}
-
do_start () {
# Needed to determine if root is being mounted read-only.
read_fstab
@@ -177,57 +74,13 @@ do_start () {
restorecon /etc/mtab
fi
- # S02mountkernfs.sh
- RW_OPT=
- [ "${RW_SIZE:=$TMPFS_SIZE}" ] && RW_OPT=",size=$RW_SIZE"
- [ "${RW_MODE:=$TMPFS_MODE}" ] && RW_OPT="$RW_OPT,mode=$RW_MODE"
- domtab tmpfs shmfs /lib/init/rw tmpfs "-onosuid$RW_OPT"
-
- RUN_OPT=
- [ "${RUN_SIZE:=$TMPFS_SIZE}" ] && RUN_OPT=",size=$RUN_SIZE"
- [ "${RUN_MODE:=$TMPFS_MODE}" ] && RUN_OPT="$RUN_OPT,mode=$RUN_MODE"
- domtab tmpfs shmfs /run tmpfs "-onosuid$RUN_OPT"
-
- if [ yes = "$RAMLOCK" ] ; then
- LOCK_OPT=
- [ "${LOCK_SIZE:=$TMPFS_SIZE}" ] && LOCK_OPT=",size=$LOCK_SIZE"
- [ "${LOCK_MODE:=$TMPFS_MODE}" ] && LOCK_OPT="$LOCK_OPT,mode=$LOCK_MODE"
- domtab tmpfs shmfs /run/lock tmpfs "-onodev,noexec,nosuid$LOCK_OPT"
- fi
-
- if [ yes = "$RAMTMP" ] || [ rw != "$rootmode" ] ; then
- TMP_OPT=
- [ "${TMP_SIZE:=$TMPFS_SIZE}" ] && TMP_OPT=",size=$TMP_SIZE"
- [ "${TMP_MODE:=$TMPFS_MODE}" ] && TMP_OPT="$TMP_OPT,mode=$TMP_MODE"
- domtab tmpfs shmfs /tmp tmpfs "-onodev,nosuid$TMP_OPT"
- fi
-
- domtab proc "" /proc proc "-onodev,noexec,nosuid"
-
- if grep -E -qs "sysfs\$" /proc/filesystems
- then
- domtab sysfs "" /sys sysfs "-onodev,noexec,nosuid"
- fi
-
- if [ -d /proc/bus/usb ]
- then
- domtab usbfs "" /proc/bus/usb "procbususb"
- fi
-
+ # Add entries for mounts created in early boot
+ # S01mountkernfs.sh
+ /etc/init.d/mountkernfs.sh mtab
# S03udev
- domtab tmpfs "" /dev "udev" "-omode=0755"
-
- # S04mountdevsubfs
- if [ yes = "$RAMSHM" ] ; then
- SHM_OPT=
- [ "${SHM_SIZE:=$TMPFS_SIZE}" ] && SHM_OPT=",size=$SHM_SIZE"
- [ "${SHM_MODE:=$TMPFS_MODE}" ] && SHM_OPT="$SHM_OPT,mode=$SHM_MODE"
- domtab tmpfs "" /dev/shm tmpfs "-onosuid,nodev$SHM_OPT"
- fi
- if [ "$KERNEL" = Linux ]
- then
- domtab devpts "" /dev/pts "devpts" "-onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE"
- fi
+ domount mtab tmpfs "" /dev "udev" "-omode=0755"
+ # S03mountdevsubfs.sh
+ /etc/init.d/mountdevsubfs.sh mtab
# Add everything else in /proc/mounts into /etc/mtab, with
# special exceptions.
@@ -245,7 +98,7 @@ do_start () {
continue
;;
esac
- domtab "$FTYPE" "" "$FDIR" "$FDEV" "-o$FOPTS"
+ domount mtab "$FTYPE" "" "$FDIR" "$FDEV" "-o$FOPTS"
done
exec 0<&8 8<&-
}
diff --git a/debian/src/initscripts/lib/init/mount-functions.sh b/debian/src/initscripts/lib/init/mount-functions.sh
index 5f1042a..1100990 100644
--- a/debian/src/initscripts/lib/init/mount-functions.sh
+++ b/debian/src/initscripts/lib/init/mount-functions.sh
@@ -78,112 +78,116 @@ read_fstab () {
exec 0<&9 9<&-
}
-will_mount () {
- exec 9<&0 </etc/fstab
+# Find a specific fstab entry
+# $1=mountpoint
+# $2=fstype (optional)
+# returns 0 on success, 1 on failure (not found or no fstab)
+read_fstab_entry () {
+ # Not found by default.
+ found=1
- found=1 # Not found
+ if [ -f /etc/fstab ]; then
- while read DEV MTPT FSTYPE OPTS DUMP PASS JUNK
- do
- case "$DEV" in
- ""|\#*)
- continue;
- ;;
- esac
- if [ "$MTPT" = "$1" ]; then
- found=0; # Found
- fi
- done
+ exec 9<&0 </etc/fstab
- exec 0<&9 9<&-
- return $found
+ while read MNT_FSNAME MNT_DIR MNT_TYPE MNT_OPTS MNT_FREQ MAN_PASS MAN_JUNK
+ do
+ case "$MNT_FSNAME" in
+ ""|\#*)
+ continue;
+ ;;
+ esac
+ if [ "$MNT_DIR" = "$1" ]; then
+ if [ -n "$2" ]; then
+ [ "$MNT_TYPE" = "$2" ] || continue;
+ fi
+ # Found
+ found=0;
+ break
+ fi
+ done
+
+ exec 0<&9 9<&-
+
+ return $found
+ fi
}
-# Called before mtab is writable to mount kernel and device file systems.
-# Note any changes here must also be made in domtab in mtab.sh.
-# $1: file system type
-# $2: alternative file system type (or empty string if none)
-# $3: mount point
-# $4: mount device name
-# $5... : extra mount program options
+# Mount kernel and device file systems.
+# $1: mount mode (mount, remount, mtab)
+# $2: file system type
+# $3: alternative file system type (or empty string if none)
+# $4: mount point
+# $5: mount device name
+# $6... : extra mount program options
domount () {
- MTPT="$3"
+ MOUNTMODE="$1"
+ PRIFSTYPE="$2"
+ ALTFSTYPE="$3"
+ MTPT="$4"
+ DEVNAME="$5"
+ CALLER_OPTS="$6"
+
KERNEL="$(uname -s)"
- # Figure out filesystem type
+ # Figure out filesystem type from primary and alternative type
FSTYPE=
- OPTS=
- if [ "$1" = proc ]
- then
+ # Filesystem-specific mount options
+ FS_OPTS=
+ # Mount options from fstab
+ FSTAB_OPTS=
+
+ if [ "$PRIFSTYPE" = proc ]; then
case "$KERNEL" in
Linux|GNU) FSTYPE=proc ;;
*FreeBSD) FSTYPE=linprocfs ;;
*) FSTYPE=procfs ;;
esac
- elif [ "$1" = bind ]
- then
+ elif [ "$PRIFSTYPE" = bind ]; then
case "$KERNEL" in
- Linux) FSTYPE=$4; OPTS="-obind" ;;
+ Linux) FSTYPE="$DEVNAME"; FS_OPTS="-obind" ;;
*FreeBSD) FSTYPE=nullfs ;;
GNU) FSTYPE=firmlink ;;
*) FSTYPE=none ;;
esac
- elif [ "$1" = tmpfs ]
- then # always accept tmpfs, to mount /run before /proc
+ elif [ "$PRIFSTYPE" = tmpfs ]; then
+ # always accept tmpfs, to mount /run before /proc
case "$KERNEL" in
GNU) FSTYPE=none ;; # for now
- *) FSTYPE=$1 ;;
+ *) FSTYPE=$PRIFSTYPE ;;
esac
- elif grep -E -qs "$1\$" /proc/filesystems
- then
- FSTYPE=$1
- elif grep -E -qs "$2\$" /proc/filesystems
- then
- FSTYPE=$2
+ elif grep -E -qs "$PRIFSTYPE\$" /proc/filesystems; then
+ FSTYPE=$PRIFSTYPE
+ elif grep -E -qs "$ALTFSTYPE\$" /proc/filesystems; then
+ FSTYPE=$ALTFSTYPE
fi
- if [ ! "$FSTYPE" ]
- then
- if [ "$2" ]
- then
- log_warning_msg "Filesystem types '$1' and '$2' are not supported. Skipping mount."
+ # Filesystem not supported by kernel
+ if [ ! "$FSTYPE" ]; then
+ if [ "$ALTFSTYPE" ]; then
+ log_warning_msg "Filesystem types '$PRIFSTYPE' and '$ALTFSTYPE' are not supported. Skipping mount."
else
- log_warning_msg "Filesystem type '$1' is not supported. Skipping mount."
+ log_warning_msg "Filesystem type '$PRIFSTYPE' is not supported. Skipping mount."
fi
return
fi
# We give file system type as device name if not specified as
# an argument
- if [ "$4" ] ; then
- DEVNAME=$4
- else
+ if [ -z "$DEVNAME" ] ; then
DEVNAME=$FSTYPE
fi
- # Get the options from /etc/fstab.
- if [ -f /etc/fstab ]
- then
- exec 9<&0 </etc/fstab
-
- while read TAB_DEV TAB_MTPT TAB_FSTYPE TAB_OPTS TAB_REST
- do
- case "$TAB_DEV" in ""|\#*) continue ;; esac
- [ "$MTPT" = "$TAB_MTPT" ] || continue
- [ "$FSTYPE" = "$TAB_FSTYPE" ] || continue
- case "$TAB_OPTS" in
- noauto|*,noauto|noauto,*|*,noauto,*)
- exec 0<&9 9<&-
+ # Get the mount options from /etc/fstab
+ if read_fstab_entry "$MTPT" "$FSTYPE"; then
+ case "$MNT_OPTS" in
+ noauto|*,noauto|noauto,*|*,noauto,*)
return
;;
- ?*)
- OPTS="$OPTS -o$TAB_OPTS"
+ ?*)
+ FSTAB_OPTS="-o$MNT_OPTS"
;;
- esac
- break
- done
-
- exec 0<&9 9<&-
+ esac
fi
if [ ! -d "$MTPT" ]
@@ -192,18 +196,67 @@ domount () {
return
fi
- if mountpoint -q "$MTPT"
- then
- return # Already mounted
+ if [ "$MOUNTMODE" = "mount_noupdate" ]; then
+ MOUNTFLAGS="-n"
+ MOUNTMODE=mount
fi
-
- if [ "$VERBOSE" != "no" ]; then
- is_empty_dir "$MTPT" >/dev/null 2>&1 || log_warning_msg "Files under mount point '$MTPT' will be hidden."
- fi
- mount -n -t $FSTYPE $5 $OPTS $DEVNAME $MTPT
- if [ "$FSTYPE" = "tmpfs" -a -x /sbin/restorecon ]; then
- /sbin/restorecon $MTPT
+ if [ "$MOUNTMODE" = "remount_noupdate" ]; then
+ MOUNTFLAGS="-n"
+ MOUNTMODE=remount
fi
+
+ case "$MOUNTMODE" in
+ mount)
+ if mountpoint -q "$MTPT"; then
+ # Already mounted, probably moved from the
+ # initramfs, so remount with the
+ # user-specified mount options.
+ mount $MOUNTFLAGS -oremount $CALLER_OPTS $FSTAB_OPTS $MTPT
+ else
+ if [ "$VERBOSE" != "no" ]; then
+ is_empty_dir "$MTPT" >/dev/null 2>&1 || log_warning_msg "Files under mount point '$MTPT' will be hidden."
+ fi
+ mount $MOUNTFLAGS -t $FSTYPE $CALLER_OPTS $FSTAB_OPTS $FS_OPTS $DEVNAME $MTPT
+ if [ "$FSTYPE" = "tmpfs" -a -x /sbin/restorecon ]; then
+ /sbin/restorecon $MTPT
+ fi
+ fi
+ ;;
+ remount)
+ if mountpoint -q "$MTPT"; then
+ # Remount with user-specified mount options
+ mount $MOUNTFLAGS -oremount $CALLER_OPTS $FSTAB_OPTS $MTPT
+ fi
+ ;;
+ mtab)
+ # Update mtab with correct mount options if
+ # the filesystem is mounted
+ MOUNTFLAGS="-f"
+
+ if mountpoint -q "$MTPT"; then
+ # Already recorded?
+ if ! grep -E -sq "^([^ ]+) +$MTPT +" /etc/mtab < /dev/null
+ then
+ mount $MOUNTFLAGS -t $FSTYPE $CALLER_OPTS $FSTAB_OPTS $FS_OPTS $DEVNAME $MTPT < /dev/null
+ fi
+ fi
+ ;;
+ fstab)
+ # Generate fstab with default mount options.
+ # Note does not work for bind mounts, and does
+ # not work if the fstab already has an entry
+ # for the filesystem.
+
+ if ! read_fstab_entry "$MTPT" "$FSTYPE"; then
+ CALLER_OPTS="$(echo "$CALLER_OPTS" | sed -e 's/^-o//')"
+ echo "Creating /etc/fstab entry for $MTPT to replace default in /etc/default/tmpfs (deprecated)" >&2
+ cat << EOF
+# This mount for $MTPT replaces the default configured in /etc/default/tmpfs
+$DEVNAME $MTPT $FSTYPE $CALLER_OPTS 0 0
+EOF
+ fi
+ ;;
+ esac
}
#
@@ -226,6 +279,7 @@ run_migrate ()
{
OLD=$1
RUN=$2
+ RUNLINK=$3
KERNEL="$(uname -s)"
OPTS=""
@@ -236,11 +290,18 @@ run_migrate ()
*) FSTYPE=none ;;
esac
+ # Create relative symlink if not already present. This is to
+ # upgrade from older versions which created absolute links.
+ if [ -L "$OLD" ] && [ "$(readlink "$OLD")" = "$RUN" ]; then
+ rm -f "$OLD"
+ ln -fs "$RUNLINK" "$OLD"
+ fi
+
# If both directories are the same, we don't need to do
# anything further.
- sold="$(/usr/bin/stat -L --format="%d %i" "$OLD")"
- srun="$(/usr/bin/stat -L --format="%d %i" "$RUN")"
- if [ "$sold" = "$srun" ]; then
+ sold="$(/usr/bin/stat -L --format="%d %i" "$OLD" 2>/dev/null || :)"
+ srun="$(/usr/bin/stat -L --format="%d %i" "$RUN" 2>/dev/null || :)"
+ if [ -n "$sold" ] && [ "$sold" = "$srun" ]; then
return 0
fi
@@ -262,10 +323,11 @@ run_migrate ()
mount -t $FSTYPE "$RUN" "$OLD" $OPTS
else
# Create symlink if not already present.
- if [ -L "$OLD" ] && [ "$(readlink "$OLD")" = "$RUN" ]; then
+ if [ -L "$OLD" ] && [ "$(readlink "$OLD")" = "$RUNLINK" ]; then
:
else
- ln -fs "$RUN" "$OLD"
+ rm -f "$OLD"
+ ln -fs "$RUNLINK" "$OLD"
fi
fi
@@ -289,7 +351,7 @@ post_mountall ()
# filesystems are mounted, we replace the directory with a
# symlink where possible.
- run_migrate /var/run /run
- run_migrate /var/lock /run/lock
- run_migrate /dev/shm /run/shm
+ run_migrate /var/run /run ../run
+ run_migrate /var/lock /run/lock ../run/lock
+ run_migrate /dev/shm /run/shm ../run/shm
}
diff --git a/debian/src/initscripts/lib/init/tmpfs.sh b/debian/src/initscripts/lib/init/tmpfs.sh
index ed8efd6..412e274 100644
--- a/debian/src/initscripts/lib/init/tmpfs.sh
+++ b/debian/src/initscripts/lib/init/tmpfs.sh
@@ -30,3 +30,23 @@ RW_MODE=755
if [ -f /etc/default/tmpfs ]; then
. /etc/default/tmpfs
fi
+
+RUN_OPT=
+[ "${RUN_SIZE:=$TMPFS_SIZE}" ] && RUN_OPT=",size=$RUN_SIZE"
+[ "${RUN_MODE:=$TMPFS_MODE}" ] && RUN_OPT="$RUN_OPT,mode=$RUN_MODE"
+
+LOCK_OPT=
+[ "${LOCK_SIZE:=$TMPFS_SIZE}" ] && LOCK_OPT=",size=$LOCK_SIZE"
+[ "${LOCK_MODE:=$TMPFS_MODE}" ] && LOCK_OPT="$LOCK_OPT,mode=$LOCK_MODE"
+
+SHM_OPT=
+[ "${SHM_SIZE:=$TMPFS_SIZE}" ] && SHM_OPT=",size=$SHM_SIZE"
+[ "${SHM_MODE:=$TMPFS_MODE}" ] && SHM_OPT="$SHM_OPT,mode=$SHM_MODE"
+
+TMP_OPT=
+[ "${TMP_SIZE:=$TMPFS_SIZE}" ] && TMP_OPT=",size=$TMP_SIZE"
+[ "${TMP_MODE:=$TMPFS_MODE}" ] && TMP_OPT="$TMP_OPT,mode=$TMP_MODE"
+
+RW_OPT=
+[ "${RW_SIZE:=$TMPFS_SIZE}" ] && RW_OPT=",size=$RW_SIZE"
+[ "${RW_MODE:=$TMPFS_MODE}" ] && RW_OPT="$RW_OPT,mode=$RW_MODE"
diff --git a/debian/src/initscripts/man/rcS.5 b/debian/src/initscripts/man/rcS.5
index 6590834..3990e01 100644
--- a/debian/src/initscripts/man/rcS.5
+++ b/debian/src/initscripts/man/rcS.5
@@ -97,35 +97,77 @@ to be run with the \fB\-y\fP option instead of the \fB\-a\fP option.
This will tell fsck always to repair the file systems
without asking for permission.
+.IP /run
+
+Previously configured using \fBRAMRUN\fP, /run is now always mounted
+as a ram file system (tmpfs). The size of the tmpfs can be controlled
+using TMPFS_SIZE and RUN_SIZE in /etc/default/tmpfs. However,
+/etc/default/tmpfs is deprecated and to override the defaults an entry
+should be created in /etc/fstab, for example:
+
+.IP
+tmpfs /run tmpfs nodev,nosuid,size=10%,mode=755 0 0
+
+.IP
+The contents of /run will always be lost on system reboot, and it it
+is no longer explicitly cleaned at boot. Packages can not expect
+directories in /run to exist after boot. Packages expecting this are
+buggy and need to be fixed. Note that /run was previously /var/run,
+and a compatibility symlink or bind mount will be created to allow the
+old path to continue to function.
+
.IP \fBRAMLOCK\fP
Make /run/lock/ available as a ram file system (tmpfs). Set to 'yes'
to enable, to 'no' to disable (defaults to yes). The size of the
tmpfs can be controlled using TMPFS_SIZE and LOCK_SIZE in
-/etc/default/tmpfs. Note that irrespective of this setting /run/lock
-will be located on a tmpfs, either one mounted on /run/lock (if
-RAMLOCK=yes) or one mounted on /run (if RAMLOCK=no), and as a result
-the contents of /var/lock will always be lost on system reboot, and it
-it is no longer explicitly cleaned at boot. Because of this, packages
-can not expect directories in /var/lock to exist after boot. Packages
-expecting this are buggy and need to be fixed. Note that /run/lock
-was previously /var/lock, and a compatibility symlink or bind mount
-will be created to allow the old path to continue to function.
+/etc/default/tmpfs. However, /etc/default/tmpfs is deprecated and to
+override the defaults an entry should be created in /etc/fstab, for
+example:
+
+.IP
+tmpfs /run/lock tmpfs nodev,noexec,nosuid,size=52428800,mode=1777 0 0
+
+.IP
+Note that irrespective of this setting /run/lock will be located on a
+tmpfs, either one mounted on /run/lock (if RAMLOCK=yes) or one mounted
+on /run (if RAMLOCK=no), and as a result the contents of /var/lock
+will always be lost on system reboot, and it it is no longer
+explicitly cleaned at boot. Packages can not expect directories in
+/var/lock to exist after boot. Packages expecting this are buggy and
+need to be fixed. Note that /run/lock was previously /var/lock, and a
+compatibility symlink or bind mount will be created to allow the old
+path to continue to function.
+
.IP \fBRAMSHM\fP
Make /run/shm available as a ram file system (tmpfs). Set to 'yes' to
enable, to 'no' to disable (defaults to yes). The size of the tmpfs
can be controlled using TMPFS_SIZE and SHM_SIZE in /etc/default/tmpfs.
-Because of this, packages can not expect directories in /run/shm to
-exist after boot. Note that /run/shm was previously /dev/shm, and a
-compatibility symlink or bind mount will be created to allow the old
-path to continue to function.
+However, /etc/default/tmpfs is deprecated to override the defaults and
+an entry should be created in /etc/fstab, for example:
+
+.IP
+tmpfs /run/shm tmpfs nosuid,nodev,size=40%,mode=1777 0 0
+
+.IP
+Packages can not expect directories in /run/shm to exist after boot.
+Note that /run/shm was previously /dev/shm, and a compatibility
+symlink or bind mount will be created to allow the old path to
+continue to function.
+
.IP \fBRAMTMP\fP
Make /tmp/ available as a ram file system (tmpfs). Set to 'yes' to
enable, to 'no' to disable (defaults to yes). The size of the tmpfs
can be controlled using TMPFS_SIZE and TMP_SIZE in /etc/default/tmpfs.
-Because of this, packages can not expect directories in /tmp to exist
-after boot.
+However, /etc/default/tmpfs is deprecated and to override the defaults
+an entry should be created in /etc/fstab, for example:
+
+.IP
+tmpfs /tmp tmpfs nodev,nosuid,size=20%,mode=1777 0 0
+
+.IP
+Packages can not expect directories in /tmp to exist after boot.
.IP \fBASYNCMOUNTNFS\fP
Set this to 'no' to disable asynchronous mounting of network drives
signature.asc
Description: Digital signature
_______________________________________________ Pkg-sysvinit-devel mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/pkg-sysvinit-devel

