Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 908511 - /var/lib/portage/home should be owned by portage:portage instead of root
Summary: /var/lib/portage/home should be owned by portage:portage instead of root
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Release Media
Classification: Unclassified
Component: Stages (show other bugs)
Hardware: All Linux
: Normal critical (vote)
Assignee: Gentoo Release Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-15 01:48 UTC by Rahil Bhimjiani
Modified: 2023-07-19 10:21 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rahil Bhimjiani 2023-06-15 01:48:00 UTC
Dont know where to file this bug but I was getting bunch of "permission denied" in portage. 

Even in official stage3 tarball it is owned by root. 

drwxr-xr-x root/root           0 2023-06-12 05:05 ./var/lib/portage/home/
-rw-r--r-- root/root           0 2022-11-23 07:36 ./var/lib/portage/home/.keep_acct-user_portage-0

File & dir belongs to acct-user/portage.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-06-15 01:51:33 UTC
In what context were you getting a bunch of errors? Could you share them in full?
Comment 2 Mike Gilbert gentoo-dev 2023-06-15 01:56:13 UTC
It is owned by portage:portage on my systems and in stage3-amd64-systemd-20230611T170207Z.tar.xz.

You didn't mention which stage3 tarball you are using.
Comment 3 Rahil Bhimjiani 2023-06-15 03:16:41 UTC
Tested Tarball:

https://bouncer.gentoo.org/fetch/root/all/releases/amd64/autobuilds/20230611T170207Z/stage3-amd64-nomultilib-systemd-mergedusr-20230611T170207Z.tar.xz

I was getting errors when I tried to use ssh:// URI for GENTOO_MIRRORS saying "couldn't create /var/lib/portage/home/.ssh permission denied"
Comment 4 Mike Gilbert gentoo-dev 2023-06-15 17:56:00 UTC
Ok, I can confirm that.

> % tar -tvf stage3-amd64-systemd-mergedusr-20230611T170207Z.tar.xz | grep -F /var/lib/portage/home
> drwxr-xr-x root/root 0 2023-06-11 15:47 ./var/lib/portage/home/
> -rw-r--r-- root/root 0 2022-11-22 21:06 ./var/lib/portage/home/.keep_acct-user_portage-0
Comment 5 Mike Gilbert gentoo-dev 2023-06-15 18:03:33 UTC
Expected result:

> % ls -ld /var/lib/portage/home /var/lib/portage/home/.keep_acct-user_portage-0
> drwxr-xr-x 1 portage portage 50 Jun 15 14:01 /var/lib/portage/home
> -rw-r--r-- 1 root    root     0 Jun 15 14:01 /var/lib/portage/home/.keep_acct-user_portage-0
Comment 6 Ben Kohler gentoo-dev 2023-06-16 20:47:07 UTC
I looked into this a bit and don't have a solution but I have a bit of info to share.

This has been broken since the 2022-11-22 build, the previous 2022-11-20 was not broken.  

The problematic permissions are in the corresponding stage1 as well, so it would appear that the "ROOT=/tmp/stage1root emerge ..." which installs acct-user/portage is not creating the dir with the correct permissions.

This could be because the dir already exists ahead of time (it's emerging into a clean ROOT but acct-user/portage is package 88 of 139 to emerge), or because something is going wrong in the acct-user/portage pkg_preinst phase which is supposed to call fowners to set portage:portage as owner.
Comment 7 Larry the Git Cow gentoo-dev 2023-06-16 20:55:01 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=91fbc7f77708183b5300199a5cb6fb03bf425913

commit 91fbc7f77708183b5300199a5cb6fb03bf425913
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2023-06-16 20:50:23 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2023-06-16 20:54:32 +0000

    acct-user/portage: revbump to ensure proper permissions on HOME
    
    Permissions were broken in f1885c714d2082bc29f7269b9342870e084b00ff, and
    fixed in 22e986ce87b4f983e9508803b83466c5183cde65.
    
    Revbump to ensure binpkgs get updated.
    
    Bug: https://bugs.gentoo.org/908511
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 acct-user/portage/{portage-0.ebuild => portage-0-r1.ebuild} | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-06-17 04:05:59 UTC
We now need to let this propagate into new builds.
Comment 9 Rahil Bhimjiani 2023-07-19 10:21:57 UTC
please mark this as resolved