Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 68427 - Can't use emerge from nfs-mounted /usr/portage
Summary: Can't use emerge from nfs-mounted /usr/portage
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: x86 Linux
: High blocker (vote)
Assignee: Portage team
Depends on:
Reported: 2004-10-21 11:52 UTC by walt
Modified: 2005-01-30 18:34 UTC (History)
0 users

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


Note You need to log in before you can comment on or make changes to this bug.
Description walt 2004-10-21 11:52:53 UTC
For ages I've updated one of my machines with emerge sync, and then updated the
remaining four machines by nfs-mounting the /usr/portage directory from the first
machine.  Saving bandwidth for gentoo!

As of today (portage-2.0.51) I can no longer do this because portage wants to
write to /usr/portage/.locks/ on the read-only, nfs-mounted, first machine:

emerge (1 of 4) net-print/cups-1.1.20-r4 to /
Traceback (most recent call last):
  File "/usr/bin/emerge", line 2971, in ?
  File "/usr/bin/emerge", line 1825, in merge
  File "/usr/lib/portage/pym/", line 2497, in doebuild
    if not fetch(fetchme, mysettings, listonly=listonly, fetchonly=fetchonly):
  File "/usr/lib/portage/pym/", line 1669, in fetch
OSError: [Errno 30] Read-only file system: '/usr/portage/distfiles/.locks'

Reproducible: Always
Steps to Reproduce:
1.Nfs-mount(ro) the /usr/portage directory of one machine on /usr/portage of another
2.Try to emerge something/anything
3.Watch for the write errors to the read-only fs of the first machine.

Expected Results:  
Any lockfiles should be written to the *local* machine rather than the
nfs-mounted remote machine -- as it has always been in the past.
Comment 1 Nicholas Jones (RETIRED) gentoo-dev 2004-10-21 12:04:46 UTC
Define it as a local repository. NFS locks exist to allow concurrent access.

You could try symlinking .locks to /dev/shm.
You could also mount read/write.
You could also disable distlocks.
Comment 2 walt 2004-10-22 07:04:33 UTC
Sounds like disabling distlocks is what I really prefer, but would you explain
your first option:  define it as a local repository how/where?
Comment 3 walt 2004-10-23 07:41:28 UTC
Disabling distlocks did what I wanted.  But because FEATURES is an incremental
variable I had to edit make.globals to do it.  Would be nice instead to be able
to put FEATURES="nodistlocks" in make.conf.

Yes, it's hardly urgent, and you have more important things to do.  Anyway,
thanks for the hints.
Comment 4 Jason Stubbs (RETIRED) gentoo-dev 2004-10-23 07:54:53 UTC
You have that ability already because, as you said already, FEATURES is incremental - just like USE is incremental. Try adding FEATURES="-distlocks" to make.conf.
Comment 5 Jason Stubbs (RETIRED) gentoo-dev 2004-10-23 08:16:05 UTC
Looking at the code, portage should have known that $DISTDIR was readonly. Can you check what the output of the following command is please?
# python -c 'import os; print os.access("/usr/portage/distfiles/",os.W_OK)'
Comment 6 Jason Stubbs (RETIRED) gentoo-dev 2004-10-23 08:56:05 UTC
'InCVS' was added by mistake..
Comment 7 Wayne Carruthers 2005-01-19 23:25:06 UTC
Also encountered problem when using a remote mounted portage/distfiles

Portage tries to set permissions of files to root & cannot
Comment 8 Jason Stubbs (RETIRED) gentoo-dev 2005-01-29 02:10:06 UTC
Via email from

# python -c 'import os; print os.access("/usr/portage/distfiles/",os.W_OK)'

The answer is 'True', which is *wrong*. 
Comment 9 Jason Stubbs (RETIRED) gentoo-dev 2005-01-29 02:10:06 UTC
Via email from

# python -c 'import os; print os.access("/usr/portage/distfiles/",os.W_OK)'

The answer is 'True', which is *wrong*.  Here is what mount says:
k2:/ on /mnt/nfs type nfs (rw,addr=,addr=
and yet when I try to write to anywhere on the mounted fs I get a 'read-only fs' error.

So why is 'mount' falsely telling me that the fs is rw?  Dunno. I intentionally export that fs as read-only (which it actually is, despite what 'mount' says.

Can you think of any tests I can do to solve this riddle?
Comment 10 walt 2005-01-29 11:44:30 UTC
Hm.  I dunno whether I should feel stupid, or be annoyed:

When I add the '-o ro' flag to the 'mount' command then everything works as it
should.  'mount' then reports that the nfs-mounted directory is ro, and emerge
just prints a harmless warning that there is no write access.

Never occured to me that 'mount' couldn't figure out for itself that the fs
was read-only.

Is 'mount' being buggy, or am I being too picky?
Comment 11 Marius Mauch (RETIRED) gentoo-dev 2005-01-30 18:34:36 UTC
The problem could be that the kernel has no way to check if the NFS filesystem is read-only other than actually performing a write operation which you likely don't want to happen at mount time.