We use the `autologin` mkosi option (see
mkosi.default.d/10-systemd.conf), so the pexpect root login throws
a (harmless) error:
```
Arch Linux (built from systemd tree)
Kernel 5.4.0-1047-azure on an x86_64 (console)
image login: root (automatic login)
root
root
[root@image ~]# systemctl poweroff
root
-bash: root: command not found
[root@image ~]# systemctl poweroff
```
def run() -> None:
p = pexpect.spawnu(" ".join(sys.argv[1:]), logfile=sys.stdout, timeout=300)
- p.expect("login:")
- p.sendline("root")
-
p.expect("#")
p.sendline("systemctl poweroff")