1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-20 04:31:52 +00:00
nixpkgs/nixos/modules
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
..
config Make the default fonts conditional on services.xserver.enable 2016-09-05 15:51:37 +02:00
hardware Merge branch 'master' into staging 2016-08-21 12:03:41 +01:00
i18n/input-method input-methods modules: fix engine description 2016-09-06 22:53:15 +09:00
installer nix: 1.11.3 -> 1.11.4 2016-09-06 16:15:22 +02:00
misc NixOS 17.03 will be called Gorilla 2016-09-07 15:05:00 +00:00
profiles Make it possible to disable "info" 2016-09-05 14:53:27 +02:00
programs Enable the runuser command from util-linux 2016-09-06 17:23:27 +02:00
security Merge pull request #18366 from groxxda/acme-loop 2016-09-06 23:02:07 +02:00
services nixos: Fix ordering of firewall.service 2016-09-07 15:11:24 +02:00
system nixos/stage2: Fix mounting special filesystems 2016-09-07 18:10:08 +02:00
tasks nfs module: Fix dependency on statd and idmapd 2016-09-07 14:15:57 +02:00
testing KDE test: Bump kdm start timeout 2016-05-27 11:22:27 +02:00
virtualisation bightbox-image.nix: use lib in stead of stdenv.lib. Fixes #18208 2016-09-02 10:04:09 +00:00
module-list.nix Make it possible to disable "info" 2016-09-05 14:53:27 +02:00
rename.nix nixos/modules/rename.nix: fix eval error 2016-08-28 14:47:24 +01:00