The directory /var/tmp/portage/$category/$package/distdir is created with the following ownership and file access permissions: drwxr-xr-x 2 root portage Normally this is not a problem, because most packages don't need to write to this directory - it only contains symlinks to the distfiles in /usr/portage/distfiles/. However, app-misc/ca-certificates' distfile is a .deb package, which portage converts to a gzipped tarball using deb2targz. This requires writing to the distdir directory, which portage cannot do when run with the userpriv feature because neither the portage user nor the portage group has write access to this directory. Reproducible: Always Steps to Reproduce: 1. Add userpriv to your FEATURES 2. emerge app-misc/ca-certificates Actual Results: emerge fails during unpack phase. Expected Results: 1) The .tar.gz converted archive should be written to another location to which the portage user has write access. or 2) The portage user or group should have write access to the distdir directory within the package build directory.
Actually I am not sure what triggers the problem. I have two machines, both configured with FEATURES="sandbox ccache userpriv distlocks", but only one of it is hit by the issue.
That's interesting. I'll try syncing & updating my laptop when I get home tonight, and see if it persists.
(In reply to comment #1) > Actually I am not sure what triggers the problem. I have two machines, both > configured with FEATURES="sandbox ccache userpriv distlocks", but only one of > it is hit by the issue. > I've recently hit the same problem. Running emerge with FEATURES="-userpriv" solved it for me. emerge --info | grep FEATURES shows: ccache collision-protect distlocks fixpackages multilib-strict parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-orphans userfetch userpriv
This is a Portage bug, here's what happens. When the distfile is a .deb, Portage uses deb2targz to unpack the file. Otherwise, it uses ar (which works, and which might explain why Joerg was not able to reproduce this issue on one box). deb2targz extracts the file not into the CWD, but into the directory the original file resides. This fails when USERPRIV is enabled. Since there's no parameter to change that, we need Portage to work around this issue: 1) Copy the symlink in $distdir to $workdir. 2) Prefer ar over deb2targz except on systems where it is known not to work and disable USERPRIV / fail there.
Created attachment 177721 [details, diff] don't write to $DISTDIR with deb2targz If this patch is saved as /tmp/deb2targz.patch, then it can be applied as follows: patch /usr/lib/portage/bin/ebuild.sh /tmp/deb2targz.patch
*** Bug 254171 has been marked as a duplicate of this bug. ***
*** Bug 254505 has been marked as a duplicate of this bug. ***
This is fixed in 2.1.6.5 and 2.2_rc21.
*** Bug 255847 has been marked as a duplicate of this bug. ***