Revert "nixos-container: use systemd-run instead of nsenter"
This reverts commit 7cb100b683
.
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)
This commit is contained in:
parent
59c58f3360
commit
ebb6e385ea
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user