Schlagwort-Archive: kvm

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).

get virsh shutdown working

There is a quite common problem with kvm and virsh shutdown which is likely not working with all virtual guests. In my case, I’m using Ubuntu 10.04 LTS and 12.04 LTS as host OS. All guests are working with ubuntu or debian, too.

If your guests are ignoring the virsh-shutdown command, check these indicators:

  • Enable ACPI in the guest configuration file
  • Install acpid on the guest
    # apt-get install acpid
  • Install acpi-support-base package
    # apt-get install acpi-support-base

Next time, I will show how to get the virsh console command working properly.

If you also want to get the virsh console command working properly read the article Get virsh console working.