Virsh console not working – Here is how we fix it
Are you looking why virsh serial console is not working? We can help you to fix it.
Usually, this error shows up when there is no serial console configured.
At Bobcares, we often get requests to fix virsh errors, as a part of our Server Management Services.
Today, let’s see how our Support Engineers configure serial console and fix this error.
Virsh is a tool that enables us to manage virsh guest domains. It allows us to create pause and shutdown domains.
Even though virsh is a command-line tool, it has a virtual serial console. And we can access it using the command,
virsh console <domain> [--devname devicename] [--force] [--safe]
--devname parameter allows users to access an already configured alternative console.
If we use the
--safe option, then it allows a safe console handling.
And we can use the
--force option in case of any broken connection. This disconnects the existing sessions.
But sometimes the connection with the serial console fails. And the below error message appears as,
This error message clearly specifies that there is some error in the configured serial console. Let’s see how our Support Engineers make it work again.
How we make the virsh serial console working?
Initially, we check the XML of the domain’s serial console. If there is some error we add the correct XML code in domain’s XML. For this, we use virsh edit. Here we add the code which appears as,
<serial type='pty'> <target port='0'/> </serial> <console type='pty'> <target type='serial' port='0'/> </console>
Then to set up the serial console in guest kernel command-line, our Support Engineers login to the guest.
And we edit the /boot/grub/grub.conf. We can edit it directly or use virt-edit tool and append the following
ttyS0 is the serial port in Linux.
Later we start VM using virsh. Now we can access the virsh console without fail.
[Need assistance in fixing virsh errors? – We are available 24/7.]
So far we saw why the virsh console is not working. The error indicates that the serial console is not configured. Today we saw how our Support Engineers edit the domain’s XML code to fix the error.