1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 13:10:33 +00:00
nixpkgs/nixos
aszlig dd98b6fb9f
nixos/stage2: Fix mounting special filesystems
This partially reverts commit ab9537ca22.

From the manpage of systemd-nspawn(1):

  Note that systemd-nspawn will mount file systems private to the
  container to /dev, /run and similar.

Testing this in a shell turns out:

$ sudo systemd-nspawn --bind-ro=/nix/store "$(readlink "$(which ls)")" /proc
Spawning container aszlig on /home/aszlig.
Press ^] three times within 1s to kill container.
/etc/localtime does not point into /usr/share/zoneinfo/, not updating
container timezone.
1          execdomains  kpageflags    stat
acpi       fb           loadavg       swaps
asound     filesystems  locks         sys
buddyinfo  fs           meminfo       sysrq-trigger
bus        interrupts   misc          sysvipc
cgroups    iomem        modules       thread-self
cmdline    ioports      mounts        timer_list
config.gz  irq          mtrr          timer_stats
consoles   kallsyms     net           tty
cpuinfo    kcore        pagetypeinfo  uptime
crypto     key-users    partitions    version
devices    keys         scsi          vmallocinfo
diskstats  kmsg         self          vmstat
dma        kpagecgroup  slabinfo      zoneinfo
driver     kpagecount   softirqs
Container aszlig exited successfully.

So the test on whether PID 1 exists in /proc is enough, because if we
use PID namespaces there actually _is_ a PID 1 (as shown above) and the
special file systems are already mounted. A test on the $containers
variable actually mounts them twice.

This unbreaks NixOS containers and I've tested this against the
containers-imperative NixOS test.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @rickynils, @shlevy, @edolstra
2016-09-07 18:10:08 +02:00
..
doc/manual networkmanager: add information from wiki to docs (#18245) 2016-09-05 11:13:47 +02:00
lib nixos: generalize copy-paste from stage-1 and zfs to utils 2016-08-23 18:14:06 +00:00
maintainers Add AMIs in ap-northeast-2 and ap-south-1 2016-07-12 17:26:25 +02:00
modules nixos/stage2: Fix mounting special filesystems 2016-09-07 18:10:08 +02:00
tests nixos/tests/blivet: Fix btrfs-related tests 2016-09-07 16:32:12 +02:00
COPYING
default.nix nix: Add a "dev" output 2016-04-18 21:13:18 +02:00
README
release-combined.nix Make the NFSv4 tests release-critical 2016-09-07 14:15:57 +02:00
release-small.nix release-small: drop mysql51, removed in 975d33e6 2016-08-13 09:46:42 +02:00
release.nix Merge pull request #18085 from Mic92/ferm 2016-09-03 17:27:38 +02:00

*** NixOS ***

NixOS is a Linux distribution based on the purely functional package
management system Nix.  More information can be found at
http://nixos.org/nixos and in the manual in doc/manual.