get virsh console working

In my last blog post I described how you can shut down your virtual machines with the virsh shutdown command under Debian and Ubuntu. Now I want to show you how virsh console can be used to access the serial console for login and watching the virtual machine’s shutdown and startup.

Step 1A: Preparing an Ubuntu Guest VM

  1. login on the ubuntu vm with ssh
  2. Copy tty1.conf to ttyS0.conf:
    sudo cp /etc/init/tty1.conf /etc/init/ttyS0.conf
  3. open ttyS0 and change the last line to
    exec /sbin/getty -8 115200 ttyS0 xterm

Step 1B: Preparing a Debian Guest VM

  1. login on the ubuntu VM with ssh
  2. open /etc/inittab
  3. uncomment the following line:
    T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100

Step 2: Make Grub output on ttyS0 (Debian & Ubuntu VM)

  1. open /etc/default/grub
  3. save & close the file and update grub with
    # update-grub
  4. reboot the virtual machine

On the host you can now access the serial console with virsh console vm1.

To get back to the host use ctrl + ]. An opened session will not be closed so you have to logout explicitly (like if you were right in front of the machine).

2 Gedanken zu „get virsh console working

  1. Pingback: get virsh shutdown working |

  2. Pingback: Trouble Logging into Virtual Console on Virtual Server | The Muddling Tech

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Time limit is exhausted. Please reload the CAPTCHA.