diff options
author | Ryan Lahfa <masterancpp@gmail.com> | 2023-11-10 14:08:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-10 14:08:07 +0100 |
commit | b8218af2e6dfdf1bad83080d30acdb3b25e44378 (patch) | |
tree | 0153d33724cecd4069415e694f5d50390993b838 /nixos/lib | |
parent | 658414a1e4aaeff8f0face9f438d214cdddff0a4 (diff) | |
parent | e9e2240763e409b9b634aa73712578be3fda6b1e (diff) |
Merge pull request #256226 from ElvishJerricco/systemd-stage-1-testing-backdoor
Diffstat (limited to 'nixos/lib')
-rw-r--r-- | nixos/lib/test-driver/test_driver/machine.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/nixos/lib/test-driver/test_driver/machine.py b/nixos/lib/test-driver/test_driver/machine.py index 529de41d892a9..f430321bb6076 100644 --- a/nixos/lib/test-driver/test_driver/machine.py +++ b/nixos/lib/test-driver/test_driver/machine.py @@ -1278,3 +1278,19 @@ class Machine: def run_callbacks(self) -> None: for callback in self.callbacks: callback() + + def switch_root(self) -> None: + """ + Transition from stage 1 to stage 2. This requires the + machine to be configured with `testing.initrdBackdoor = true` + and `boot.initrd.systemd.enable = true`. + """ + self.wait_for_unit("initrd.target") + self.execute( + "systemctl isolate --no-block initrd-switch-root.target 2>/dev/null >/dev/null", + check_return=False, + check_output=False, + ) + self.wait_for_console_text(r"systemd\[1\]:.*Switching root\.") + self.connected = False + self.connect() |