Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Perhaps I'm misunderstanding what KVM is capable of, but the ability to add/remove hardware on the VM seems to imply I can add a serial port that then acts as a terminal.

So, my questions are:

  1. Which settings are best for the guest FreeBSD distribution? (There are many!)
  2. How do I access said terminal from my Linux host?
share|improve this question
1  
Well, once you figure this out it will answer my question at ubuntu.stackexchange.com/questions/1733/… . –  Stefan Lasiewski Aug 12 '10 at 3:41
add comment

3 Answers 3

up vote 3 down vote accepted

I can now answer my own question based on Stefan's comment and the two linked articles:

Here is the solution:

  • You need not edit anything to do with the host configuration provided it has the default serial device pointing to pty in there.
  • Ensure the boot parameter for your kernel has this appended: serial=tty0 console=ttyS0,115200n8. Usually achieved by editing /boot/grub/menu.lst
  • Configure /etc/inittab and append the line T0:S12345:respawn:/sbin/getty -hL ttyS0 115200 vt100 to launch a getty and give you the login prompt.

I can confirm this works for me using a fedora system (albeit I did have to set enforcing=0 as an additional parameter because the system in question is fedora rawhide running SELinux MLS).

I think from there I can probably work out how to do the same for freebsd.

Thanks Stefan!

share|improve this answer
    
I think serial=tty0 is a mistake and was meant to be console=tty0. I don't see a "serial" parameter in any of the kernel docs. Specifying multiple consoles (in this case, the active virtual console plus the serial console) makes sense to me, though. –  mattdm Jun 27 '13 at 12:59
add comment

In answer to how to set up your FreeBSD machine, there are two main cases for getting serial. If you are installing FreeBSD with serial only, the bootloader serial instructions will be needed. If you already have a console and are just wanting to have serial access as well, then follow the post-install serial instructions.

Bootloader serial

  • Press 2 at FreeBSD boot option screen to escape to loader prompt
  • type set console=comconsole
    • if you loose interactivity at this point, check to see if the virtual tty baud rate is 9600
  • type autoboot

This should allow for the rest of the installation to be done over the serial interface. If you want to continue having serial access after FreeBSD is installed, then before you reboot at the end of the installation you will want to drop to the command prompt.

Post-install serial

At the console:

  • type echo 'console="comconsole"' >> /boot/loader.conf
  • load /etc/ttys in vi
  • Modify the line starting with ttyu0 (might be ttyd0 on other versions of FreeBSD)
    • On that line change dialup to vt100 and off to on
  • after the reboot, the serial terminal should show the boot process, and end with a login prompt
    • Note: setting console="comconsole" in /boot/loader.conf could make the boot messages appear on the serial interface only. Just modify /etc/ttys if you don't want the boot log over serial.

References

http://www.freebsd.org/doc/handbook/serialconsole-setup.html

http://www.freebsd.org/doc/handbook/term.html

share|improve this answer
add comment

Well, you have to emulate a serial port within the emulator of course and have that be accessible on the host. The guest OS should put something on its 'hardware serial port' like a login prompt via e.g., getty_ps. Now I personally haven't had to use it this way. Mostly the emulated serial port on the guest OS is used for debugging information (Haiku still uses that by default) and then it is captured by the emulator (like VMware) as a simple text-file to have the debug information available.. I'll try here to get something running on the emulated serial console within qemu.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.