Centos serial-console

De SLM - MediaWiki

Retour

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

Modifiez /etc/default/grub comme ci-dessous.

Changez le terminal GRUB en console et ttyS0. Cela fournira un GRUB à un écran de moniteur et à une console série. Changez la console du noyau Linux en tty1 et ttyS0. ttyS0 sera géré par l'invite de connexion et tty1 sera géré par le gestionnaire d'affichage comme 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"

Mettez à jour /boot/grub/grub.cfg avec grub2-mkconfig

$ 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

Redémarrez CentOS 7.

reboot