尝试在基于 runit 的 Linux 安装中运行agetty 时出错

尝试在基于 runit 的 Linux 安装中运行agetty 时出错

我试图在基于 runit 的 linux 系统中运行agetty,但遇到以下问题

sh: cannot set terminal process group (136) Inappropriate ioctl for device
sh: no job control in this shell

我不知道这个错误,你有什么想法吗

运行agetty的脚本是

#!/bin/sh
exec /sbin/agetty 38400 tty1 linux --noclear

任何帮助都会很好。

答案1

使用setsid方法如下。

#!/bin/sh
exec setsid /sbin/agetty 38400 tty1 linux --noclear

包装setsid器将启动agetty 作为会话领导者(看到这个答案),允许它绑定到tty1.

您可以从以下示例中看到不同的行为ps

# ps xao pid,ppid,sid,tty,cmd
[...]
150 1   150 ?    runsvdir
154 150 155 ?    runsv agetty-3
157 154 157 tty3 -bash
152 150 152 ?    runsv agetty-4
156 152 152 ?    -bash
[...]

使用了该agetty-3服务setsid,而agetty-4没有使用该服务。因此,tty3 上的 shell 是会话领导者并绑定到其 tty。 tty4 上的 shell 与其主管处于同一会话中,并且未绑定(?在 tty 列中)。

相关内容