bitcoind: corrupted database?

1

looris@Palace-of-the-Nine-Moons:/tmp $ bitcoind 
looris@Palace-of-the-Nine-Moons:/tmp $ Bitcoin server starting


************************
EXCEPTION: St13runtime_error       
CLevelDB(): error opening database environment Corruption: missing start of fragmented record(2)       
bitcoin in AppInit()       

This happens when I start bitcoind, any clue on what could I do to fix it?

I tried to run it with -rescan but the result was the same.

o0'.

Posted 2013-02-13T19:51:59.833

Reputation: 5 180

I suspect it would be faster to redownload the blockchain than fix this, but here's where your error is being thrown from

Nick ODell 2013-02-13T23:25:40.240

1@NickODell doing it, but it takes me more than 24h to download it all, if this bug happens again I'd really need a quicker way to fix it...o0'. 2013-02-13T23:42:53.523

1

Agreed. Actually, this seems more relevant to your problem. It would appear that if it loads a record of type kLastType which isn't preceeded by kFirstType, then it will put out that error message.

Nick ODell 2013-02-14T00:04:17.757

@NickODell oh thank you, that would be useful. Now I'm re-downloading anyway, but I've not deleted the corrupted db yet...o0'. 2013-02-14T09:50:59.717

1You need -reindex, not -rescan (which is for finding missing wallet transactions).Pieter Wuille 2013-02-18T22:28:00.393

Answers

4

Just run ./bitcoind -reindex and this will fix your problem.

-rescan is for missing wallet transactions

ManreeRist

Posted 2013-02-13T19:51:59.833

Reputation: 737

0

Try to look in the ~/.bitcoin/db.log file for more information. It is likely that your only solution is to remove the block database (either blk0001.dat, blk0002.dat or blkindex.dat). DO NOT REMOVE YOUR wallet.dat file!!!

This means you will have to download the whole block chain again. This other question has tips on how to speed up that download.

Note that this may just be another case of the question asked here.

anarcat

Posted 2013-02-13T19:51:59.833

Reputation: 143

Don't advise people to wipe their data directories. Since 0.8, we have -reindex which rebuilds them without redownloading.Pieter Wuille 2013-10-09T17:51:55.917