BitcoinTalk
Having problems specifing -datadir

View Satoshi only

External link

Whilst not amazingly critical, i find it strange that i consistently get the below error messages from the console and debug.log when i try to specify the datadir option with anything other than the period char (current directory).
This is using the bitcoind program on an archlinux terminal session, im not using the GUI at all (headless box accessed via ssh)

From Console:
************************
EXCEPTION: 22DbRunRecoveryException
DbEnv::open: DB_RUNRECOVERY: Fatal error, run database recovery
bitcoin in AppInit()

terminate called after throwing an instance of 'DbRunRecoveryException'
  what():  DbEnv::open: DB_RUNRECOVERY: Fatal error, run database recovery

and from the debug.log inside the datadir : -

Bitcoin version 0.3.4.0 beta
Default data directory /home/psyvenrix/.bitcoin
Bound to port 8333
Loading addresses...
dbenv.open strLogDir=./datadir2/database strErrorFile=./datadir2/db.log


************************
EXCEPTION: 22DbRunRecoveryException
DbEnv::open: DB_RUNRECOVERY: Fatal error, run database recovery
bitcoin in AppInit()

Yes, that is a SVN build, as the tar.gz from the main site is linked against openssl ver 0.9.8 i think and my arch linux system has 1.0.0 i think, so i just grabed the latest SVN source and built that (aside from a makefile tweak it compiled ok).

ive checked the permissions on both the directory containing the binaries and the aforementioned datadir, all are writable by my login (& no other ACL/SELinux trickery in the background either)

I have only just started using bitcoin, so i find it strange that it's throwing a recovery type error when the contents of that directory are freshly generated (i.e. i can rm -rf the lot, then start bitcoind with a new non-existent directory, watch it create the files needed then bomb out)

Thoughts anyone? Huh
Does it work if you specify the full path?  e.g. -datadir=/home/psyvenrix/datadir2  ?
It was able to reproduce this.  The database doesn't like the relative path.

"bitcoind -datadir=./subdir getinfo" works against a running daemon, but trying to start the daemon as "bitcoind -datadir=./subdir" gets that exception.

I guess we should resolve the full path before passing it to the database.

It looks like you were the first one to ever use -datadir with a relative path.
+1 for quick bug fix. I'd like to be able to do that, too.
It was able to reproduce this.  The database doesn't like the relative path.

"bitcoind -datadir=./subdir getinfo" works against a running daemon, but trying to start the daemon as "bitcoind -datadir=./subdir" gets that exception.

I guess we should resolve the full path before passing it to the database.

It looks like you were the first one to ever use -datadir with a relative path.
I've tried to do it before too, but I never considered it a large enough bug to report. It would be nice to see a fix, though.
Fixed in SVN rev 130.