Bitcoin Forum
June 29, 2024, 11:57:12 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: can't open database wallet.dat  (Read 2548 times)
CryptoPanda (OP)
Sr. Member
****
Offline Offline

Activity: 882
Merit: 302


View Profile
July 21, 2014, 02:18:13 PM
 #1

ok i get this now when trying to run bitcoind getinfo for example
error: {"code":-1,"message":"CDB : Error -30974, can't open database wallet.dat"}

the wallet was encrypted, i have the pass, there is some small amount in there, how would one approach it from here?


Dare
Hero Member
*****
Offline Offline

Activity: 508
Merit: 500


Techwolf on #bitcoin and Reddit


View Profile WWW
July 21, 2014, 05:47:54 PM
 #2

Try calling `bitcoind walletpassphrase <passphrase> <unlock timeout>` (from the wiki) before API calls that involve the wallet.

BTC: 1M8oUcBnkRDEhWWgV8ZXLTB6p1mgnejVbX
How Forum Activity Works
Bitcointalk Forum Rules
|
|
|
Firstbits (lucky vanitygen): 1WoLfRUGDx1
How Forum Trust Works
Bitcoin Source Code
btchris
Hero Member
*****
Offline Offline

Activity: 672
Merit: 504

a.k.a. gurnec on GitHub


View Profile WWW
July 21, 2014, 06:15:38 PM
 #3

error: {"code":-1,"message":"CDB : Error -30974, can't open database wallet.dat"}

This error is DB_RUNRECOVERY.

Assuming a simple restart doesn't fix it, there are two things I'd try.

If you're on Linux, you probably have easy access to the Berkeley DB tools. On Debian/Ubuntu, they can be installed with "sudo apt-get install db-util". After closing bitcoind and making a backup of the wallet.dat file, try running "db_recover -c wallet.dat" from inside the .bitcoin directory. If that succeeds, you're probably all set.

If you're not on Linux, or if the above doesn't succeed, try running "bitcoind -salvagewallet" (Bitcoin will make a backup on its own before trying to run the salvage routine).

If this also doesn't work and you're on Linux, look over here for another option.

If you're still having problems, pywallet is probably your next option, however it's got its own problems (that I mention in the post above).

Good luck!
CryptoPanda (OP)
Sr. Member
****
Offline Offline

Activity: 882
Merit: 302


View Profile
July 22, 2014, 11:54:19 AM
 #4

Try calling `bitcoind walletpassphrase <passphrase> <unlock timeout>` (from the wiki) before API calls that involve the wallet.

yes that's necessary when you want to spend or create new address, but for just starting, getinfo and getbalance, should not be needed, right?
CryptoPanda (OP)
Sr. Member
****
Offline Offline

Activity: 882
Merit: 302


View Profile
August 05, 2014, 05:35:26 PM
 #5

error: {"code":-1,"message":"CDB : Error -30974, can't open database wallet.dat"}

This error is DB_RUNRECOVERY.

Assuming a simple restart doesn't fix it, there are two things I'd try.

If you're on Linux, you probably have easy access to the Berkeley DB tools. On Debian/Ubuntu, they can be installed with "sudo apt-get install db-util". After closing bitcoind and making a backup of the wallet.dat file, try running "db_recover -c wallet.dat" from inside the .bitcoin directory. If that succeeds, you're probably all set.

If you're not on Linux, or if the above doesn't succeed, try running "bitcoind -salvagewallet" (Bitcoin will make a backup on its own before trying to run the salvage routine).

If this also doesn't work and you're on Linux, look over here for another option.

If you're still having problems, pywallet is probably your next option, however it's got its own problems (that I mention in the post above).

Good luck!

that's very helpful, thank you!
I installed Berkeley DB tools but when execute db_recover -c wallet.dat in the .bitcoin dir i get just
".bitcoin$ db_recover -c wallet.dat
usage: db_recover [-cefVv] [-h home] [-P password] [-t [[CC]YY]MMDDhhmm[.SS]]"



also when i run bitcoind, it finds the corrupt wallet and attemps salvagint automatically. It actually reports it salvaged the data (and just copied a back-up of the original file before the salvaging as .bak file)
but then when i start it again with the supposedly salvaged wallet it says "Wallet corrupted"

so, the bitcoin salvaging doesn't seem to work for me, hopefully the db tool will do the trick as soon as i can get it to work Smiley
btchris
Hero Member
*****
Offline Offline

Activity: 672
Merit: 504

a.k.a. gurnec on GitHub


View Profile WWW
August 05, 2014, 05:58:21 PM
 #6

that's very helpful, thank you!
I installed Berkeley DB tools but when execute db_recover -c wallet.dat in the .bitcoin dir i get just
".bitcoin$ db_recover -c wallet.dat
usage: db_recover [-cefVv] [-h home] [-P password] [-t [[CC]YY]MMDDhhmm[.SS]]"


also when i run bitcoind, it finds the corrupt wallet and attemps salvagint automatically. It actually reports it salvaged the data (and just copied a back-up of the original file before the salvaging as .bak file)
but then when i start it again with the supposedly salvaged wallet it says "Wallet corrupted"

so, the bitcoin salvaging doesn't seem to work for me, hopefully the db tool will do the trick as soon as i can get it to work Smiley

My mistake, do not include the wallet file name, I should have said run "db_recover -cv" from inside the .bitcoin directory and it will attempt to do a recovery of all wallets in the directory. On second thought though, I don't think this will help. I think it only helps if there are BerkeleyDB .log files still present, and Bitcoin removes all BerkeleyDB logs before exiting, so this command probably won't do anything (but it doesn't hurt).

I'd try the db_dump/db_load process instead, starting with the original wallet file (not the one which Bitcoin created in its attempt to do a salvage). If that still doesn't work, then it's on to pywallet...
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!