[Pkg-sysvinit-commits] r1330 - in sysvinit/trunk/debian: . initscripts initscripts/doc initscripts/etc/init.d
Kel Modderman
kelmo-guest at alioth.debian.org
Wed May 13 18:44:06 UTC 2009
Author: kelmo-guest
Date: 2009-05-13 18:44:06 +0000 (Wed, 13 May 2009)
New Revision: 1330
Removed:
sysvinit/trunk/debian/initscripts/etc/init.d/mtab.sh
Modified:
sysvinit/trunk/debian/NEWS
sysvinit/trunk/debian/changelog
sysvinit/trunk/debian/initscripts/conffiles
sysvinit/trunk/debian/initscripts/doc/README.Debian
sysvinit/trunk/debian/initscripts/etc/init.d/checkfs.sh
sysvinit/trunk/debian/initscripts/etc/init.d/checkroot.sh
sysvinit/trunk/debian/initscripts/postinst
sysvinit/trunk/debian/initscripts/postrm
sysvinit/trunk/debian/initscripts/preinst
Log:
* Remove /etc/init.d/mtab.sh and have initscript preinst maintainer script
create a symlink to /proc/mounts. (Closes: #494001)
Thanks to Roger Leigh <rleigh at codelibre.net>
- remove debian/initscripts/etc/init.d/mtab.sh
- eliminate /etc/init.d/mtab.sh in debian/initscripts/preinst, save a copy
if locally modified
- remove /etc/init.d/mtab.sh from debian/initscripts/conffiles
- clean up /etc/init.d/mtab.sh and /etc/init.d/mtab.sh.dpkg-old in
debian/initscripts/postrm
- purge mtab.sh from runlevel configuration in debian/initscripts/postinst
- create a symlink from /etc/mtab -> /proc mounts if the system is Linux,
/etc/mtab exists, /etc/mtab is not a symlink and /proc/mounts exists
- do not mention mtab.sh in debian/initscripts/doc/README.Debian
- remove mtab from Should-Start field of LSB information in
debian/initscripts/etc/init.d/checkfs.sh
- check /etc/mtab is a symlink and attempt to create a link to
/proc/mounts if it is not in debian/initscripts/etc/init.d/checkroot.sh
- document the reason for removal of /etc/mtab in favour of a symink to
/proc/mounts in debian/NEWS
Modified: sysvinit/trunk/debian/NEWS
===================================================================
--- sysvinit/trunk/debian/NEWS 2009-03-29 18:48:21 UTC (rev 1329)
+++ sysvinit/trunk/debian/NEWS 2009-05-13 18:44:06 UTC (rev 1330)
@@ -1,3 +1,28 @@
+sysvinit (2.86.ds1-62) unstable; urgency=low
+
+ In version 2.86.ds1-62 of the initscripts package, /etc/mtab is replaced
+ with a symlink to /proc/mounts and /etc/init.d/mtab.sh is removed.
+
+ With linux < 2.6.26, /proc/mounts lacks information present in /etc/mtab
+ such as additional mount options. Thus a symlink breaks things like
+ discquotas which rely on parsing the additional mount options.
+
+ With linux >= 2.6.26, /proc/mounts contains all of the information in
+ /etc/mtab, plus more. The mount system call can now pass all of the mount
+ options to the kernel, so no information is missing in /proc/mounts. This
+ has obviously useful benefits such as read-only root, and the state in
+ /etc/mtab never gets out of sync with reality.
+
+ Additionally, with the addition of per-process namespaces with CLONE_NEWNS
+ to clone(2), each process has its own set of mounts, and as such a
+ system-wide /etc/mtab is useless: it's only valid in one of the potentially
+ many namespaces and can quickly get into a horrible mess. At this point,
+ /etc/mtab *must* be a symlink to avoid breakage. Note that /proc/mounts is
+ now a symlink to /proc/self/mounts for this reason: each process has
+ potentially different mounts.
+
+ -- Kel Modderman <kel at otaku42.de> Wed, 13 May 2009 03:17:02 +1000
+
sysvinit (2.86.ds1-10) unstable; urgency=low
In version 2.86.ds1-10 of the initscripts package the shell function
Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog 2009-03-29 18:48:21 UTC (rev 1329)
+++ sysvinit/trunk/debian/changelog 2009-05-13 18:44:06 UTC (rev 1330)
@@ -59,8 +59,27 @@
* Exclude proc from mount_all_local() function of mountall.sh by
supplying noproc to the -t cli argument. Thanks Mike Hommey for
the patch. (Closes: #425199)
+ * Remove /etc/init.d/mtab.sh and have initscript preinst maintainer script
+ create a symlink to /proc/mounts. (Closes: #494001)
+ Thanks to Roger Leigh <rleigh at codelibre.net>
+ - remove debian/initscripts/etc/init.d/mtab.sh
+ - eliminate /etc/init.d/mtab.sh in debian/initscripts/preinst, save a copy
+ if locally modified
+ - remove /etc/init.d/mtab.sh from debian/initscripts/conffiles
+ - clean up /etc/init.d/mtab.sh and /etc/init.d/mtab.sh.dpkg-old in
+ debian/initscripts/postrm
+ - purge mtab.sh from runlevel configuration in debian/initscripts/postinst
+ - create a symlink from /etc/mtab -> /proc mounts if the system is Linux,
+ /etc/mtab exists, /etc/mtab is not a symlink and /proc/mounts exists
+ - do not mention mtab.sh in debian/initscripts/doc/README.Debian
+ - remove mtab from Should-Start field of LSB information in
+ debian/initscripts/etc/init.d/checkfs.sh
+ - check /etc/mtab is a symlink and attempt to create a link to
+ /proc/mounts if it is not in debian/initscripts/etc/init.d/checkroot.sh
+ - document the reason for removal of /etc/mtab in favour of a symink to
+ /proc/mounts in debian/NEWS
- -- Kel Modderman <kel at otaku42.de> Mon, 30 Mar 2009 04:47:48 +1000
+ -- Kel Modderman <kel at otaku42.de> Wed, 13 May 2009 03:24:31 +1000
sysvinit (2.86.ds1-61) unstable; urgency=low
Modified: sysvinit/trunk/debian/initscripts/conffiles
===================================================================
--- sysvinit/trunk/debian/initscripts/conffiles 2009-03-29 18:48:21 UTC (rev 1329)
+++ sysvinit/trunk/debian/initscripts/conffiles 2009-05-13 18:44:06 UTC (rev 1330)
@@ -14,7 +14,6 @@
/etc/init.d/mountoverflowtmp
/etc/init.d/mountdevsubfs.sh
/etc/init.d/mountkernfs.sh
-/etc/init.d/mtab.sh
/etc/init.d/rc.local
/etc/init.d/reboot
/etc/init.d/rmnologin
Modified: sysvinit/trunk/debian/initscripts/doc/README.Debian
===================================================================
--- sysvinit/trunk/debian/initscripts/doc/README.Debian 2009-03-29 18:48:21 UTC (rev 1329)
+++ sysvinit/trunk/debian/initscripts/doc/README.Debian 2009-05-13 18:44:06 UTC (rev 1330)
@@ -46,8 +46,8 @@
sysfs /sys sysfs rw,nosuid,nodev,noexec 0 0
The reason is that the entry in fstab needs to match the entry
-generated by the mountkernfs.sh and mtab.sh scripts. If it does not,
-the system will complain with this message during boot:
+generated by the mountkernfs.sh script. If it does not, the system
+will complain with this message during boot:
Will now mount local filesystems:mount: /sys already mounted or /sys busy
mount: according to mtab, sysfs is already mounted on /sys
Modified: sysvinit/trunk/debian/initscripts/etc/init.d/checkfs.sh
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/checkfs.sh 2009-03-29 18:48:21 UTC (rev 1329)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/checkfs.sh 2009-05-13 18:44:06 UTC (rev 1330)
@@ -3,7 +3,7 @@
# Provides: checkfs
# Required-Start: checkroot
# Required-Stop:
-# Should-Start: mtab cryptdisks
+# Should-Start: cryptdisks
# Default-Start: S
# Default-Stop:
# Short-Description: Check all filesystems.
Modified: sysvinit/trunk/debian/initscripts/etc/init.d/checkroot.sh
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/checkroot.sh 2009-03-29 18:48:21 UTC (rev 1329)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/checkroot.sh 2009-05-13 18:44:06 UTC (rev 1330)
@@ -39,7 +39,6 @@
# device node,
# 2) Swap that is on a md device or a file that may be on a md
# device,
- # 3) The mount parameters for a devfs filesystem.
#
exec 9<&0 </etc/fstab
@@ -52,7 +51,6 @@
rootcheck=no
swap_on_lv=no
swap_on_file=no
- devfs=
while read DEV MTPT FSTYPE OPTS DUMP PASS JUNK
do
@@ -75,11 +73,6 @@
[ "$FSTYPE" = "swap" ] && swap_on_file=yes
;;
*)
- # Devfs definition ?
- if [ "$FSTYPE" = "devfs" ] && [ "$MTPT" = "/dev" ] && mountpoint -q /dev
- then
- devfs="-t $FSTYPE $DEV $MTPT"
- fi
;;
esac
[ "$MTPT" != "/" ] && continue
@@ -339,42 +332,17 @@
fi
#
- # We only create/modify /etc/mtab if the location where it is
- # stored is writable. If /etc/mtab is a symlink into /proc/
- # then it is not writable.
+ # If /etc/mtab is not a symlink, attempt to symlink it to /proc/mounts
+ # on Linux. See #494001
#
- INIT_MTAB_FILE=no
- MTAB_PATH="$(readlink -f /etc/mtab || :)"
- case "$MTAB_PATH" in
- /proc/*)
- ;;
- /*)
- if touch "$MTAB_PATH" >/dev/null 2>&1
+ if [ Linux = "$KERNEL" ] && [ ! -L /etc/mtab ] && [ -f /proc/mounts ]
+ then
+ if touch /etc/mtab >/dev/null 2>&1
then
- :> "$MTAB_PATH"
- rm -f ${MTAB_PATH}~
- INIT_MTAB_FILE=yes
- fi
- ;;
- "")
- [ -L /etc/mtab ] && MTAB_PATH="$(readlink /etc/mtab)"
- if [ "$MTAB_PATH" ]
- then
- log_failure_msg "Cannot initialize ${MTAB_PATH}."
+ rm -f /etc/mtab && ln -s /proc/mounts /etc/mtab
else
- log_failure_msg "Cannot initialize /etc/mtab."
+ log_warning_msg "cannot symlink /etc/mtab to /proc/mounts"
fi
- ;;
- *)
- log_failure_msg "Illegal mtab location '${MTAB_PATH}'."
- ;;
- esac
-
- if [ "$INIT_MTAB_FILE" = yes ]
- then
- [ "$roottype" != none ] &&
- mount -f -o $rootopts -t $roottype $fstabroot /
- [ "$devfs" ] && mount -f $devfs
fi
#
Deleted: sysvinit/trunk/debian/initscripts/etc/init.d/mtab.sh
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/mtab.sh 2009-03-29 18:48:21 UTC (rev 1329)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/mtab.sh 2009-05-13 18:44:06 UTC (rev 1330)
@@ -1,180 +0,0 @@
-#! /bin/sh
-### BEGIN INIT INFO
-# Provides: mtab
-# Required-Start: checkroot
-# Required-Stop:
-# Default-Start: S
-# Default-Stop:
-# Short-Description: Update mtab file.
-# Description: Update the mount program's mtab file after
-# all local filesystems have been mounted.
-### END INIT INFO
-
-#
-# The main purpose of this script is to update the mtab file to reflect
-# the fact that virtual filesystems were mounted early on, before mtab
-# was writable.
-#
-
-PATH=/lib/init:/sbin:/bin
-. /lib/init/vars.sh
-
-TTYGRP=5
-TTYMODE=620
-[ -f /etc/default/devpts ] && . /etc/default/devpts
-
-TMPFS_SIZE=
-[ -f /etc/default/tmpfs ] && . /etc/default/tmpfs
-
-KERNEL="$(uname -s)"
-
-. /lib/lsb/init-functions
-. /lib/init/mount-functions.sh
-
-# $1 - fstype
-# $2 - mount point
-# $3 - mount name/device
-# $4 - mount options
-domtab ()
-{
- # Directory present?
- if [ ! -d $2 ]
- then
- return
- fi
-
- # Not mounted?
- if ! mountpoint -q $2 < /dev/null
- then
- return
- fi
-
- if [ -n "$3" ]
- then
- NAME="$3"
- else
- NAME="$1"
- fi
-
- # Already recorded?
- if ! grep -E -sq "^([^ ]+) +$2 +" /etc/mtab < /dev/null
- then
- mount -f -t $1 $OPTS $4 $NAME $2 < /dev/null
- fi
-}
-
-do_start () {
- DO_MTAB=""
- MTAB_PATH="$(readlink -f /etc/mtab || :)"
- case "$MTAB_PATH" in
- /proc/*)
- # Assume that /proc/ is not writable
- ;;
- /*)
- # Only update mtab if it is known to be writable
- # Note that the touch program is in /usr/bin
- #if ! touch "$MTAB_PATH" >/dev/null 2>&1
- #then
- # return
- #fi
- ;;
- "")
- [ -L /etc/mtab ] && MTAB_PATH="$(readlink /etc/mtab)"
- if [ "$MTAB_PATH" ]
- then
- log_failure_msg "Cannot initialize ${MTAB_PATH}."
- else
- log_failure_msg "Cannot initialize /etc/mtab."
- fi
- ;;
- *)
- log_failure_msg "Illegal mtab location '${MTAB_PATH}'."
- ;;
- esac
-
- #
- # Initialize mtab file if necessary
- #
- if [ ! -f /etc/mtab ]
- then
- :> /etc/mtab
- chmod 644 /etc/mtab
- fi
- if selinux_enabled && which restorecon >/dev/null 2>&1 && [ -r /etc/mtab ]
- then
- restorecon /etc/mtab
- fi
-
- # S02mountkernfs.sh
- RW_OPT=
- [ "${RW_SIZE:=$TMPFS_SIZE}" ] && RW_OPT=",size=$RW_SIZE"
- domtab tmpfs /lib/init/rw tmpfs -omode=0755,nosuid$RW_OPT
-
- domtab proc /proc "proc" -onodev,noexec,nosuid
- if grep -E -qs "sysfs\$" /proc/filesystems
- then
- domtab sysfs /sys sysfs -onodev,noexec,nosuid
- fi
- if [ yes = "$RAMRUN" ] ; then
- RUN_OPT=
- [ "${RUN_SIZE:=$TMPFS_SIZE}" ] && RUN_OPT=",size=$RUN_SIZE"
- domtab tmpfs /var/run "varrun" -omode=0755,nosuid$RUN_OPT
- fi
- if [ yes = "$RAMLOCK" ] ; then
- LOCK_OPT=
- [ "${LOCK_SIZE:=$TMPFS_SIZE}" ] && LOCK_OPT=",size=$LOCK_SIZE"
- domtab tmpfs /var/lock "varlock" -omode=1777,nodev,noexec,nosuid$LOCK_OPT
- fi
- if [ -d /proc/bus/usb ]
- then
- domtab usbfs /proc/bus/usb "procbususb"
- fi
-
- # S03udev
- domtab tmpfs /dev "udev" -omode=0755
-
- # S04mountdevsubfs
- SHM_OPT=
- [ "${SHM_SIZE:=$TMPFS_SIZE}" ] && SHM_OPT=",size=$SHM_SIZE"
- domtab tmpfs /dev/shm tmpfs -onosuid,nodev$SHM_OPT
- domtab devpts /dev/pts "devpts" -onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE
-
- # Add everything else in /proc/mounts into /etc/mtab, with
- # special exceptions.
- exec 9<&0 0</proc/mounts
- while read FDEV FDIR FTYPE FOPTS REST
- do
- case "$FDIR" in
- /lib/modules/*/volatile)
- FDEV="lrm"
- ;;
- /dev/.static/dev)
- # Not really useful to show in 'df',
- # and it isn't accessible for non-root
- # users.
- continue
- ;;
- esac
- domtab "$FTYPE" "$FDIR" "$FDEV" "-o$FOPTS"
- done
- exec 0<&9 9<&-
-}
-
-case "$1" in
- start|"")
- do_start
- ;;
- restart|reload|force-reload)
- echo "Error: argument '$1' not supported" >&2
- exit 3
- ;;
- stop)
- # No-op
- ;;
- *)
- echo "Usage: mountall-mtab.sh [start|stop]" >&2
- exit 3
- ;;
-esac
-
-:
Modified: sysvinit/trunk/debian/initscripts/postinst
===================================================================
--- sysvinit/trunk/debian/initscripts/postinst 2009-03-29 18:48:21 UTC (rev 1329)
+++ sysvinit/trunk/debian/initscripts/postinst 2009-05-13 18:44:06 UTC (rev 1330)
@@ -107,6 +107,14 @@
update-rc.d -f sendsigs remove >/dev/null 2>&1 || :
fi
+# In 2.86.ds1-62, the mtab.sh script was removed and /etc/mtab was
+# replaced with a symbolic link to /proc/mounts on Linux.
+if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-62"
+then
+ update-rc.d -f mtab.sh remove >/dev/null 2>&1 || :
+fi
+
+
#
# Okay, we could do this with update-rc.d, but that would probably
# be pretty slow. This way we win some speed.
@@ -119,7 +127,6 @@
updatercd mountdevsubfs.sh start 4 S .
updatercd bootlogd start 5 S .
updatercd checkroot.sh start 10 S .
-updatercd mtab.sh start 12 S .
updatercd checkfs.sh start 30 S .
updatercd mountall.sh start 35 S .
updatercd mountall-bootclean.sh start 36 S .
@@ -161,6 +168,24 @@
done
#
+# In 2.86.ds1-62 the mtab.sh script was removed and /etc/mtab
+# replaced with a symbolic link to /proc/mounts on Linux.
+#
+# The reason for this is that /etc/mtab requires a writable root
+# filesystem, and does not support per-process namespaces. Since
+# Linux 2.6.26, /proc/mounts contains all the information that
+# /etc/mtab provided (such as extra mount options), and it is a
+# symlink to /proc/self/mounts to support per-process namespaces.
+#
+if [ "$(uname -s)" = "Linux" ]
+then
+ if [ -f /etc/mtab ] && [ ! -L /etc/mtab ] && [ -f /proc/mounts ]
+ then
+ rm -f /etc/mtab && ln -s /proc/mounts /etc/mtab
+ fi
+fi
+
+#
# Create /var/run and /var/lock on the root partition to make sure
# they are available when RAMRUN or RAMLOCK is enabled.
# If mount fail (like in a vserver environment), just clean up and ignore
Modified: sysvinit/trunk/debian/initscripts/postrm
===================================================================
--- sysvinit/trunk/debian/initscripts/postrm 2009-03-29 18:48:21 UTC (rev 1329)
+++ sysvinit/trunk/debian/initscripts/postrm 2009-05-13 18:44:06 UTC (rev 1330)
@@ -14,7 +14,9 @@
/etc/init.d/bootclean \
/etc/init.d/bootclean.dpkg-old \
/etc/init.d/bootclean.sh \
- /etc/init.d/bootclean.sh.dpkg-old
+ /etc/init.d/bootclean.sh.dpkg-old \
+ /etc/init.d/mtab.sh \
+ /etc/init.d/mtab.sh.dpkg-old
#
# Remove configuration files
Modified: sysvinit/trunk/debian/initscripts/preinst
===================================================================
--- sysvinit/trunk/debian/initscripts/preinst 2009-03-29 18:48:21 UTC (rev 1329)
+++ sysvinit/trunk/debian/initscripts/preinst 2009-05-13 18:44:06 UTC (rev 1330)
@@ -50,6 +50,13 @@
eliminate_conffile "/etc/init.d/bootclean"
fi
#
+ # In 2.86.ds1-62, the mtab.sh script was removed and /etc/mtab was
+ # replaced with a symbolic link to /proc/mounts on Linux.
+ #
+ if [ "$2" ] && dpkg --compare-versions "$2" lt "2.86.ds1-62" ; then
+ eliminate_conffile "/etc/init.d/mtab.sh"
+ fi
+ #
# Move conflicting log _file_ if present
#
[ -f /var/log/fsck ] && mv -f /var/log/fsck /var/log/fsck.dpkg-old
More information about the Pkg-sysvinit-commits
mailing list