Package: schroot
Version: 1.6.10-11
Severity: normal

Steps to reproduce
------------------

(Replace or remove the http proxy http://192.168.122.1:3142 as required.)

    sudo apt install lxc autopkgtest
    (configure lxc as per [1])
    sudo AUTOPKGTEST_APT_PROXY=http://192.168.122.1:3142 autopkgtest-build-lxc 
debian sid amd64
    sudo lxc-copy --ephemeral -n autopkgtest-sid-amd64 -N temp
    sudo lxc-attach -n temp

and then inside the lxc container:

    apt install debootstrap schroot
    http_proxy=http://192.168.122.1:3142 debootstrap sid /sid
    cat > /etc/schroot/chroot.d/sid <<EOF
    [sid]
    type=directory
    directory=/sid
    groups=root
    root-groups=root
    EOF
    schroot -c sid -- ls -al /dev
    schroot -c sid -- script -c 'cat /etc/os-release' /tmp/transcript

[1] 
https://salsa.debian.org/ci-team/autopkgtest/-/blob/master/debian/README.source

Expected result
---------------

* /dev contains at least minimal devices, including
  /dev/console and /dev/ptmx

* script(1) works and prints the contents of /etc/os-release

Actual result
-------------

* Some devices in /dev are reasonable, but some are just regular files
  - Under lxc 2 (Debian 9):
    - /dev/console is an empty regular file with permissions 0111
    - /dev/ptmx is a symlink to /dev/pts/ptmx
    - /dev/tty1 to /dev/tty4 are empty regular files with permissions 0640
  - Under lxc 3 (Debian 10) and lxc 4 (Debian 11):
    - /dev/console is an empty regular file with permissions 000
    - so is /dev/ptmx
    - so are /dev/tty1 to /dev/tty4

* Under lxc 2 (Debian 9), script works, as expected

* Under lxc 3 (Debian 10) and lxc 4 (Debian 10), script fails:
    Script started, output log file is '/tmp/transcript'.
    script: failed to create pseudo-terminal: Invalid argument

Proposed patch
--------------

The same patch I proposed in 2017 for #856877 resolves this, setting
up a working /dev/ptmx.  Under lxc 2 it's a symlink to /dev/ptx/ptmx,
and under lxc >= 3 it's a device node.

Under lxc 4, that patch also provides a working /dev/console.

I'll re-send the patch with both bug numbers included when I have a
bug number for this report.

    smcv

Reply via email to