- virtual BIOS
- GRUB2
- Linux kernel
- Login
virt-manager is a GUI tool so it is able to connect the virtual machines' video card. It's actually the real ouput of tty0.
1. virtual BIOS's ouput
Currently, the virtual BIOS doesn't have the ability to output to a serial port. So virsh cannot handle it.2. GRUB2's output
GRUB2 can output to both video card and serial port. So both virsh and virt-manager can connect to it.$ cat /etc/default/grub
GRUB_TERMIAL="serial console"
3. Linux kernel's output/Login output
GRUB2 eventually load Linux kernel which supports outputting to different ttys, including:- tty0,tty1,tty2,... , which are back ended by local video card/keyboard, so virt-manager can connect to them.
- ttyS0, ttyS1, ..., which are virtual real serial port, so virt-sh can connect.
$ cat /etc/default/grubGRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"
4. example
[root@server2 ~]# cat /etc/default/grubGRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL="serial console"
GRUB_SERIAL_COMMAND="serial --speed=115200"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap console=tty0 console=ttyS0,115200n8"
GRUB_DISABLE_RECOVERY="true"
[root@server2 ~]# grub2-mkconfig > /boot/grub2/grub.cfg
5. More about virt-manager
virt-manager actually can connect to both vm's video card and serial port.virt-manager use serial port to connect to vm only when no Display spice device exists.
For one serial port, virt-manager and virsh cannot connect to it at the same time.
virsh # console DNSServer
Connected to domain DNSServer
Escape character is ^]
error: operation failed: Active console session exists for this domain
So it's better for virt-manager to use "Display Spice" while for virsh to use serial port.
No comments:
Post a Comment