-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Closed
Labels
area/runtimeRuntimeRuntimeexp/expertkind/enhancementEnhancements are not bugs or new features but can improve usability or performance.Enhancements are not bugs or new features but can improve usability or performance.
Description
I'm trying to run sysvinit in docker, although it basically works, sysvinit's output disappears.
The command below is to reproduce the issue, seems STDIN/STDOUT/STDERR are dup-ed
file descriptors to the file descriptor of pseudo tty slave /dev/console, when STDIN/STDOUT/STDERR
are closed, no more reference to the opened pseudo tty slave /dev/console, thus /dev/console
is closed. Thus I can't find logs of /sbin/init on my terminal emulator and "docker logs".
Nothing outputs after STDIN/STDOUT/STDERR are closed:
$ docker run --rm -t debian:jessie perl -le \
'close(STDIN); close (STDOUT); close(STDERR); system("ls -l /dev /proc/1/fd >/dev/console")'
Have output when at least one of STDIN/STDOUT/STDERR isn't closed:
$ docker run --rm -t debian:jessie perl -le \
'close (STDERR); close(STDOUT); system("ls -l /dev /proc/1/fd >/dev/console")'
/dev:
total 0
crw------- 1 root root 136, 2 Nov 17 20:00 console
lrwxrwxrwx 1 root root 13 Nov 17 20:00 fd -> /proc/self/fd
crw-rw-rw- 1 root root 1, 7 Nov 17 20:00 full
c--------- 1 root root 10, 229 Nov 17 20:00 fuse
lrwxrwxrwx 1 root root 11 Nov 17 20:00 kcore -> /proc/kcore
crw-rw-rw- 1 root root 1, 3 Nov 17 20:00 null
lrwxrwxrwx 1 root root 8 Nov 17 20:00 ptmx -> pts/ptmx
drwxr-xr-x 2 root root 0 Nov 17 20:00 pts
crw-rw-rw- 1 root root 1, 8 Nov 17 20:00 random
drwxrwxrwt 2 root root 40 Nov 17 20:00 shm
lrwxrwxrwx 1 root root 15 Nov 17 20:00 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Nov 17 20:00 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Nov 17 20:00 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root root 5, 0 Nov 17 20:00 tty
crw-rw-rw- 1 root root 1, 9 Nov 17 20:00 urandom
crw-rw-rw- 1 root root 1, 5 Nov 17 20:00 zero
/proc/1/fd:
total 0
lrwx------ 1 root root 64 Nov 17 20:00 0
lr-x------ 1 root root 64 Nov 17 20:00 1
Not quite sure what the "0 -> /2" below means, maybe procfs says it's a symlink to device (136, 2), aka the /dev/console.
$ docker run --rm -t debian:jessie ls -l /dev /proc/1/fd
/dev:
total 0
crw------- 1 root root 136, 2 Nov 17 20:01 console
lrwxrwxrwx 1 root root 13 Nov 17 20:01 fd -> /proc/self/fd
crw-rw-rw- 1 root root 1, 7 Nov 17 20:01 full
c--------- 1 root root 10, 229 Nov 17 20:01 fuse
lrwxrwxrwx 1 root root 11 Nov 17 20:01 kcore -> /proc/kcore
crw-rw-rw- 1 root root 1, 3 Nov 17 20:01 null
lrwxrwxrwx 1 root root 8 Nov 17 20:01 ptmx -> pts/ptmx
drwxr-xr-x 2 root root 0 Nov 17 20:01 pts
crw-rw-rw- 1 root root 1, 8 Nov 17 20:01 random
drwxrwxrwt 2 root root 40 Nov 17 20:01 shm
lrwxrwxrwx 1 root root 15 Nov 17 20:01 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Nov 17 20:01 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Nov 17 20:01 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root root 5, 0 Nov 17 20:01 tty
crw-rw-rw- 1 root root 1, 9 Nov 17 20:01 urandom
crw-rw-rw- 1 root root 1, 5 Nov 17 20:01 zero
/proc/1/fd:
total 0
lrwx------ 1 root root 64 Nov 17 20:01 0 -> /2
lrwx------ 1 root root 64 Nov 17 20:01 1 -> /2
lrwx------ 1 root root 64 Nov 17 20:01 2 -> /2
lr-x------ 1 root root 64 Nov 17 20:01 3 -> /proc/1/fd
Metadata
Metadata
Assignees
Labels
area/runtimeRuntimeRuntimeexp/expertkind/enhancementEnhancements are not bugs or new features but can improve usability or performance.Enhancements are not bugs or new features but can improve usability or performance.