≡ Menu

KVM Virsh: Redirect FreeBSD Console To A Serial Port

I'm using KVM to run multiple virtual machines under Redhat Enterprise Linux server 5.5. I've installed FreeBSD 7.x 64 bit as guest operating systems. How do I redirect the FreeBSD version 6, 7 or 8 virtual machine console to a serial port using virsh console command for management purpose from host itself?

FreeBSD does support a dumb terminal on a serial port as a console. This is useful for quick login or debug guest system problem without using ssh. First, login as root using ssh to your guest operating systems:
$ ssh vivek@freebsd.nixcraft.in
su -

Edit /boot/loader.conf, enter:
# vi /boot/loader.conf
Append the following entry:
Save and close the file. Edit /etc/ttys, enter:
# vi /etc/ttys
Find the line that read as follows:

ttyd0  "/usr/libexec/getty std.9600"   dialup  off secure

Update it as follows:

ttyd0   "/usr/libexec/getty std.9600"   vt100   on secure

Save and close the file. Reboot the guest, enter:
# reboot
After reboot, you can connect to FreeBSD guest as follows from host (first guest the list of running guest operating systems):
# virsh list
Sample outputs:

 Id Name                 State
  3 ographics            running
  4 freebsd              running

Now, connect to Freebsd guest, enter:
virsh console 4
virsh console freebsd
Sample outputs:

Fig.01: Virsh console connected to FreeBSD guest

Fig.01: Virsh console connected to FreeBSD guest


{ 2 comments… add one }

  • G June 14, 2012, 11:29 am

    I think you have a typo: ttyd0 had to be ttyu0 for me to get this working.
    I just found it in the reference link you posted :)


  • daya March 4, 2014, 2:00 pm

    Hi ,

    Guest VM installation done using below command on RH6.4

    [root@ramlo ~]# virt-install --connect qemu:///system -n vm10 -r 1024 --vcpus=4 --disk path=/var/lib/libvirt/images/vm10.img,size=15 -c /home/ISO/ubuntu-12.04-server-i386.iso --vnc --noautoconsole --os-type linux --os-variant ubuntu --accelerate --network=bridge:br0 --hvm

    I am unable to connect guest OS …

    [root@ramlo ~]# virsh --connect qemu:///system
    Welcome to virsh, the virtualization interactive terminal.
    Type:  'help' for help with commands
           'quit' to quit
    virsh # list
     Id    Name                           State
     1     vm10                           running
    virsh # exit
    [root@ramlo ~]# virsh console vm10
    Connected to domain vm10
    Escape character is ^]



Leave a Comment

   Tagged with: , , , , , , , , , , , , , , ,