The Google Pixel 3a automatically appends console=null to the command
line. In the kernel, the preferred console is set to ttynull. Since
ttynull is not automatically enabled, a warning is currently emitted:
[ 0.909853] Warning: unable to open an initial console.
This also causes stdin, stdout, and stderr to be missing from the init
process.
In the busybox implementation, syslogd creates the /dev/log socket and
opens /dev/kmsg. This happens just before daemonizing, which opens
/dev/null and aliases stdin, stdout, and stderr to it. After daemonizing
and potentially closing the socket, stdin is aliased to the socket to
save stack memory. If the program starts without stdin under Linux, the
socket gains the constant STDIN_FILENO file descriptor, which is cleared
when daemonizing.
Syscalls when the 0, 1, 2 file descriptors aren't open:
socket(AF_UNIX, SOCK_DGRAM, 0) = 0
openat(AT_FDCWD, "/dev/kmsg", O_WRONLY|O_LARGEFILE) = 1
openat(AT_FDCWD, "/dev/null", O_RDWR|O_LARGEFILE) = 2
Enable the CONFIG_NULL_TTY option and update the configuration to allow
the kernel to open stdin, stdout, and stderr for the init and (by
inheritance) syslogd processes. It's technically an expert option but
isn't enabled by default (and can be enabled in config fragments).
Closes#3269
[ci:skip-build]: already built successfully in CI