Are you trying to redirect FreeBSD Console To A Serial Port?
This guide is for you.
We use KVM to run multiple virtual machines under Redhat Enterprise Linux.
FreeBSD is an operating system for a variety of platforms that focuses on features, speed, and stability.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers who use KVM for assistance regarding the redirection of FreeBSD console to a serial port.
In this context, you will see how to redirect FreeBSD version 6, 7, or 8 virtual machine console to a serial port using virsh console command for management purpose from the host itself.
The below steps are followed by our Support Experts for this redirection using virsh.
1. First, we need to log in as root using ssh to guest operating systems.
We can use the following command:
$ ssh ibmimedia@freebsd.ibmimedia.com
su –
2. After that we need to edit /boot/loader.conf.
# vi /boot/loader.conf
Append the following entry:
console="comconsole"
We can save and exit the file.
3. Then edit /etc/ttys as given below:
# vi /etc/ttys
We need to replace the below line:
ttyd0 "/usr/libexec/getty std.9600" dialup off secure
With the following line:
ttyd0 "/usr/libexec/getty std.9600" vt100 on secure
Now, we can save and exit the file.
4. To reboot the guest we can use the following command:
# reboot
After reboot, we can connect to FreeBSD guest as follows from the host.
We will first list the running guest operating systems using the following command:
# virsh list
Id Name State
———————————-
3 ographics running
4 freebsd running
Once the list gets displayed we can choose FreeBSD from it.
5. Finally, we can connect to Freebsd guest using either of the following commands:
virsh console 4
OR
virsh console freebsd
This article covers how to redirect FreeBSD in KVM to the serial port.
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.
1. First, login as root using ssh to your guest operating systems:
$ ssh ibmimedia@freebsd.ibmimedia.com
su -
2. Edit /boot/loader.conf, enter:
# vi /boot/loader.conf
3. Append the following entry:
console="comconsole"
4. Save and close the file. Edit /etc/ttys, enter:
# vi /etc/ttys
5. Find the line that read as follows:
ttyd0 "/usr/libexec/getty std.9600" dialup off secure
6. Update it as follows:
ttyd0 "/usr/libexec/getty std.9600" vt100 on secure
7. Save and close the file. Reboot the guest, enter:
# reboot
8. 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
9. Now, connect to Freebsd guest, enter:
virsh console 4
OR
virsh console freebsd