On Saturday 21 March 2009 23:04:00 Roger Leigh wrote:
> On Thu, Mar 19, 2009 at 12:10:58PM -0300, Henrique de Moraes Holschuh wrote:
> > On Thu, 19 Mar 2009, Roger Leigh wrote:
> > > BTW, if you don't agree with the rationale in my previous mail, let
> > > me know and I'll redo the patch to do the version check in mtab.sh.
> > > The overall concensus on #debian-devel was to just kill it, though.
> >
> > I just need to know WHAT is supposedly to make squeeze incompatible with
> > the Linux kernel before 2.6.26, to make an informed decision :)
>
> I just saw your reply on -devel. I'm guessing it's udev; not something
> I'm totally happy about, but I guess systems using it are the exception
> nowadays.
>
> I've attached a new patch which removes the version check, but keeps
> the kernel check intact. It also removes the conffiles in postrm.
I updated your patch to remove /etc/init.d/mtab.sh from disk and clean up
a couple of things (no whitspace change in postrm, unrelated update-rc.d purge
of hostname.sh in postinst). Please take a look, I'd like to apply it to
the package vcs.
>
> I did see in the postrm that you are removing the conffile and
> conffile.dpkg-old. You are, however, not removing conffile.dpkg-new
> or conffile.dpkg-dist. Is this indentional or just an omission?
I think it only cares about the orignial file or locally modified backups
created by the eliminate_conffile() function in initscripts.preinst.
Thanks, Kel.
--- a/debian/initscripts/conffiles
+++ b/debian/initscripts/conffiles
@@ -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
--- a/debian/initscripts/doc/README.Debian
+++ b/debian/initscripts/doc/README.Debian
@@ -46,8 +46,8 @@ required, it will be mounted in any case
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
--- a/debian/initscripts/etc/init.d/mtab.sh
+++ /dev/null
@@ -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
-
-:
--- a/debian/initscripts/postinst
+++ b/debian/initscripts/postinst
@@ -107,6 +107,14 @@ then
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 hostname.sh start 2
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 @@ do
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
--- a/debian/initscripts/postrm
+++ b/debian/initscripts/postrm
@@ -14,7 +14,9 @@ case "$1" in
/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
--- a/debian/initscripts/preinst
+++ b/debian/initscripts/preinst
@@ -50,6 +50,13 @@ case "$1" in
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" le "2.86.ds1-61" ; 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
_______________________________________________
Pkg-sysvinit-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/pkg-sysvinit-devel