New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modules/virtualisation/qemu-vm: always enable serial console #40004
Conversation
@GrahamcOfBorg test ipv6 |
Failure on x86_64-linux (full log) Attempted: tests.ipv6 Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: tests.ipv6 Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: qemu Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: qemu Partial log (click to expand)
|
Success on x86_64-darwin (full log) Attempted: qemu Partial log (click to expand)
|
Sounds like a good idea. Does this affect the graphical usage though? I have some recollection that for some reason or another, I needed to specify |
Right, order is important, and I missed that :-) Setting multiple So I fear this is also platform-specific, or what is Regarding |
Right, that was the problem; it's actually impossible to have e.g. the initrd ask for a passphrase and be able to respond to it from either the virtual console or the serial console. Fortunately, most of the time the user doesn't need to interact with stage-1, just see its output. In fact stage-1 already tries to capture the output so it ends up in journalctl: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/system/boot/stage-1-init.sh#L89. Maybe that code could be extended so that it shows up on the other consoles as well. (In fact, I don't understand why that isn't happening with the current code, given it's writing to |
I changed the PR. Now consoles on |
Always enable both tty and serial console, but set preferred console depending on cfg.graphical. Even in qemu graphical mode, you can switch to the serial console via Ctrl+Alt+3. With that being done, you also don't need to specify `systemd.services."serial-getty@ttyS0".enable = true;` either as described in https://nixos.wiki/wiki/Cheatsheet#Building_a_service_as_a_VM_.28for_testing.29, as systemd automatically spawns a getty on consoles passwd via cmdline. This also means, vms built by 'nixos-rebuild build-vm' can simply be run properly in nographic mode by appending `-nographic` to `result/bin/run-*-vm`, without the need to explicitly add platform-specific QEMU_KERNEL_PARAMS.
Success on x86_64-darwin (full log) Attempted: qemu Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: qemu Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: qemu Partial log (click to expand)
|
This one sounds good to me. BTW, regarding
|
This explains it. Thanks! Additionally, I misread |
Motivation for this change
Don't make serial console activation dependent on graphical.
Even in qemu graphical mode, you can switch to the serial console via
Ctrl+Alt+3.
With that being done, you also don't need to specify
systemd.services."serial-getty@ttyS0".enable = true;
either as described inhttps://nixos.wiki/wiki/Cheatsheet#Building_a_service_as_a_VM_.28for_testing.29,
as systemd automatically spawns a getty on consoles passwd via cmdline.
This also means, vms built by
nixos-rebuild build-vm
can simply be runproperly in nographic mode by appending
-nographic
toresult/bin/run-*-vm
,without the need to explicitly add platform-specific
QEMU_KERNEL_PARAMS.
/cc @dezgeg
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)