Eric Roller's Development Blog

SVN database corrupted by root

- Posted in General by

Seen errors like this, e.g. upon "svn update" issued on a remote machine when the repository is on a server:

svn: Berkeley DB error for filesystem '.../Repositories/proj/db' while
opening 'nodes' table: Invalid argument
svn: bdb: file nodes (meta pgno = 0) has LSN [95][515282].
svn: bdb: end of log is [95][14597]
svn: bdb: .../Repositories/proj/db/nodes: unexpected file type or

Not sure what the main cause is, but it could be a bug with svnserve since it is the one who is running as root. Login with ssh on the server and cd to the directory mentioned in the error:

cd Repositories/proj/db
ls -l
-rw-r--r--   1 root  goblin   1048576 Aug  4 17:42 log.0000000095
-rw-r--r--   1 root  goblin   1048576 Aug  4 17:52 log.0000000096

Notice that there are files whose owner is root while the other files (not shown) are owned by globlin. We can fix that with chmod:

sudo chown goblin log.000000009*
cd ../..
svnadmin recover proj

Back on the remote machine, try again to run "svn update".