diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2020-03-26 01:17:32 +0100 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2020-03-26 17:55:12 +0100 |
commit | ebb6e385eac53f74963c95ac25cc22b16d161177 (patch) | |
tree | 4ee8920682c4898077f4dcd5c32235c46c9e0639 | |
parent | 59c58f3360b51d1e0fbf1251a2875a16edfb6ac8 (diff) |
Revert "nixos-container: use systemd-run instead of nsenter"
This reverts commit 7cb100b6833e020d4a4b25c3766cfde507e763e6. See also #83432. This appears to break at least the `container`-backend of `nixops`: when running `switch-to-configuration` within `nixos-container run`, the running `systemd`-instance gets reloaded which appears to kill the `systemd-run` command and causes `nixos-container run` to hang. The full issue is reported in the original PR[1]. [1] https://github.com/NixOS/nixpkgs/pull/67332#issuecomment-604145869 (cherry picked from commit 7f1ba606ac632c50efd33c435aa59e69d4f58acc)
-rwxr-xr-x | pkgs/tools/virtualization/nixos-container/nixos-container.pl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pkgs/tools/virtualization/nixos-container/nixos-container.pl b/pkgs/tools/virtualization/nixos-container/nixos-container.pl index 6e38942cb2539..dc05c974bd032 100755 --- a/pkgs/tools/virtualization/nixos-container/nixos-container.pl +++ b/pkgs/tools/virtualization/nixos-container/nixos-container.pl @@ -9,6 +9,7 @@ use Getopt::Long qw(:config gnu_getopt); use Cwd 'abs_path'; use Time::HiRes; +my $nsenter = "@utillinux@/bin/nsenter"; my $su = "@su@"; # Ensure a consistent umask. @@ -319,10 +320,9 @@ sub restartContainer { # Run a command in the container. sub runInContainer { my @args = @_; - - exec("systemd-run", "--machine", $containerName, "--pty", "--quiet", "--", @args); - - die "cannot run ‘systemd-run’: $!\n"; + my $leader = getLeader; + exec($nsenter, "-t", $leader, "-m", "-u", "-i", "-n", "-p", "--", @args); + die "cannot run ‘nsenter’: $!\n"; } # Remove a directory while recursively unmounting all mounted filesystems within |