Skip to content

Commit

Permalink
Revert "nixos-container: use systemd-run instead of nsenter"
Browse files Browse the repository at this point in the history
This reverts commit 7cb100b.

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] NixOS#67332 (comment)
  • Loading branch information
Ma27 committed Mar 26, 2020
1 parent 3a009bd commit 7f1ba60
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkgs/tools/virtualization/nixos-container/nixos-container.pl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Cwd 'abs_path';
use Time::HiRes;

my $nsenter = "@utillinux@/bin/nsenter";
my $su = "@su@";

# Ensure a consistent umask.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7f1ba60

Please sign in to comment.