for ubuntu xenial
sudo systemctl enable serial-getty@ttyS0.service
sudo systemctl start serial-getty@ttyS0.service
for centos7
添加ttyS0的安全許可埠忘,允許root登錄
echo ttyS0 >> /etc/securetty
在 /etc/grub.conf 文件中在 kernel 后面添加參數(shù)
console=ttyS0
在 /etc/inittab 中添加 agetty
echo "S0:12345:respawn:/sbin/agetty ttyS0 115200" >> /etc/inittab