How can I recover from a corrupted blkindex.dat on Ubuntu 12.10? I've installed Bitcoin-Qt after a clean WUBI install, and installed Bitcoin-Qt directly. Now it suddenly says "Error loading blkindex.dat".

I assume my blkindex.dat file is corrupted, and I tried reinstalling Bitcoin-Qt with apt but it didn't work. Maybe if I delete the blkindex.dat file it will try to create it again, but I don't know where the installation folder is.

How can I solve this issue?

Extra information (added by other user); the error will likely look like this:

file blkindex.dat has LSN 727/2518588, past end of log at 727/1519938
Commonly caused by moving a database from one database environment
to another without clearing the database LSNs, or by removing all of
the log files from a database environment
__db_meta_setup: /home/user/.bitcoin/blkindex.dat: unexpected file type or format


You should be able to find this in ~/.bitcoin/db.log. This problem occured when interrupting the client suddenly or maybe because two of them opened the database at the same time.
On Linux, the Bitcoin client data is kept in the .bitcoin directory in your home directory. Go to ~/.bitcoin/ and you'll see the files in there. You may need to toggle Show Hidden Files in your file manager in order to see the directory.

If you remove blkindex.dat, the client will have to redownload the blockchain. I just tested this locally by moving my copy of the file to another file name temporarily - the client resync'd.

Since your copy of the index is corrupted apparently, it sounds like you need to delete it and resync.

A note: be careful to do not erase your wallet.dat. I recommend you back it up before. Your wallet.dat is your private keys.