NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: qemu: How to detach / reattach to console in -nographic mode?



On Fri, Nov 13, 2020 at 08:52:19AM +0000, Ottavio Caruso wrote:
On 13/11/2020 03:12, Mayuresh wrote:
I am looking for something like tmux/screen to attach and detach from qemu
guest's console (not qemu's console) when qemu is started in -nographic
mode.

Well I can use tmux/screen itself to keep one dedicated terminal, but
that's the last resort.

I tried adding a telnet monitor, but it gives me qemu console, not the
guest OS console. (Can I switch to OS console from qemu console?)

Also quitting from qemu console kills the guest. Is there way to just
detach leaving the guest running?

Also the CLI options given here [1] for graphics support do not work for
me when running an armv7 guest. vnc session comes up but hangs during the
boot. Instead of these options, if I just add a telnet monitor vnc session
works fine. Don't know the relation between the two, it looks strange to
me.

[1] http://wiki.netbsd.org/ports/evbarm/qemu_arm/


I am not sure if this is what you want, and I haven't tried it on an arm guest, but this is how I launch my NetBSD 9.0 x86_64 guest:

qemu-system-x86_64 \
-drive if=virtio,file=/home/oc/VM/img/netbsd.image,index=0,media=disk \
-M q35,accel=kvm -m 250M -cpu host -smp $(nproc) \
-nic user,hostfwd=tcp:127.0.0.1:5555-:22,model=virtio-net-pci,ipv6=off  \
-daemonize -display none  -vga none \
-serial mon:telnet:127.0.0.1:6665,server,nowait \
-pidfile /home/oc/VM/pid/netbsd-pid \

telnet 127.0.0.1 6665


When I telnet to port 6665, I get the OS serial console and I can switch to the qemu serial console by pressing CRTL-C CTRL-A. Killing the session doesn't kill the guest. This assumes you have installed the serial bootblocks. I'm not sure how this fits into the arm ecosystem, though.

There are also security implications. The qemu docs mention using unix domain sockets instead of telnet.


--
Ottavio Caruso

You may want to look at detachtty, although it looks like it's not currently
available in pkgsrc (it has been in the past).

Bruce
--
If this is not what you expected, please alter your expectations.
(Erik Naggum)



Home | Main Index | Thread Index | Old Index