1 查看系统是否支持串口:
[root@localhost ~]# dmesg |grep tty
console [tty0] enabled
serial8250: ttyS0 at I/O 0x3f8 (irq = 3) is a 16550A
serial8250: ttyS1 at I/O 0x2f8 (irq = 4) is a 16550A
00:09: ttyS0 at I/O 0x3f8 (irq = 3) is a 16550A
00:0a: ttyS1 at I/O 0x2f8 (irq = 4) is a 16550A
2 直接修改vi /etc/default/grub
vi /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap biosdevname=0 net.ifnames=0 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_TERMINAL="console serial"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0,115200"
3 更新grub:
Legacy模式
grub2-mkconfig -o /boot/grub2/grub.cfg
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-862.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-bcfdd64db72c4cce8e4ea8a33b2f64a3
Found initrd image: /boot/initramfs-0-rescue-bcfdd64db72c4cce8e4ea8a33b2f64a3.img
done
UEFI模式
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
4 重启 查看效果
reboot