runj
runj copied to clipboard
terminal discards first keypress
When running a container with a terminal (through ctr run --tty
), the first keypress after the container starts running appears to be discarded.
It might not be related, but FreeBSD requires TIOCSCTTY to be called by the session group leader to set the controlling console, it doesn't set the tty automatically as controlling when opening the slave terminal. (see: https://www.freebsd.org/cgi/man.cgi?query=termios&apropos=0&sektion=4&manpath=FreeBSD+13.0-current&arch=default&format=html section "Controlling terminal")
/bin/csh is also complaining about lacking a proper terminal when ran via runj (but not when I jexec into the same jail by hand)
OK, tested it, doesn't fix the first keypress missing issue, does fix the
Warning: no access to tty (Bad file descriptor).
Thus no job control in this shell.
error spewed out by csh
It doesn't look as if jexec
does anything with the TTY, it just inherits whatever the caller had. It does take care to propagate the TERM
environment variable, even if it's cleaning the environment. It is setting the user context, which may have some impact on the TTY that I don't understand (in particular, this will set the LANG
, MM_CHARSET
and TERM
environment variables to the defaults for the login class, which may impact how csh
interacts with the TTY). @gizahNL, do you see any interesting differences between the output of env
when run from jexec
vs runj
?
@davidchisnall The controlling terminal issue I fixed via 91402841220efd347f86db86d75a283447b195f7 unfortunately that was not the cause of the first keypress getting discarded :/
I never noticed this issue using runj with buildah and podmon which might suggest the problem is upstream from runj, perhaps in the containerd shim?