[Pkg-sysvinit-devel] Bug#674178: /dev/shm is not set up right in chroot

Serge Hallyn serge.hallyn at canonical.com
Wed May 23 15:47:26 UTC 2012


Package: sysvinit
Version: 2.88dsf-24

If you do:

    debootstrap sid sid
    chroot sid dpkg -i /var/cache/apt/acrchives/initscripts*.deb

you will be left with a mount on sid/run/shm

The related Ubuntu bug is https://bugs.launchpad.net/launchpad/+bug/974584 .

A debdiff proposed (but not yet pushed) to fix this in Ubuntu follows.

thanks,
-serge

diff -u sysvinit-2.88dsf/debian/changelog sysvinit-2.88dsf/debian/changelog
--- sysvinit-2.88dsf/debian/changelog
+++ sysvinit-2.88dsf/debian/changelog
@@ -1,3 +1,13 @@
+sysvinit (2.88dsf-13.10ubuntu12) quantal; urgency=low
+
+  * debian/initscripts.postinst:  (LP: #974584)
+    - mkdir /run/shm if it doesn't exist in a chroot
+    - fix order of compat_link arguments for /run transition.  we want the
+      symlink INTO /run.  The reason the /run/lock symlink seemed to be created
+      correctly is that it has already been created by someone else.
+
+ -- Serge Hallyn <serge.hallyn at ubuntu.com>  Fri, 18 May 2012 21:21:29 +0000
+
 sysvinit (2.88dsf-13.10ubuntu11) precise; urgency=low
 
   * Only try to move links in /etc/rc{0,6}.d that match "S0*".  LP: #941867.
diff -u sysvinit-2.88dsf/debian/initscripts.postinst sysvinit-2.88dsf/debian/initscripts.postinst
--- sysvinit-2.88dsf/debian/initscripts.postinst
+++ sysvinit-2.88dsf/debian/initscripts.postinst
@@ -18,6 +18,23 @@
 
 umask 022
 
+# ischroot fails if /proc is not mounted - which it won't be with
+# debootstrap.
+myischroot ()
+{
+    local ret=0
+    local mounted=0
+    if [ ! -d /proc/1 ]; then
+        mounted=1
+        # failure to mount /proc, return 2 as ischroot would for nonroot
+        mount -t proc proc /proc || return 2
+    fi
+    ischroot
+    ret=$?
+    [ $mounted -eq 1 ] && umount /proc
+    return $ret
+}
+
 # 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.
@@ -245,17 +262,18 @@
 # sysadmin should, if they care, move the old locations to the new
 # locations and create compatibilty symlinks at their convenience
 # following the upgrade.
-if ischroot; then
+if myischroot; then
 	# 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
+		compat_link /run/lock /var/lock
 
+		mkdir -p /run/shm
 		# Symlink /dev/shm from /run/shm
 		# Note that it's really /var/run/shm
-		compat_link /dev/shm /run/shm
+		compat_link /run/shm /dev/shm
 	fi
 # Host system, not a chroot.
 else





More information about the Pkg-sysvinit-devel mailing list