Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] emerge --sync as user in group portage
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Mon Jan 19, 2015 4:17 pm    Post subject: [SOLVED] emerge --sync as user in group portage Reply with quote

Trying "emerge --sync" or "eix-sync" as normal user but having group portage fails with
Quote:
receiving incremental file list
rsync: mkstemp "/usr/portage/app-accessibility/at-spi2-atk/.ChangeLog.q9pfNf" failed: Permission denied (13)
rsync: mkstemp "/usr/portage/app-accessibility/at-spi2-atk/.Manifest.EpRhqU" failed: Permission denied (13)
rsync: mkstemp "/usr/portage/app-accessibility/at-spi2-atk/.at-spi2-atk-2.12.1-r1.ebuild.K9Jl3y" failed: Permission denied (13)
rsync: mkstemp "/usr/portage/app-accessibility/at-spi2-core/.ChangeLog.2PdrGd" failed: Permission denied (13)
rsync: mkstemp "/usr/portage/app-accessibility/at-spi2-core/.Manifest.qp1yjS" failed: Permission denied (13)
rsync: mkstemp "/usr/portage/app-accessibility/at-spi2-core/.at-spi2-core-2.12.0-r1.ebuild.O4qIWw" failed: Permission denied (13)
rsync: mkstemp "/usr/portage/app-admin/puppet/.ChangeLog.qjK4bd" failed: Permission denied (13)
rsync: mkstemp "/usr/portage/app-admin/puppet/.Manifest.OOKxrT" failed: Permission denied (13)
rsync: mkstemp "/usr/portage/app-admin/puppet/.puppet-3.7.3.ebuild.UQB3Gz" failed: Permission denied (13)
rsync: mkstemp "/usr/portage/app-i18n/ibus/.ChangeLog.OWAbv6" failed: Permission denied (13)
rsync: mkstemp "/usr/portage/app-i18n/ibus/.Manifest.UMjqjD" failed: Permission denied (13)
rsync: mkstemp "/usr/portage/app-i18n/ibus/.ibus-1.5.9-r1.ebuild.SCMG79" failed: Permission denied (13)
rsync: mkstemp "/usr/portage/app-misc/byobu/.ChangeLog.0rrDlJ" failed: Permission denied (13)
rsync: mkstemp "/usr/portage/app-misc/byobu/.Manifest.8KMCzi" failed: Permission denied (13)
rsync: mkstemp "/usr/portage/app-misc/byobu/.byobu-5.90.ebuild.MaODNR" failed: Permission denied (13)
^C

User is in group portage
Quote:
$ groups
wheel uucp audio cdrom dialout video games cdrw usb users portage scanner charles17 plugdev

And directories are like
Quote:
$ ls -al /usr/portage/app-accessibility/at-spi2-atk/
total 33
drwxr-xr-x 2 portage portage 280 Dec 30 06:02 .
drwxr-xr-x 42 portage portage 1216 Nov 13 18:29 ..
-rw-r--r-- 1 portage portage 8949 Dec 29 09:01 ChangeLog
-rw-r--r-- 1 portage portage 2893 Dec 29 09:01 Manifest
-rw-r--r-- 1 portage portage 1340 Dec 29 09:01 at-spi2-atk-2.12.1-r1.ebuild
-rw-r--r-- 1 portage portage 950 Dec 29 09:01 at-spi2-atk-2.12.1.ebuild
-rw-r--r-- 1 portage portage 1337 Dec 29 09:01 at-spi2-atk-2.14.1.ebuild
-rw-r--r-- 1 portage portage 174 Oct 4 2013 metadata.xml
Problem seems to be that sub directories in /usr/portage/ have chmod 755.
Is this by design? I can't remember how long it's been this way.


Last edited by charles17 on Mon Feb 02, 2015 7:42 am; edited 1 time in total
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3846
Location: Austro Bavaria

PostPosted: Sat Jan 31, 2015 10:18 am    Post subject: Reply with quote

Juding on your output the directory belongs to the group portage.

Your user do not have writing rights for e.g.

rsync: mkstemp "/usr/portage/app-accessibility/at-spi2-atk/.ChangeLog.q9pfNf"

which means you do not belong to the portage group, or the portage group do not have the permissions to write there.

https://forums.gentoo.org/viewtopic.php?t=37913

there is also eixrc and other configs.

Off topic: I personally use su and get permissions to run the portage from a shell in X
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Sat Jan 31, 2015 11:42 pm    Post subject: Reply with quote

tw04l124 wrote:
which means you do not belong to the portage group, or the portage group do not have the permissions to write there.
That's exactly what I understand from
Quote:
-rw-r--r-- 1 portage portage
Portage group has only read permission. But shouldn't also the group have write permission?

What is your permissions in /usr/portage/*/ ?

tw04l124 wrote:
https://forums.gentoo.org/viewtopic.php?t=37913
Seems to support my idea that emerge --sync should be possible for any user in portage group.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Feb 01, 2015 12:19 am    Post subject: Reply with quote

charles17 wrote:
[..] -rw-r--r-- 1 portage portage. Portage group has only read permission. But shouldn't also the group have write permission?

charles ... generally, yes, and +x as you need +r-x for accessing the directory. I'm not sure how you came by the above as the default is:

Code:
# ls -ld ~portdir
drwxrwxr-x 113 portage portage 4096 2015-01-31 12:48 /var/pkg/gentoo/

charles17 wrote:
What is your permissions in /usr/portage/*/ ?

drwxr-xr-x portage portage, and -rw-r--r-- portage portage for files.

best ... khay
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Sun Feb 01, 2015 9:28 am    Post subject: Reply with quote

khayyam wrote:
charles ... generally, yes, and +x as you need +r-x for accessing the directory. I'm not sure how you came by the above as the default is:

Code:
# ls -ld ~portdir
drwxrwxr-x 113 portage portage 4096 2015-01-31 12:48 /var/pkg/gentoo/
Thanks a lot for your help. I am getting confused about ~portdir.
Quote:
$ ls -ld ~portdir
ls: cannot access ~portdir: No such file or directory

Also I do not have /var/pkg/gentoo/. Instead, there is
Code:
$ ls -al /var/db/
total 10
drwxr-xr-x  3 root root   96 Feb  1 09:55 .
drwxr-xr-x  9 root root  288 Dec 17 11:56 ..
-rw-r--r--  1 root root 5332 Sep 13 01:47 Makefile
drwxr-xr-x 84 root root 2352 Feb  1 09:55 pkg

$ ls -la /var/db/pkg/
total 21
drwxr-xr-x 84 root root 2352 Feb  1 09:55 .
drwxr-xr-x  3 root root   96 Feb  1 09:55 ..
drwxr-xr-x 22 root root  848 Jan 24 16:19 app-admin
drwxr-xr-x 13 root root  416 Jan 13 08:21 app-arch
and some others more ...

Guess it cannot be sanitized this by simply doing chmod g+w /var/db/* ?
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Feb 01, 2015 2:00 pm    Post subject: Reply with quote

charles17 wrote:
Code:
# ls -ld ~portdir
drwxrwxr-x 113 portage portage 4096 2015-01-31 12:48 /var/pkg/gentoo/

charles17 wrote:
Thanks a lot for your help. I am getting confused about ~portdir.
Code:
$ ls -ld ~portdir
ls: cannot access ~portdir: No such file or directory

charles ... '~portdir' is a 'hashed directory', its a zsh thing, so unless you're running zsh and created a hashed dir you won't have it.

Though I often do my examples in bash syntax so that confusions like the above don't happen, its not something I'm happy about it, as I'm basically validating the use of something which I wouldn't advocate. Anyhow, I'd assumed that you would take '~portdir' to mean PORTDIR ... and so translate this to whatever path you happen to have.

charles17 wrote:
Also I do not have /var/pkg/gentoo/.

Yes, that wasn't a mistake on my part ... /var/pkg is the top level directory where I store all repos ... and 'gentoo' is the 'gentoo repo' (mistakenly called 'portage'). Yours is '/usr/portage' ... as you showed in the post I was replying to. I'd assumed you'd see I was talking about the same directory ... sorry.

charles17 wrote:
Guess it cannot be sanitized this by simply doing chmod g+w /var/db/* ?

Firstly, /var/db serves another purpose, secondly, that will also effect files similarly to directories.

I would use zsh's "glob qualifiers" and match my targets ... but as your using bash find will have to suffice.

Code:
# chmod ug+rwx,o+rx /usr/portage
# find /usr/portage -type f -exec chmod u+rw,g+r,o+r "{}" \;
# find /usr/portage -type d -exec chmod u+rwx,go+rx "{}" \;

HTH & best ... khay
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Sun Feb 01, 2015 3:23 pm    Post subject: Reply with quote

khayyam wrote:
I would use zsh's "glob qualifiers" and match my targets ... but as your using bash find will have to suffice

chown and chmod (at least those from GNU) have an -R switch:
Code:
chown -R portage:portage /usr/portage
chmod -R ug+w,a+rX /usr/portage
chmod g+s /usr/portage

(Putting the sgid bit seems to be the right thing here and IIRC was default on my stage3).
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Feb 01, 2015 3:49 pm    Post subject: Reply with quote

mv wrote:
chown and chmod (at least those from GNU) have an -R switch:
Code:
chown -R portage:portage /usr/portage
chmod -R ug+w,a+rX /usr/portage

mv ... yes, I'd forgotten about +X ... as I said I generally use glob qualifiers and '**' glob rather than -R.

mv wrote:
Code:
chmod g+s /usr/portage

(Putting the sgid bit seems to be the right thing here and IIRC was default on my stage3).

hmmm ... no sgid here, but agreed its probably a good idea.

best ... khay
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Sun Feb 01, 2015 5:51 pm    Post subject: Reply with quote

Thanks khayyam and mv for your help.
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Sun Feb 01, 2015 6:41 pm    Post subject: Reply with quote

Thanks khayyam and mv for your help. But something's still weird. I am now receiving errors like
Quote:
receiving incremental file list
rsync: failed to set permissions on "/usr/portage/.": Operation not permitted (1)
rsync: failed to set permissions on "/usr/portage/header.txt": Operation not permitted (1)
rsync: failed to set permissions on "/usr/portage/skel.ChangeLog": Operation not permitted (1)
rsync: failed to set permissions on "/usr/portage/skel.ebuild": Operation not permitted (1)
rsync: failed to set permissions on "/usr/portage/skel.metadata.xml": Operation not permitted (1)
rsync: failed to set permissions on "/usr/portage/app-accessibility": Operation not permitted (1)
rsync: failed to set permissions on "/usr/portage/app-accessibility/metadata.xml": Operation not permitted (1)
rsync: failed to set permissions on "/usr/portage/app-accessibility/SphinxTrain": Operation not permitted (1)
rsync: failed to set permissions on "/usr/portage/app-accessibility/SphinxTrain/ChangeLog": Operation not permitted (1)
rsync: failed to set permissions on "/usr/portage/app-accessibility/SphinxTrain/Manifest": Operation not permitted (1)
And, these errors now are even when running su -c "emerge --sync".
Please help.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Feb 01, 2015 7:08 pm    Post subject: Reply with quote

charles17 wrote:
[...] these errors now are even when running su -c "emerge --sync". Please help.

charles ... hmmm, so what permissions are set, and who is the owner, group?

Code:
# ls -ld ~portdir
drwxrwxr-x 112 portage portage 4096 2015-02-01 18:30 /var/pkg/gentoo/
# ls -l ~portdir/header.txt
-rw-r--r-- 1 portage portage 121 2015-01-01 04:01 /var/pkg/gentoo/header.txt
# ls -ld ~portdir/app-accessibility
drwxr-xr-x 42 portage portage 4096 2014-11-13 17:53 /var/pkg/gentoo/app-accessibility/
# ls -l ~portdir/app-accessibility/metadata.xml
-rw-r--r-- 1 portage portage 1652 2009-11-01 19:31 /var/pkg/gentoo/app-accessibility/metadata.xml

best ... khay
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Sun Feb 01, 2015 7:21 pm    Post subject: Reply with quote

I haven't touched /var/db/pkg yet. It is like
Quote:
$ ls -al /var/db/pkg/
total 21
drwxr-xr-x 84 root root 2352 Feb 1 19:34 .
drwxr-xr-x 3 root root 96 Feb 1 19:34 ..
drwxr-xr-x 22 root root 848 Jan 24 16:19 app-admin
drwxr-xr-x 13 root root 416 Jan 13 08:21 app-arch
drwxr-xr-x 4 root root 120 Jun 13 2014 app-cdr
Would I need to set the same permissions here as done for /usr/portage ?
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Feb 01, 2015 7:26 pm    Post subject: Reply with quote

charles17 wrote:
I haven't touched /var/db/pkg yet.

charles ... it has nothing to do with /var/db/pkg ... I explained above why you see that in my path. Should I provide output for paths I don't have?

Code:
# ls -ld /usr/portage
ls: cannot access /usr/portage: No such file or directory

Obviously you need to replace /var/pkg/gentoo with /usr/portage.

best ... khay
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Sun Feb 01, 2015 7:36 pm    Post subject: Reply with quote

khayyam wrote:
charles ... it has nothing to do with /var/db/pkg ... I explained above why you see that in my path. Should I provide output for paths I don't have?
Ok, I'll try not getting confused by your paths.
After running su -c "emerge --sync" my changes seem to be redone and I get
Code:
$ ls -al /usr/portage/
total 594
drwxr-xr-x  172 portage portage  5120 Feb  1 20:13 .
drwxr-xr-x   14 root    root      400 Feb  1 19:33 ..
drwxr-xr-x   42 portage portage  1216 Nov 13 18:29 app-accessibility
drwxr-xr-x  240 portage portage  7072 Jan  7 08:53 app-admin
drwxr-xr-x    4 portage portage   144 Dec 28  2013 app-antivirus
drwxr-xr-x  104 portage portage  2728 May 15  2014 app-arch
drwxr-xr-x   59 portage portage  1768 Dec  2 07:19 app-backup
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Feb 01, 2015 8:01 pm    Post subject: Reply with quote

charles ... except for /usr/portage/ itself the above seems to be consistant with what I provided ... though you only showed directories and not files ...

Code:
# chmod g+w /usr/portage

I'm not sure who's advice you followed, but as I don't see g+s I'll assume mine. Just to clarify, 'su -c emerge --sync' didn't work, but now does?

best ... khay
Back to top
View user's profile Send private message
MarioCorleone
Guru
Guru


Joined: 29 Jun 2003
Posts: 336

PostPosted: Sun Feb 01, 2015 8:54 pm    Post subject: Reply with quote

Is there a reason why your not using sudo?
_________________
-Mario
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Mon Feb 02, 2015 7:28 am    Post subject: Reply with quote

khayyam wrote:
charles ... except for /usr/portage/ itself the above seems to be consistant with what I provided ... though you only showed directories and not files ...

Code:
# chmod g+w /usr/portage

I'm not sure who's advice you followed, but as I don't see g+s I'll assume mine. Just to clarify, 'su -c emerge --sync' didn't work, but now does?
Guess it*s a bad idea trying to "emerge --sync" without su. After "chmod g+w /usr/portage" everything in /usr/portage/ has 775. But then doing "emerge --sync" (without su) results in errors like
Quote:
rsync: failed to set permissions on "/usr/portage/app-text/vilistextum": Operation not permitted (1)
Then running
Quote:
$ su -c "emerge --sync"
returns all previously done chmod to 755. Ok for me.

Thanks again for your attention.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Mon Feb 02, 2015 7:45 am    Post subject: Reply with quote

charles17 wrote:
Guess it*s a bad idea trying to "emerge --sync" without su

Portage by default (or if some FEATURE is set?) drops permissions to user "portage" when syncing - this is not possible if portage is not called as root. In this sense, syncing as "root" can be saver than syncing as a user.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum