I. Problem description:
The KVM host cannot connect to the client through the console, and it does not move here.
# virsh console vm01Connected to domain vm01Escape character is ^]
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 1 # grub.conf generated by anaconda 2# 3# Note that you do not have to rerun grub after making changes to this file 4# NOTICE: You have a /boot partition. This means that 5# all kernel and initrd paths are relative to /boot/, eg. 6# root (hd0,0) 7# kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root 8# initrd /initrd-[generic-]version.img 9#boot=/dev/vda 10default=0 11timeout=5 12splashimage=(hd0,0)/grub/splash.xpm.gz 13hiddenmenu 14title Red Hat Enterprise Linux (2.6.32-431.el6.x86_64) 15root (hd0,0) 16kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet console=ttyS0 17initrd /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 vm01Connected to domain vm01Escape character is ^]Red Hat Enterprise Linux Server release 6.5 (Santiago)Kernel 2.6.32-431.el6.x86_64 on an x86_64vm01 login: rootPassword: Last login: Sun Oct 12 00:11:47 on tty1[[email protected] ~]#
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.
In the special file directory/dev/of a Linux system device, there are generally the following types of special device files on the terminal:
1. Serial Port Terminal (/dev/ttysn)
The serial port terminal (serial port terminal) is a terminal device connected by a computer serial port. The computer regards each serial port as a character device. For some time, these serial port devices are usually called terminal devices, because at that time they were used to connect terminals. The device names corresponding to these serial ports are/dev/TTS/0 (or/dev/ttys0),/dev/TTS/1 (or/dev/ttys1), etc, the device numbers are (), (), and so on, respectively, corresponding to COM1 and com2 in the DOS system. To send data to a port, You can redirect the standard output to these special file names on the command line. For example, if you type echo test>/dev/ttys1 at the command line prompt, the word "test" is sent to the device connected to the ttys1 (com2) port.
2. Pseudo Terminal (/dev/PtY /)
The Pseudo Terminal is a pair of logical terminal devices (namely, the master and slave devices, and the operations on the master will be reflected on the slave ).
For example,/dev/ptyp3 and/dev/ttyp3 (or/dev/PtY/m3 and/dev/PtY/S3 in the device file system ). They are not directly related to physical devices. If a program regards ptyp3 (master device) as a serial port device, the read/write operations on the port are reflected in another ttyp3 (Slave Device) corresponding to the logical terminal device. Ttyp3 is the logical device used by another program for read/write operations. Telnet host a communicates with the logon program of host a through a Pseudo Terminal.
3. control terminal (/dev/tty)
If the current process has a control terminal (controlling terminal),/dev/tty is the device special file of the control terminal of the current process. You can run the "PS-Ax" command to check which control terminal the process is connected. For the shell you log on to,/dev/tty is the terminal you are using, and the device number is (5, 0 ). Run the "tty" command to check which actual terminal device it corresponds. /Dev/tty is similar to a connection to the actually used terminal device.
4. Console terminal (/dev/ttyn,/dev/console)
In Linux, a computer monitor is usually called a console ). It simulates a Linux terminal (term = Linux), and some special files of the device are associated with it: tty0, tty1, tty2, and so on. When you log on to the console, tty1 is used. With Alt + [F1-F6] keys, we can switch to tty2, tty3 and so on. Tty1-tty6 is called virtual terminal, and tty0 is an alias of the current virtual terminal, the information generated by the system will be sent to the terminal (also called the console terminal ). Therefore, no matter which virtual terminal is being used, the system information will be sent to the console terminal. /Dev/console refers to the console, which is a device that interacts with the operating system. The system directly outputs some information to the console. Currently, users can log on to the console only in single-user mode.
5 virtual terminal (/dev/pts/N)
A Pseudo Terminal in xwindows mode. For example, if I use konsole in kubuntu, It is a virtual terminal. Run the TTY command to view/dev/pts/1.
6 Other Types
In Linux, there are many other types of special files on terminal devices for many different character devices. For example,/dev/ttyin terminal devices for ISDN devices. I will not go into details here.
Tty devices include virtual consoles, serial ports, and Pseudo Terminal devices.
/Dev/tty indicates the current tty device. Input echo "Hello">/dev/tty in the current terminal, which will be directly displayed on the current terminal.
This article from the "one promise thousands of gold" blog, please be sure to keep this source http://yinuoqianjin.blog.51cto.com/8360868/1562588
Solve the problem that the KVM host cannot connect to the client through the console