Score:1

Virsh console for Windows 10 VM (QEMU-KVM)

ca flag

I'm trying to access a Windows 10 virtual machine from my Linux host by using virsh console.

But when I do so, I get the empty console that many others have experienced.

virsh console win10
Connected to domain 'win10'
Escape character is ^] (Ctrl + ])

And I can't type at all. Anyway, is there a configuration that I can do in the VM to allow this, specifically for Windows? Thanks

Score:3
za flag

virsh console is a TTY console, which is the uart in the VM (a.k.a. "the COM port"). Does your Windows 10 output anything into this COM port?

Windows expects a VGA hardware to output into, so configure a VNC for the VM and connect with VNC Viewer for interacting with the VM. For this to be possible, you'd configure in the libvirt xml domain config something like this:

    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5901' autoport='no'/>
    <video>
      <model type='cirrus' vram='5120' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>

(it is possible you'd need to use another PCI slot address and TCP port for VNC to this machine).

Then restart (stop then start) a VM, and confirm qemu is listening on the chosen port:

vh1 ~ # netstat -lnpt | grep 590
tcp        0      0 127.0.0.1:5900          0.0.0.0:*               LISTEN      1774/qemu-system-x8 
tcp        0      0 127.0.0.1:5901          0.0.0.0:*               LISTEN      13692/qemu-system-x 
tcp        0      0 127.0.0.1:5902          0.0.0.0:*               LISTEN      2526/qemu-system-x8 
tcp        0      0 127.0.0.1:5903          0.0.0.0:*               LISTEN      3755/qemu-system-x8 

Notice, in my case it listens on localhost, for security.

To connect to this via SSH tunnel, use a TCP port forwarding. It is built into standard Linux VNC client package:

vncviewer -via virtualization.host.name localhost:1

(for connecting to the 5901's VNC you use VNC screen 1). It'll connect via SSH to the virtualization.host.name and forward some local port to the localhost:5901 of the server, right as we need; then connects VNC client to this forwarded port. So your VNC will be secured with SSH.

Or, you can listen on any IP address (less secure). Or you can set up this TCP tunnel some other way. But this way I presented here is more convenient. Or, I forgot about that, use virt-viewer to connect to the screen, didn't used it for ages.

Also, Windows Server supports (at least, supported some time ago) a special administration console (SAC) that runs on the COM port and can be used to do some operations (task kill, etc.). This console can be accessed with virsh console. But I doubt Windows 10 has that.

tymur999 avatar
ca flag
Can I connect to VNC if I have a console-only server?
tymur999 avatar
ca flag
Also, I'm trying to add an output to the COM port with this command `bootcfg /EMS /PORT com1 /BAUD 115200 /ID 1`, but it's throwing a syntax error and saying that a "default argument is missing". Do you know what's wrong with this command?
Nikita Kipriyanov avatar
za flag
No, I don't know much about Windows. However, I don't know what's the problem with VNC; you'd connect to the VM screen, for which the *emulator* (Qemu) provides a VNC interface. I updated the answer on how to configure `libvirt` to allow this connection.
tymur999 avatar
ca flag
In the end I ended up using VNC and connecting from a remote PC. Thanks for the suggestion!
Score:2
cz flag

virsh console opens the VM's serial console, if it has one. If not, as in the case of Windows generally, then nothing happens.

You should be using virt-viewer to view VMs with graphical consoles, or better yet, the well integrated virt-manager.

tymur999 avatar
ca flag
Sorry, but I have a console server, so I can't use any graphical tools on it
Nikita Kipriyanov avatar
za flag
@tymur999 virt-manager can work over SSH tunnel, so you may run in on the local PC and manage a remote headless server
Michael Hampton avatar
cz flag
@tymur999 Yes, use virt-manager with an ssh tunnel to your remote server. It's quite surprising that you aren't already doing so.
tymur999 avatar
ca flag
Sorry, I didn't know that existed. But it's great! I'm using it now
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.