From 14636ba0574ef7f50c7a083fe93e7a2c4cb1ed95 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 16 Jul 2011 19:27:45 +0000 Subject: [PATCH] * The Powers That Be have decided that there shall be a /run to replace /var/run and /var/lock. For instance, udev now keeps state in /run/udev instead of /dev/.udev. See http://lists.fedoraproject.org/pipermail/devel/2011-March/150031.html http://bugs.freestandards.org/show_bug.cgi?id=718 So this patch creates /run as a tmpfs, and symlinks /var/run to /run and /var/lock to /run/lock. TODO: create /run in stage 1 and propagate it to stage 2. svn path=/nixos/trunk/; revision=27803 --- .../services/network-filesystems/samba.nix | 2 -- modules/system/boot/stage-2-init.sh | 23 ++++++++++--------- modules/system/upstart-events/shutdown.nix | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/modules/services/network-filesystems/samba.nix b/modules/services/network-filesystems/samba.nix index e42316bf8bf..7ad597a9fa2 100644 --- a/modules/services/network-filesystems/samba.nix +++ b/modules/services/network-filesystems/samba.nix @@ -16,8 +16,6 @@ let setupScript = '' - mkdir -p /var/lock - if ! test -d /home/smbd ; then mkdir -p /home/smbd chown ${user} /home/smbd diff --git a/modules/system/boot/stage-2-init.sh b/modules/system/boot/stage-2-init.sh index b00baf8a075..a9c54ec67a8 100644 --- a/modules/system/boot/stage-2-init.sh +++ b/modules/system/boot/stage-2-init.sh @@ -98,9 +98,7 @@ mkdir -m 0755 -p /etc/nixos # Miscellaneous boot time cleanup. -rm -rf /var/run -rm -rf /var/lock -rm -rf /var/log/upstart +rm -rf /run /var/run /var/lock /var/log/upstart #echo -n "cleaning \`/tmp'..." #rm -rf --one-file-system /tmp/* @@ -123,14 +121,17 @@ rm -rf /nix/var/nix/chroots # recreated in activate-configuration.sh rm -rf /nix/var/nix/gcroots/tmp /nix/var/nix/temproots -# Use a tmpfs for /var/run to ensure that / or /var can be unmounted -# or at least remounted read-only during shutdown. (Upstart 0.6 -# apparently uses nscd to do some name lookups, resulting in it -# holding some mmap mapping to deleted files in /var/run/nscd. -# Similarly, portmap and statd have open files in /var/run and are -# needed during shutdown to unmount NFS volumes.) -mkdir -m 0755 -p /var/run -mount -t tmpfs -o "mode=755" none /var/run +# Create a tmpfs on /run to hold runtime state for programs such as +# udev. +mkdir -m 0755 -p /run +mount -t tmpfs -o "mode=755" none /run +mkdir -m 0700 -p /run/lock + + +# For backwards compatibility, symlink /var/run to /run, and /var/lock +# to /run/lock. +ln -s /run /var/run +ln -s /run/lock /var/lock # Clear the resume device. diff --git a/modules/system/upstart-events/shutdown.nix b/modules/system/upstart-events/shutdown.nix index 85ad601914d..cc89a97e88d 100644 --- a/modules/system/upstart-events/shutdown.nix +++ b/modules/system/upstart-events/shutdown.nix @@ -94,7 +94,7 @@ with pkgs.lib; # Skip various special filesystems. Non-existent # mount points are typically tmpfs/aufs mounts from # the initrd. - if [ "$mp" = /proc -o "$mp" = /sys -o "$mp" = /dev -o "$device" = "rootfs" -o "$mp" = /var/run -o ! -e "$mp" ]; then continue; fi + if [ "$mp" = /proc -o "$mp" = /sys -o "$mp" = /dev -o "$device" = "rootfs" -o "$mp" = /run -o "$mp" = /var/run -o "$mp" = /var/lock -o ! -e "$mp" ]; then continue; fi echo "unmounting $mp..."