CentOS 7: GRUB2 and Linux with serial console

Another method:

1.add the following line to the boot grub command line

console,console=tty0,115200n8

2.using the grubby command.


CentOS 7: GRUB2 and Linux with serial console


1/etc/default/grub

Change /etc/default/grub as below.

Change GRUB terminal to console and ttyS0. This will provide one GRUB to a monitor display and serial console.

Change linux kernel console to tty1 and ttyS0. ttyS0 will be managed by login prompt and tty1 will be managed by display manager like gdm.

$ diff -uprN /etc/default/grub{.org,}

--- /etc/default/grub.org      2016-06-06 18:15:52.523805194 +0900

+++ /etc/default/grub  2016-06-07 02:14:47.402552066 +0900

@@ -2,6 +2,8 @@ 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 rhgb quiet"

+GRUB_TERMINAL="console serial"

+GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"

+GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb"

+GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0,115200"

GRUB_DISABLE_RECOVERY="true"

2grub2-mkconfig

Update /boot/grub/grub.cfg with grub2-mkconfig.

$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg

Generating grub configuration file ...

Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64

Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img

Found linux image: /boot/vmlinuz-3.10.0-327.18.2.el7.x86_64

Found initrd image: /boot/initramfs-3.10.0-327.18.2.el7.x86_64.img

Found linux image: /boot/vmlinuz-3.10.0-327.10.1.el7.x86_64

Found initrd image: /boot/initramfs-3.10.0-327.10.1.el7.x86_64.img

Found linux image: /boot/vmlinuz-0-rescue-d3468c0a2b594d38be0918b5ae2a5ced

Found initrd image: /boot/initramfs-0-rescue-d3468c0a2b594d38be0918b5ae2a5ced.img

done

Reboot CentOS 7.

$ sudo reboot







https://www.hiroom2.com/2016/06/07/centos-7-grub2-and-linux-with-serial-console/

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 系统启动是一项非常复杂的程序,因为内核得先检测硬件并加载适当的驱动程序后,接下来则必须要调用程序来准备好系统运行的...
    Zhang21阅读 11,846评论 3 10
  • linux资料总章2.1 1.0写的不好抱歉 但是2.0已经改了很多 但是错误还是无法避免 以后资料会慢慢更新 大...
    数据革命阅读 12,253评论 2 33
  • Linux-Server-Notes PMS /home/softwareluke/图片/2017-09-11 0...
    燕京博士阅读 602评论 0 1
  • 黄牛是一种不可忽视的商业现象,他之所以能存在,是因为无论我们怎么去精心设计,一切商业规则的背后,都是可能有其漏洞或...
    生活建筑师阅读 311评论 0 1
  • #私设如山# 当你天真地认为,黑暗的尽头是光明。只有你真正地穿越了绝望的终点,你才会发现,黑暗的尽头,没有曙光,没...
    沈夲君阅读 671评论 0 3