On Wed, Aug 06, 2025 at 04:23:43PM -0000, Michael van Elst wrote:
> That is probably a sudo issue. By default sudo acts as a tty
> emulator like:

>  |-+= 01407 root login 
>  | \-+= 00692 root -sh 
>  |   \-+= 00975 root sudo -s 
>  |     \-+= 00983 root sudo -s 
>  |       \--= 00989 root /bin/sh 
> 
> Where the outer sudo reads raw tty input and should pass input
> to the started command. However:
> 
> [fstat output elided]
> 
> The started command (sh) has only open file handles to the console.
> 
> In the ssh case:
> 
> -+= 00942 root -sh 
>  \-+= 01631 root sudo -s 
>    \-+= 01528 root sudo -s 
>      \--= 00977 root /bin/sh 
> 
> [fstat output elided]
> 
> The started command is connected to the new pty opened by sudo and
> receives the data that the outer sudo writes to it.

Thanks for analyzing this.  That explains it.

> N.B. you could avoid this by disabling the pty mode in sudoers.

The release notes for sudo 1.9.17rc1
(https://www.sudo.ws/releases/devel/#1.9.17rc1) mention:

  * Fixed a problem running sudo from a serial console on Linux when the
    command is run in a pseudo-terminal (the default).

I just updated sudo on the vm to 1.9.17.p1 (the latest binary package the
configured repo) and the bug is gone.  "sudo -s" from the console now works
as expected.

--chris

Reply via email to