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

car*_*rio 4 linux init-script tty runit

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

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

我对这个错误一无所知,你有什么想法吗

运行 agetty 的脚本是

#!/bin/sh
exec /sbin/agetty 38400 tty1 linux --noclear
Run Code Online (Sandbox Code Playgroud)

任何帮助都会很好。

小智 5

使用setsid如下。

#!/bin/sh
exec setsid /sbin/agetty 38400 tty1 linux --noclear
Run Code Online (Sandbox Code Playgroud)

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
[...]
Run Code Online (Sandbox Code Playgroud)

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