Cannot access KVM using virsh console after KVM rebooted or shut off

Daniel P. Berrangé berrange at redhat.com
Tue Nov 16 09:27:02 UTC 2021


On Mon, Nov 15, 2021 at 06:13:22PM -0500, Yifei Liu wrote:
> Dear all,
> 
> I used ssh with -X option to connect to an Ubuntu remote server where I applied virsh 
> (libvirt) to manage my KVM virtual machines, and my local machine is MacOS. Then, 
> I used virt-install to install a Tiny Core Linux VM, and I got a pop-up Virt Viewer window 
> (via XQuartz) which is the console for my Tiny Core VM. However, if I rebooted my VM, 
> then I checked the VM state by virsh list --all which was running. Then, I tried 
> `virsh console my_vm_domain` but this command got stuck on:
> > Connected to domain my_vm_domain
> > Escape character is ^]
> 
> The `virsh console` command hung without any response. This issue also happened when 
> I used virsh console after I shut down and later started the VM. Even the VM was already 
> started, I cannot return to the VM console by `virsh console`.

This isn't a hang, this is simply indicating that your guest OS is
not running anything on the serial console.  If you configure
the guest to launch a login prompt on the serial port, then
you'll see something on virsh console.

> I can get the VM console in Virt Viewer at the first boot (using virt-install). 
> But, if I shutdown the VM once, I can never access the VM console by virsh console even 
> the VM state is running. Any idea about how to use virsh console?

You're comparing two different things. Virt Viewer connects to the
*graphical* console exposed by the VGA card (or whatever graphics
devce is configure).  virsh console connect to the primary serial
port.

Most OS will only display on the graphical console by default and
require extra steps to activate the serial console.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvirt-users mailing list