FreeBSD – virsh serial howto
Goal is to setup FreeBSD so you can connect to virtual serial port for login
- Add serials to KVM instance. Use Virtual Manager
- one is usually the default – you can add up to 3 more.
- In the virtual FreeBSD machine, edit the /etc/ttys
- Change the 3wire/ ttyu0 to std.9600.
- Secure means root can login
ttyu0 "/usr/libexec/getty std.9600" vt100 on secure ttyu1 "/usr/libexec/getty std.9600" vt100 on secure #ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure
3. login via virsh. Note that you can obviously have only one login per serial
Welcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh # list
Id Name State
-----------------------------
3 freebsd12.3 running
5 rhel8.4 running
virsh # console freebsd12.3 --devname serial1 --safe
Connected to domain 'freebsd12.3'
Escape character is ^] (Ctrl + ])
error: operation failed: Active console session exists for this domain
virsh # console freebsd12.3 --devname serial0 --safe
Connected to domain 'freebsd12.3'
Escape character is ^] (Ctrl + ])
FreeBSD/amd64 (freebsd12_3) (ttyu0)
login:
To get rid of login prompt, press control-] ( “<ctrl> + “]” ). This will bring you back to the virsh prompt.
