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.
> In my opnion: do not hesitate to upload this to experimental and continue the > improvement of the transition to /run. Thanks. Following discussion with the systemd folks, they would prefer it if we could deprecate /etc/default/tmpfs and migrate to using /etc/fstab directly. This is because systemd can't make use of /etc/default/fstab directly, and if we both use fstab it's both more obvious for the user since it's in an expected place, and it can be shared with systemd. I've attached a proposed patch for this. Note that this is tested, but not yet final. I also attached a patch to tighten up mount options where possible. Currently we have hardcoded defaults in /lib/init/tmpfs.sh, user overrides of those defaults in /etc/default/tmpfs, and the additional possibility of overriding those in /etc/fstab. This patch converts any customised /etc/default/tmpfs settings into fstab entries, which would allow the /etc/default/tmpfs conffile to be dropped for wheezy. > Have you any comment about #623174 This is already the case. With the patched initramfs-tools (branch maks/run) the initramfs mounts /run and subsequently uses "mount --move" to move it only the root filesystem's /run. initscripts won't mount a second filesystem on /run if one is already mounted (the above changes simply cause a remount with the correct mount options). In consequence, I think all we need to do is have a dependency (possibly linux-specific?) on the version of initramfs-tools introducing /run support, which will ensure that if we support /run, it will have been mounted in the early initramfs. > and #623076 ? This is an odd one. We don't touch anything under /etc/network, and the /run changes don't alter anything except mounting /run and creating the compatibility symlinks/bind mounts. What I /think/ might be going on here is that ifupdown interacts badly with /dev/shm being a symlink, but I need to do more testing to confirm this. What I see is that "auto eth0" works, but "allow-hotplug eth0" does not; this is because the interfaces are "up" but unconfigured, so the hotplug event never occurs, and hence no DHCP discovery is done. Taking the interface down and up again results in it working correctly. I've checked several times that /dev/shm is always valid; I even moved the symlink creation to immediately after /run/shm being mounted. Even when /etc/network/run is just a directory (as opposed to being a symlink to /dev/shm/network or /run/network), networking fails to initialise. This is despite /etc/network/run/ifstate being created in every case, so it's not an issue with creating/updating the state file. I did see a request for sponsorship of an ifupdown update which made it use /run rather than all this messing around with /dev/shm and symlinks. I suspect the breakage is in the ifupdown init script, which looks like it makes use of /dev/shm, and may not like /dev/shm being a symlink. I don't think this is a bug in initscripts, but I will continue to investigate the cause. 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/initscripts.postinst b/debian/initscripts.postinst
index b395ee5..6437da6 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
@@ -98,6 +102,30 @@ compat_link () {
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.
+tmpfs_fstab_migrate () {
+ if [ -n "$RUN_SIZE" ] && [ "$RUN_SIZE" != "10%" ]; then
+ # Locally modified.
+ 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"
+ 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"
+ fi
+ if [ yes = "$RAMSHM" ] && [ -n "$SHM_SIZE" ] && [ "$SHM_SIZE" != "50%" ]; then
+ # Locally modified.
+ domount fstab tmpfs shmfs /run/shm tmpfs "-onosuid,nodev$SHM_OPT"
+ fi
+}
+
#
# Initialize rcS default file.
#
@@ -234,6 +262,8 @@ else
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/lib/init/mount-functions.sh b/debian/src/initscripts/lib/init/mount-functions.sh
index ab6f693..8c10171 100644
--- a/debian/src/initscripts/lib/init/mount-functions.sh
+++ b/debian/src/initscripts/lib/init/mount-functions.sh
@@ -114,8 +114,7 @@ read_fstab_entry () {
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.
+# 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)
@@ -242,6 +241,21 @@ domount () {
fi
fi
;;
+ fstab)
+ # Update 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)"
+ cat << EOF >> /etc/fstab
+# This mount for $MTPT replaces the default configured in /etc/default/tmpfs
+$DEVNAME $MTPT $FSTYPE $CALLER_OPTS 0 0
+EOF
+ fi
+ ;;
esac
}
diff --git a/debian/src/initscripts/etc/init.d/mountkernfs.sh b/debian/src/initscripts/etc/init.d/mountkernfs.sh
index cba0594..c27324f 100755
--- a/debian/src/initscripts/etc/init.d/mountkernfs.sh
+++ b/debian/src/initscripts/etc/init.d/mountkernfs.sh
@@ -33,7 +33,13 @@ mount_filesystems () {
domount "$MNTMODE" tmpfs shmfs /lib/init/rw tmpfs "-onosuid$RW_OPT"
[ -f /lib/init/rw/.ramfs ] || touch /lib/init/rw/.ramfs
- domount "$MNTMODE" tmpfs shmfs /run tmpfs "-onosuid$RUN_OPT"
+ # If /run/shm is separately mounted, /run can be safely mounted noexec.
+ 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 "$MNTMODE" tmpfs shmfs /run tmpfs "-onosuid$RUNEXEC$RUN_OPT"
[ -f /run/.ramfs ] || touch /run/.ramfs
# Make lock directory as the replacement for /var/lock
signature.asc
Description: Digital signature
_______________________________________________ Pkg-sysvinit-devel mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/pkg-sysvinit-devel

