テキストコンソールなしでテキストを開始する:Fedora 36のagettyの問題

テキストコンソールなしでテキストを開始する:Fedora 36のagettyの問題

私はいつもグラフィカルインターフェイスなしでテキスト+コンソールを使い始めました。これにはログインが含まれます。これはログイン時にいくつかの同期を実行するため、特にファイルを介して以下を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

rootとしてログインしようとするたびに、コンソールにこのエラーが表示されます。

 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このエラーは、端末デバイスがセッションの制御端末になっていない場合に返されます。agettyagettyTIOCSCTTY 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_NOCTTYagetty

(この場合、制御されたセッションはまだagettypidと一致しないため、まだエクスポートしようとしますTIOCSCTTY。現在、他の説明はありません。)

おすすめ記事