VirtualBox使用串口

配置

端口模式选择主机管道

如果路径不存在,不要勾选连接至现有通道或套接字

连接

串口名使用和主机管道同样的名字

debian使能串口登录

debian需要另外开启服务,和设置开机启动串口

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# vim /etc/default/grub

# GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX_DEFAULT="quiet console=tty0 console=ttyS0,115200n8"


# 更新 GRUB 配置
update-grub

# 提供在 ttyS0 串口上的登录 shell 的systemd服务
systemctl start serial-getty@ttyS0
systemctl enable serial-getty@ttyS0
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
root@debian-9:~# dmesg | grep tty
[    0.000000] console [tty0] enabled
[    0.700084] 00:02: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
root@debian-9:~# systemctl start serial-getty@ttyS0
root@debian-9:~# systemctl status serial-getty@ttyS0
[email protected] - Serial Getty on ttyS0
   Loaded: loaded (/lib/systemd/system/[email protected]; disabled; vendor preset: enabled)
   Active: active (running) since Thu 2024-07-25 14:52:28 CST; 13s ago
     Docs: man:agetty(8)
           man:systemd-getty-generator(8)
           http://0pointer.de/blog/projects/serial-console.html
 Main PID: 829 (agetty)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/system-serial\x2dgetty.slice/[email protected]
           └─829 /sbin/agetty --keep-baud 115200,38400,9600 ttyS0 vt220

Jul 25 14:52:28 debian-9 systemd[1]: Started Serial Getty on ttyS0.
使用 Hugo 构建
主题 StackJimmy 设计