When trying to commit to a subversion repository whose host has just changed from Debian Lenny (5.0) to Squeeze (6.0), i.e. from libdb4.6 to libdb4.8, the following error message could happen:
```
svn: Commit failed (details follow):
svn: Berkeley DB error for filesystem '/var/lib/subversion/foobar/db' while opening environment:
svn: DB_VERSION_MISMATCH: Database environment version mismatch
svn: bdb: Program version 4.8 doesn't match environment version 4.6
```
Solution
--------
### Download and Install db4.6-utils and libdb4.6 from Lenny
* Go to http://packages.debian.org/lenny/db4.6-util and http://packages.debian.org/lenny/libdb4.6 and download the packages for the appropriate architecture from a mirror close to you.
* Install those two packages with `dpkg -i db4.6-util_4.6.21-16_*.deb libdb4.6_4.6.21-16_*.deb`
### Fix the repository
It's surely no bad idea to not do that on the live repository but on a copy until you're sure it worked
```
# cd /var/lib/subversion/
# rsync -av foobar/ foobar-to-repair/
[…]
# cd foobar-to-repair/db/
# db4.6_checkpoint -1
# db4.6_recover
# db4.6_archive
log.0000000009
# svnlook youngest ..
132
# db4.8_archive -d
# cd /var/lib/subversion
# mv -vi foobar foobar-lenny-db4.6
`foobar' -> `foobar-lenny-db4.6'
# mv -vi foobar-to-repair foobar
`foobar-to-repair' -> `foobar'
```
(Based on [this µHowto](http://javier.rodriguez.org.mx/index.php/2006/08/21/howtoget-over-subversions-db_version_mismatch-error))
In our case no permission changes were necessary after fixing the BDB.
Solution for transition between older Debian releases
It works identically for the transition from Debian Etch (4.0) to Debian Lenny (5.0), too, just use db4.4 instead of db4.6 and db4.6 instead db4.8. See also the history of this wiki page.
If you get some "munmap: Invalid argument" errors they don't seem to cause any harm.