1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 19:51:17 +00:00

Revert "nixos-container: use systemd-run instead of nsenter"

This reverts commit 7cb100b683.

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
This commit is contained in:
Maximilian Bosch 2020-03-26 01:17:32 +01:00
parent 3a009bd5da
commit 7f1ba606ac
No known key found for this signature in database
GPG key ID: 091DBF4D1FC46B8E

View file

@ -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