When running emerge in user namespace with /dev from the host system, I get the following exception: PermissionError: [Errno 1] Operation not permitted: '/dev/pts/34'. Reproducible: Always Actual Results: ``` Exception in callback AsynchronousTask._exit_listener_cb(<bound method...7f8459664b80>>) handle: <Handle AsynchronousTask._exit_listener_cb(<bound method...7f8459664b80>>)> Traceback (most recent call last): File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/lib/python3.11/site-packages/_emerge/AsynchronousTask.py", line 209, in _exit_listener_cb listener(self) File "/usr/lib/python3.11/site-packages/_emerge/EbuildPhase.py", line 203, in _async_start_exit self._start_lock() File "/usr/lib/python3.11/site-packages/_emerge/EbuildPhase.py", line 226, in _start_lock self._start_ebuild() File "/usr/lib/python3.11/site-packages/_emerge/EbuildPhase.py", line 283, in _start_ebuild self._start_task(ebuild_process, self._ebuild_exit) File "/usr/lib/python3.11/site-packages/_emerge/CompositeTask.py", line 111, in _start_task task.start() File "/usr/lib/python3.11/site-packages/_emerge/AsynchronousTask.py", line 34, in start self._start() File "/usr/lib/python3.11/site-packages/_emerge/AbstractEbuildProcess.py", line 211, in _start self._start_post_builddir_lock(start_ipc_daemon=start_ipc_daemon) File "/usr/lib/python3.11/site-packages/_emerge/AbstractEbuildProcess.py", line 244, in _start_post_builddir_lock SpawnProcess._start(self) File "/usr/lib/python3.11/site-packages/_emerge/SpawnProcess.py", line 130, in _start retval = self._spawn(self.args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/_emerge/EbuildProcess.py", line 24, in _spawn return _doebuild_spawn( ^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/portage/package/ebuild/doebuild.py", line 242, in _doebuild_spawn return spawn(cmd, settings, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/portage/package/ebuild/doebuild.py", line 2017, in spawn _os.chown(subprocess_tty, int(portage_uid), int(portage_gid)) ``` Expected Results: emerge does not fail when it can't chown a PTS.
Features: ``` "getbinpkg", "-candy", "-sandbox", "-userfetch", "-userpriv", "-usersandbox", "-usersync", "-ebuild-locks", "parallel-install", ```
What's the use case here?
> What's the use case here? Unprivileged builds of gentoo images with mkosi of which I'm the maintainer.
Is there a reason you need /dev/pts from the host system? systemd-nspawn would mount a new devpts instance after unsharing the user namespace. I hesitate to just ignore the error; I presume we are doing this chown for a good reason.
Turns out that setting FEATURES via the environment variable doesn't work for ebuilds when ROOT != SYSROOT. I switched to appending to etc/portage/make.conf and that allows me to disable userpriv which fixes this issue so closing.