Re: Behavior of /dev/pts in a jail?

From: Michael Gmelin <grembo_at_freebsd.org>
Date: Wed, 09 Feb 2022 11:56:49 UTC

> On 9. Feb 2022, at 11:38, Alexander Leidinger <Alexander@leidinger.net> wrote:
> 
> Quoting Michael Gmelin <grembo@freebsd.org> (from Tue, 8 Feb 2022 13:37:32 +0100):
> 
>> I've seen a similar problem with jails running on top of bhyve (in that
>> case, doing ssh wouldn't work).
>> 
>> The solution back then was to add ttyu* to devfs rules _before_ starting
>> the jail:
>> 
>>    devfs rule -s 3 add 3250 path "ttyu*" unhide
>> 
>> Not sure if what you're seeing is related, but it feels a bit like that.
>> 
>> See also
>> https://lists.freebsd.org/archives/freebsd-current/2021-August/000409.html
> 
> I tried that now. It doesn't help. I'm not really surprised, as there is no ttyu* device visible on the host itself (serial devices disabled in bios).
> 
> Bye,
> Alexander.
> 


Hi Alex,

I was able to reproduce the issue locally.

The problem is caused by jexec inheriting the pty from the jail host.

If you use a pty that was created inside of the jail, gpg-agent/pinentry works as expected.

This can be accomplished, e.g., by running tmux inside of the jail:

    jexec gpgtest
    pkg install tmux
    tmux
    gpg --gen-key

Running sshd inside of the jail and connecting to it using ssh has the same effect.

Cheers
Michael