Solve the problem that the KVM host cannot connect to the client through the console
I. Problem description:
The KVM host cannot connect to the client through the console, and it does not move here.
# Virsh console vm01
Connected to domain vm01
Escape character is ^]
Add virsh console support for KVM clients
Ii. Solution: Use vnc or host desktop to enter the client vm01 and add Parameters
1. Add a security license for ttyS0 to allow root login:
# Echo "ttyS0">/etc/securetty
2. Add parameters to the kernel in the/etc/grub. conf file:
Console = ttyS0
Note:
Console = ttyS0 must be placed in the kernel line (about 16th rows). It cannot be a single line. That is, console = ttyS0 is a parameter of the kernel, not a separate line, as shown in the following figure (pull the progress bar to the right, at the end ):
# Cat-n/etc/grub. conf
# Grub. conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a/boot partition. This means that
# All kernel and initrd paths are relative to/boot/, eg.
# Root (hd0, 0)
# Kernel/vmlinuz-version ro root =/dev/mapper/VolGroup-lv_root
# Initrd/initrd-[generic-] version. img
# Boot =/dev/vda
Default = 0
Timeout = 5
Splashimage = (hd0, 0)/grub/splash.xpm.gz
Hiddenmenu
Title Red Hat Enterprise Linux (2.6.32-431. el6.x86 _ 64)
Root (hd0, 0)
Kernel/vmlinuz-2.6.32-431.el6.x86_64 ro root =/dev/mapper/VolGroup-lv_root kernel LANG = en_US.UTF-8 rd_NO_MD kernel = VolGroup/lv_swap SYSFONT = latarcyrheb-sun16 crashkernel = auto kernel = VolGroup/lv_root KEYBOARDTYPE = pc KEYTABLE = us rd_NO_DM rhgb quiet console = ttyS0
Initrd/initramfs-2.6.32-431.el6.x86_64.img
3. Add agetty in the/etc/inittab:
S0: 12345: respawn:/sbin/agetty ttyS0 115200
4. Restart the client:
# Reboot
Iii. Problem Solving
# Virsh console vm01
Connected to domain vm01
Escape character is ^]
Red Hat Enterprise Linux Server release 6.5 (Santiago)
Kernel 2.6.32-431. el6.x86 _ 64 on an x86_64
Vm01 login: root
Password:
Last login: Sun Oct 12 00:11:47 on tty1
[Root @ vm01 ~] #
Appendix: summary of the basic concepts of terminals:
Tty (collectively referred to as the terminal device ):
Tty is derived from Teletypes or teletypewriters. Originally, it refers to a telex typewriter, which reads and sends messages through a printer keyboard through a serial line. Later, it was replaced by a keyboard and a display, so now it is more appropriate to call the terminal.
A terminal is a type of terminal device. It has multiple types and generally uses tty for short.
Pty (Pseudo Terminal, virtual terminal ):
But if we remotely telnet to the host or use xterm, do we still need a terminal to interact? Yes, this is the virtual terminal pty (pseudo-tty)
Pts/ptmx (combining pts/ptmx to implement pty ):
Pts (pseudo-terminal slave) is the implementation method of pty. It is used with ptmx (pseudo-terminal master) to implement pty.
For more details, please continue to read the highlights on the next page: