Portage shows the following error messages when running as from an unprivileged user (fturco): $ emerge -p gcc !!! Directory initialization failed: '/var/lib/portage' !!! chown('/var/lib/portage', -1, 1000) !!! Directory initialization failed: '/var/cache/edb' !!! chown('/var/cache/edb', -1, 1000) These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R ] sys-devel/gcc-9.1.0 Some other info from my system: $ id fturco uid=1000(fturco) gid=1000(fturco) groups=1000(fturco),18(audio),19(cdrom),249(input),7(lp),106(lpadmin),105(plugdev),250(portage),101(scanner),85(usb),100(users),27(video),10(wheel) $ id portage uid=250(portage) gid=250(portage) groups=250(portage) The emerge --info -v command returns the following variables: PORTAGE_GID="1000" PORTAGE_INST_GID="1000" PORTAGE_INST_UID="1000" PORTAGE_USERNAME="fturco" I haven't explicitely set any of the previous portage variables in any file under the /etc/portage directory. The following commands display nothing: grep PORTAGE_USERNAME -r /var/db/repos /etc/portage grep PORTAGE_GID -r /var/db/repos /etc/portage grep PORTAGE_INST_GID -r /var/db/repos /etc/portage grep PORTAGE_INST_UID -r /var/db/repos /etc/portage I found a Funtoo bug report with a similar problem, but I can't understand how to apply their solution to my situation. https://bugs.funtoo.org/browse/FL-3120 I also reported this problem on the Gentoo Forums before filing this bug: https://forums.gentoo.org/viewtopic-p-8336808.html The following command doesn't fix the problem: chown -R portage:portage /var/cache/distfiles /var/cache/binpkgs /var/db/repos I have sys-apps/portage-2.3.66-r1. Reproducible: Always
Created attachment 577798 [details] info.txt emerge --info -v
I looks like your user has write access to the root directory /, so you're triggering unprivileged mode (bug 433453): > # If the current user is not root, but has write access to the > # EROOT directory (not due to the 0002 bit), then use "unprivileged" > # mode which sets secpass = 2 and uses the UID and GID of the EROOT > # directory to generate default PORTAGE_INST_GID, PORTAGE_INST_UID, > # PORTAGE_USERNAME, and PORTAGE_GRPNAME settings. > def _unprivileged_mode(eroot, eroot_st): > return os.getuid() != 0 and os.access(eroot, os.W_OK) and \ > not eroot_st.st_mode & 0o0002
You're right. My root directory (/) had fturco:fturco user and group permissions. I fixed that with: # chown root:root / Thank you! I feel I can now close this bug.