Wed, 16 Feb 05

“cvs checkout: failed to create lock directory” solution

Posted in Programming at 10:01 am by moore | Permalink

For those of us still using CVS, rather than the highly acclaimed subversion, I wanted to outline a solution to a common problem I’ve often seen:

One user creates a cvs module (named, for example, project) and checks in a number of files and directories. Then another developer tries to check out the module and sees this error. (Here’s another explanation of the solution.)

: cvs checkout: failed to create lock directory for
`/usr/local/cvsrepo/project'
(/usr/local/cvsrepo/project/#cvs.lock): Permission denied
: cvs checkout: failed to obtain dir lock in repository
`/usr/local/cvsrepo/project'
: cvs [checkout aborted]: read lock failed - giving up

If you go to /usr/local/cvsrepo/project, and run an ls -l, you’ll see that the permissions look like:

...
drwxrwxr-x 2 user group 4096 Feb 16 09:40 bin
...

This error message comes from the fact that the second user is not a member of group group. The best way to solve this is to create a second group, perhaps called cvs, and assign both users to that group.

Then, you want to make sure that all the files have the correct group bit set:
chown -R :cvs /usr/local/cvsrepo/project

And, you want to make sure that any new directories (and files) added use the cvs group, rather than the group group:
chmod -R g+ws /usr/local/cvsrepo/project

Your final permissions should look like:
...
drwxrwsr-x 2 user cvs 4096 Feb 16 09:40 bin
...

Now the second user and any other developers should be able to check out the code so safely stored in cvs.

5 Comments »

  1. Prateep Kulapalanont said,

    November 17, 2007 at 1:36 am

    Exactly what I have the problem after read CVS for Leopard .
    Thanks

  2. Pradeep said,

    November 23, 2007 at 6:49 am

    Hats Off Great work!
    Timely Help..

  3. surendra kumar said,

    November 5, 2008 at 11:46 am

    you saved my life man…!
    hats off
    thanks for the post man.

  4. moore said,

    November 5, 2008 at 5:02 pm

    All,

    Glad to help!

  5. Krishen said,

    November 13, 2008 at 10:16 am

    This just helped me out too on my Leopard-based CVS server! Thanks!

Leave a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image

© Moore Consulting, 2003-2008