diff --git a/modules/services/network-filesystems/samba.nix b/modules/services/network-filesystems/samba.nix index e42316bf8bf8..7ad597a9fa28 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 b00baf8a0758..a9c54ec67a88 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 85ad601914d8..cc89a97e88de 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..."