openSUSE / obs-build

OBS build script, can be used with OBS or stand alone
GNU General Public License v2.0
133 stars 186 forks source link

lxc: /dev/ptmx is missing #838

Open osmith42 opened 2 years ago

osmith42 commented 2 years ago

Using lxc as build environment, a package that tries to run a testsuite during the build process fails with:

The system has no more ptys. Ask your system administrator to create more.

The same package can be built fine on the public OBS.

I've looked into the lxc spawned by obs-worker with lxc-attach while a build was running, and /dev/ptmx is missing. I assume something like the following needs to be added to vm_detect_2nd_stage in build-vm?

    if ! test -e /dev/ptmx; then
        mknod /dev/ptmx c 5 2
        chmod 666 /dev/ptmx
    fi

versions and setup

obs-worker:

Repository     : 2.10 version of the Open Build Service Server (15.3)
Version        : 2.10.16-lp153.98.2

obs-server:

Repository     : 2.10 version of the Open Build Service Server (15.3)
Version        : 2.10.16-lp153.98.2

obs-worker is running inside an lxc, and is configured to use lxc as build environment. So it starts an inner lxc container for each build. In the outer lxc container, it is possible to use pseudo ttys, /dev/ptmx and /dev/pts are available and working as expected.

osmith42 commented 2 years ago

Actually the problem was, that lxc.conf did not have lxc.pty.max.

Once we added lxc.pty.max = 1024 on the obs server host, in /var/lib/lxc/obs/config and restarted the obs workers to download the new config from the server, it worked: /dev/ptmx appeared inside the lxcs started by the workers, and the testsuite using ptys didn't fail anymore.

Maybe this should be added in the default lxc.conf?