Re: s6-init script

From: Guillermo <gdiazhartusch_at_gmail.com>
Date: Wed, 27 Nov 2024 19:00:39 -0300

El mar, 26 nov 2024 a las 23:51, Laurent Bercot escribió:
>
> As Guillermo said, this is due to s6-linux-init and several components
> around it doing an elaborate dance with file descriptors, in order to
> have /dev/console be the absolute last resort for output, i.e. only
> appearing as the stdout and stderr for the catch-all logger, while
> everything else, including s6-svscan, sends all its output to the
> catch-all logger, *combined with* the 1 directive in the catch-all
> s6-log arguments that duplicates the data to its stdout, i.e.
> /dev/console.

For anyone curious, the result of the file descriptor manipulation:

=== s6-svscan (after redirections) ===

$ ps -p 1 -o pid,args
  PID COMMAND
    1 s6-svscan -X3 -- /run/service
# ls -l /proc/1/fd
total 0
lr-x------ 1 root root 64 Nov 27 18:32 0 -> /dev/null
l-wx------ 1 root root 64 Nov 27 18:32 1 -> /run/service/s6-svscan-log/fifo
l-wx------ 1 root root 64 Nov 27 18:32 2 -> /run/service/s6-svscan-log/fifo
l-wx------ 1 root root 64 Nov 27 18:32 3 -> /dev/console
l-wx------ 1 root root 64 Nov 27 18:32 4 -> /run/service/.s6-svscan/lock
lr-x------ 1 root root 64 Nov 27 18:32 5 -> /run/service/.s6-svscan/control
...
File descriptor 3 is the console holder. Note the -X option.

=== Normal s6-supervise processes ===

$ ps -p 110 -o pid,args
  PID COMMAND
  110 s6-supervise sddm-daemon
# ls -l /proc/110/fd
total 0
lr-x------ 1 root root 64 Nov 27 18:38 0 -> /dev/null
l-wx------ 1 root root 64 Nov 27 18:38 1 -> /run/service/s6-svscan-log/fifo
l-wx------ 1 root root 64 Nov 27 18:38 2 -> /run/service/s6-svscan-log/fifo
l-wx------ 1 root root 64 Nov 27 18:38 3 ->
/run/s6-rc:s6-rc-init:UURQWt/servicedirs/sddm-daemon/supervise/lock
lr-x------ 1 root root 64 Nov 27 18:38 4 ->
/run/s6-rc:s6-rc-init:UURQWt/servicedirs/sddm-daemon/supervise/control
...
=== Catch-all logger's s6-supervise process ===

$ ps -p 71 -o pid,args
  PID COMMAND
   71 s6-supervise s6-svscan-log
# ls -l /proc/71/fd
total 0
lr-x------ 1 root root 64 Nov 27 18:40 0 -> /dev/null
l-wx------ 1 root root 64 Nov 27 18:40 1 -> /run/service/s6-svscan-log/fifo
l-wx------ 1 root root 64 Nov 27 18:40 2 -> /dev/console
l-wx------ 1 root root 64 Nov 27 18:40 3 ->
/run/service/s6-svscan-log/supervise/lock
lr-x------ 1 root root 64 Nov 27 18:40 4 ->
/run/service/s6-svscan-log/supervise/control
...
Note the difference in standard error.

=== Catch-all logger ===

$ ps -p 72 -o pid,args
  PID COMMAND
   72 s6-log -bpd3 -- 1 t /run/uncaught-logs
# ls -l /proc/72/fd
total 0
lr-x------ 1 daemon daemon 64 Nov 27 18:42 0 -> /run/service/s6-svscan-log/fifo
l-wx------ 1 daemon daemon 64 Nov 27 18:42 1 -> /dev/console
l-wx------ 1 daemon daemon 64 Nov 27 18:42 2 -> /dev/console
l-wx------ 1 daemon daemon 64 Nov 27 18:42 4 -> /run/uncaught-logs/lock
l-wx------ 1 daemon daemon 64 Nov 27 18:42 5 -> /run/uncaught-logs/current
...
Note standard output and the '1' directive.

G.
Received on Wed Nov 27 2024 - 23:00:39 CET

This archive was generated by hypermail 2.4.0 : Wed Nov 27 2024 - 23:01:22 CET