I had to delete my .bitcoin directory in Ubuntu 12.10, after months of getting the near 9 GB of blk data files.

I copied everything over to another machine (and back to the original too) and it gives me:

A fatal error occurred. Bitcoin can no longer continue safely and will quit.
EXCEPTION: St13runtime_error
CDB() : can't open database file blkindex.dat, error 22
bitcoin in Runaway exception

I tried chmod +w on the files, but still no go.

1 Answer 1


Two things come to mind as possible reasons.

The most probable reason is that you've switched client versions. There was a switch between 0.7 and 0.8 in how the block index (not the block data itself) was stored; it was changed from BerkeleyDB to LevelDB. If you remove the blkindex.dat (and really want to keep an index around, which is unlikely) you can restart the client with -rescan and -txindex. It will take a while (an hour?) to complete the indexing.

The other reason that I can think of is that it's genuinely corrupt, but that's unlikely.

  • No I used the same client version, bitcoinqt, each time. I tried this on the original system used for DL'ing all the block files. Which was ubuntu 12.04 LTS and another newer system Ubuntu 12.10. Both with the 0.7 bitcoin. I'm not familiar with running bitcoin from command line yet. Silly question but can you use (send , receive bitcoins , etc) without having to get all those massive block files? I could fine no answer to this anywhere else.
    – maxwell
    Apr 3, 2013 at 15:48
  • I deleted (moved to temp directory) the blkindex.dat file and then started ./bitcoind from command line with -rescan and -txindex options. It started running but it wiped out most of the blk0004.dat file and so wants to download yet another 2 gigs of data. Is this the only way?
    – maxwell
    Apr 3, 2013 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.