Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] User eix-sync permissions problem
Date: Mon, 10 Feb 2014 18:46:13
Message-Id: 52F91E67.1000603@gmail.com
In Reply to: [gentoo-user] User eix-sync permissions problem by Stroller
1 On 10/02/2014 18:05, Stroller wrote:
2 > Hello all,
3 >
4 > I'm a little bit rusty, but my recollection is that I should be able to perform `eix-sync` (or `emerge --sync`?) as a user to synchronise my local copy of the portage tree with Gentoo's master portage tree.
5
6 I don't sync as user alan, I let root start it then drop provs to user
7 portage. But the necessary permissions must work the same way regardless
8
9 >
10 > User is in the portage group:
11 >
12 > $ whoami
13 > stroller
14 > $ groups stroller
15 > wheel audio video portage cron users
16 > $
17
18 that's correct
19
20 >
21 > Yet I get these permissons denied errors:
22 >
23 > $ eix-sync
24 > * Running emerge --sync
25 >>>> Synchronization of repository 'gentoo' located in '/usr/portage'...
26 >>>> Starting rsync with rsync://91.186.30.235/gentoo-portage...
27 >>>> Checking server timestamp …
28 > …
29 > receiving incremental file list
30 > rsync: delete_file: unlink(app-accessibility/caribou/caribou-0.4.12.ebuild) failed: Permission denied (13)
31 > rsync: delete_file: unlink(app-accessibility/emacspeak/files/emacspeak-33.0-respect-ldflags.patch) failed: Permission denied (13)
32 > rsync: delete_file: unlink(app-accessibility/emacspeak/files/emacspeak-33.0-greader-garbage.patch) failed: Permission denied (13)
33 >
34 > (full output attached)
35 >
36 >
37 > Googling the problem I see a bunch of Gentoo Forums posts talking about changing at random the permissions of /var/tmp/ or /var/tmp/portage/, but no rationale is given, and I don't think this is the cause:
38 >
39 > $ emerge --info | grep -i tmpdir
40 > PORTAGE_TMPDIR="/var/tmp"
41 > $ ls -ld /var/tmp/
42 > drwxrwxrwt 3 root root 4096 Feb 5 13:47 /var/tmp/
43 > $ ls -ld /var/tmp/portage/
44 > drwxrwxr-x 5 portage portage 4096 Feb 5 12:32 /var/tmp/portage/
45 > $
46
47 <sigh>
48
49 Once again clueless morons on the forums throwing shit at the wall and
50 hoping some sticks. You correctly spotted this has nothing whatsoever to
51 do with /var/tmp (where emerge builds stuff) but with the tree itself,
52 rsync modifies the local copy of the tree directly.
53
54 >
55 >
56 > More likely seems to be the permissions of /usr/portage/:
57 >
58 > $ ls -ld /usr/portage/
59 > drwxr-xr-x 167 portage portage 4096 Jan 5 02:31 /usr/portage/
60 > $ ls -ld /usr/portage/app-accessibility/caribou/caribou*.ebuild
61 > -rw-r--r-- 1 portage portage 2432 Aug 25 23:11 /usr/portage/app-accessibility/caribou/caribou-0.4.12.ebuild
62 > -rw-r--r-- 1 portage portage 2431 Dec 8 18:01 /usr/portage/app-accessibility/caribou/caribou-0.4.13.ebuild
63 > $
64 >
65 > This would seem to allow portage itself to synchronise the Portage tree, but not members of the portage group.
66 >
67 >
68 > I am able to run `emerge --sync` as root, but it doesn't solve the solve the problem - next time I run `eix-sync` as user, I'm permissions denied, again.
69 >
70 > Shouldn't a sync reset the permissions of the portage tree to be correct?
71 >
72 >
73 > `emerge --info | grep -i feature` shows that FEATURES="userfetch userpriv usersandbox usersync" (and some others - see attached) are set.
74
75 Those features are correct, that's what I have.
76
77 All files and dirs in my tree are set to portage:portage
78 All dirs have permissions 2775
79 All files have permissions 664
80
81 It's been this way for me for years without touching any settings; I
82 just searched for some config or a cron that runs chmod/chown on the
83 whole tree and found nothing. So I assume emerge is setting the
84 permissions itself.
85
86 However, a normal user can't chown a file, so you'll have to do these
87 first steps as root:
88
89 chown -R stroller:portage /usr/portage
90 find /usr/portage -type d -exec chmod 2775 {} \;
91 find /usr/portage -type f -exec chmod 664 {} \;
92
93 Thereafter sync as yourself, and the state should be maintained. rsync
94 will create new files in the tree as owned by you and you have
95 permission to chmod things so the group w perm should persist on everything.
96
97 If permissions don't persist then I'll have to hunt deeper here to find
98 my magic from years ago :-)
99
100
101 That *should* take care of emerge --sync.
102 I'm not too sure about eix-update though, we might have to do some more
103 fiddling in eix's data dir. make that phase 2 :-)
104
105
106 --
107 Alan McKinnon
108 alan.mckinnon@×××××.com