Bug#841935: pbuilder: incorrect permissions on /dev/ptmx breaks openpty()

Simon McVittie smcv at debian.org
Mon Mar 6 09:16:24 UTC 2017


On Sun, 05 Mar 2017 at 22:16:29 +0000, James Clarke wrote:
> However, [ptmxmode=666] has to be done on the host, since /dev/pts
> is currently (effectively) bind-mounted (by not being a new instance)

Not with 4.7+ (stretch) kernels it isn't[1], so pbuilder already has this
regression in stretch. In a stretch VM accessed via ssh (to be using a
pty already, simulating the xterm use-case):

    root at host:~# tty
    /dev/pts/0
    root at host:~# pbuilder login
    ...
    I: File extracted to: /var/cache/pbuilder/build/31318
    mesg: ttyname failed: Success
    root at host:/# tty
    not a tty

and in the same stretch VM accessed via its serial console:

    root at host:~# tty
    /dev/ttyS0
    root at host:~# pbuilder login
    ...
    I: File extracted to: /var/cache/pbuilder/build/31430
    mesg: ttyname failed: Success
    root at host:/# tty
    not a tty

If you want something that is effectively a bind mount, you will have
to use a bind mount, like schroot does; but based on my testing with
debootstrap and extremely simplified versions of pbuilder and schroot
(just the /dev and /dev/pts mounts) on #817236, there are two situations
where script(1) inside schroot doesn't work:

- /dev/ptmx is a symlink to pts/ptmx (which it has to be if the debootstrap
  was created inside systemd-nspawn) and the host does not mount /dev/pts
  with ptmxmode=666 (which is not under your control, particularly if the
  host might be jessie)
- pbuilder/schroot is running in an lxc container, and it is on jessie's
  kernel, and /dev/pts is bind-mounted but /dev is not

Perhaps bind-mounting the host's /dev/pts and also the host's /dev/ptmx
would work? I'll try that.

[1] https://lwn.net/Articles/688809/

On Sun, 05 Mar 2017 at 22:43:53 +0000, Thorsten Glaser wrote:
> I’d also be seriously annoyed if my C hook running a shell if the
> build failed would stop working.

Then you will be seriously annoyed as soon as you upgrade to a stretch
kernel.

    S



More information about the Pbuilder-maint mailing list