
저는 항상 그래픽 인터페이스 없이 텍스트 + 콘솔을 사용하기 시작했습니다. 여기에는 로그인이 포함됩니다. 이는 로그인 시 일부 동기화를 수행하기 때문에 특히 tty1
파일을 통해 다음을 수행하는 자동 로그인 스크립트가 있는 경우 텍스트일 뿐입니다 ./etc/systemd/system/[email protected]/override.conf
/usr/sbin/agetty --autologin <myusername> --noclear %I 38400 linux
방금 Fedora 36(35에서)으로 업그레이드했는데 마지막 단계까지 부팅이 원활했습니다. 텍스트 로그인 프롬프트를 표시하는 대신 왼쪽 상단에 밑줄이 있는 검은색 화면이 표시됩니다.
왜?
systemctl
빨간색 선을 제외하고 명령은 정상적으로 실행됩니다.
● [email protected] loaded failed failed Getty on tty1
로그에서 다음과 같은 오류를 볼 수 있습니다.
agetty[4565]: /dev/tty1: "cannot get controlling tty: Operation not permitted"
agetty[4565]: setting terminal attributes failed: Input/output error
루트로 로그인하려고 할 때마다 콘솔에 이 오류가 표시됩니다.
service [email protected] start
무엇이 잘못되었는지는 모르겠지만 agetty 명령이 변경된 것 같습니다.
편집하다:
다음 줄을 입력하면 :
ExecStart=-/usr/sbin/agetty --autologin <myusername> --noclear tty1 38400 linux
파일에서 자동 로그인이 유효합니다. 그러나 내가 다음으로 변경하면/etc/systemd/system/[email protected]/override.conf
ExecStart=-/home/<myusername>/bin/myautologinscript.sh
같은 라인에서는 그렇지 않습니다!
답변1
cannot get controlling tty: Operation not permitted
이 오류는 터미널 장치가 세션에 대한 제어 터미널이 되지 못한 경우 반환됩니다 .agetty
agetty
TIOCSCTTY
ioctl()
agetty
ioctl()
터미널이 현재 어떤 세션도 제어하지 않거나 pid가 아닌 ID로 세션을 제어하는 경우 agetty
문제가 발생합니다 .
tty_ioctl(2)
매뉴얼 페이지 에서 :
TIOCSCTTY Argument: int arg Make the given terminal the controlling terminal of the calling process. The calling process must be a session leader and not have a controlling terminal already. For this case, arg should be specified as zero. If this terminal is already the controlling terminal of a dif‐ ferent session group, then the ioctl fails with EPERM, unless the caller has the CAP_SYS_ADMIN capability and arg equals 1, in which case the terminal is stolen, and all processes that had it as controlling terminal lose it.
agetty
따라서 세션 리더가 아니면 작동하지 않습니다.
agetty
직접 실행 하는 대신 하위 프로세스에서 실행되는 스크립트를 시작하면 agetty
셸이 세션 리더가 되지만 agetty
그렇지는 않습니다.
using은 exec agetty
쉘과 동일한 프로세스에서 실행되고 agetty
(쉘을 대체함) agetty
세션 리더가 됩니다.
이것이 이전 버전의 Fedora에서 동일한 방식으로 작동했다면 제 생각에는 플래그 없이 호출하여 systemd
터미널 장치를 세션의 제어 터미널로 만들었을 것입니다 . 하지만 그럼에도 불구하고 회의 진행자가 아닌 것은 나쁜 생각처럼 들립니다.open()
O_NOCTTY
agetty
(이 경우 제어된 세션은 여전히 agetty
pid와 일치하지 않으므로 여전히 를 내보내려고 시도합니다 TIOCSCTTY
. 지금은 다른 설명이 없습니다.)