Cannot connect QEMU guest os with vncviewer

The question is as follows.

harry@debian:~/workshop1/qemu_test/version1/test$ qemu-system-x86_64 -hda qcow2.img -cdrom domU-x86_64-FS.img -boot d -m 1024
VNC server running on `::1:5900'

harry@debian:~/workshop1/qemu_test/version1/test$ vncviewer 127.0.0.1:1
vncviewer: ConnectToTcpAddr: connect: Connection refused
Unable to connect to VNC server

Solution (add -vnc parameter for qemu-system-x86_64):

harry@debian:~/workshop1/qemu_test/version1/test$ qemu-system-x86_64 -hda qcow2.img -cdrom domU-x86_64-FS.img -boot d -m 1024 -vnc 127.0.0.1:2

harry@debian:~/workshop1/qemu_test/version1/test$ vncviewer 127.0.0.1:2
Connected to RFB server, using protocol version 3.8
No authentication needed
Authentication successful
Desktop name "QEMU"
VNC server default format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Using default colormap which is TrueColor.  Pixel format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Same machine: preferring raw encoding

-vnc display[,option[,option[,…]]]

Normally, QEMU uses SDL to display the VGA output. With this option, you can have QEMU listen on VNC display display and redirect the VGA display over the VNC session.

https://www.systutorials.com/docs/linux/man/1-qemu/

I guess this is the reason.

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *