<p>Just run <code>./bitcoind -reindex</code> and this will fix your problem. </p>

CC BY-SA 3.0
2013-10-09T16:31:11.877Z
2013-10-09T16:31:11.877Z
ManreeRist
<p>On Linux, the Bitcoin client data is kept in the <code>.bitcoin</code> directory in your home directory. Go to <code>~/.bitcoin/</code> 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.</p>

<p>If you remove <code>blkindex.dat</code>, 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.</p>

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

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

CC BY-SA 3.0
2012-12-21T00:23:01.173Z
2012-12-21T19:37:40.157Z
2012-12-21T19:37:40.157Z
Colin Dean
<p>To avoid having to redownload everything from the p2p network, which may be slow as you have to validate the whole chain, you can download the bootstrap chain file <a href="http://eu2.bitcoincharts.com/blockchain/" rel="nofollow noreferrer">from bitcoincharts.com</a></p>

<p>It is also available through bittorrent, which may be faster for you. Here's a copy of the message posted above and in the <a href="https://bitcointalk.org/index.php?topic=117982.0" rel="nofollow noreferrer">forums</a> that authenticate the file (through GPG).</p>

<pre><code>-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Torrent info hash: 0bb0521942f586ed96203c6f4d136324756f8a9a
Torrent magnet link:
magnet:?xt=urn:btih:0bb0521942f586ed96203c6f4d136324756f8a9a&amp;dn=bootstrap.dat

Filename: bootstrap.dat
Byte size: 2491771562
SHA1: e70ca90775dfdb13fd0014425805a0bdf4a31677
SHA256: a3f258e7af030165360596e4cb0b9beb24b4ce97352c22e65349b89ad5fc5d3e

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIVAwUBUHeHSdodwg8tvwyoAQJ2DA/8CcINxuD7DzLv96fE+R6GVLvRASLcy0ig
8d2YyDbJ9r9dPVODDPGC7I/ooDVJAcQsqdrLYHST2DTCt6c4zZ/7iXzFEahRopsH
PmxYOgkHie7438nqpmH9uC+d5t0pPHUFS6dBSBgdSVPaLfS86fToXrV/bx30rHBi
60FJz5A99aXrrrUny0cGIjafqVv8XjqNoA1lzjsRjeiu3EgTm8Ibcr8ZI6DLp/80
Siv3potlOArTI6sxjc/vKUa6nZILnW8mKdwc/d8LUdRaBPoo71c6Q4YOSQh/OVht
B1rZ8NEX/2SlS3PbhhMELcY/2wvgPGovkIqOgiw6dDIkhsD8iJAD1DqCkZbsq9S1
kKobGmceuQBcyRUCavkafdHJpZzyCAKLnQLV3FvZ3O4QZQVmYGPYn1H8a5UFRDQq
LGKcQmwm4Cet7162woEiNAaR9p7HvTJ4LV2uEvY56m2GfZbToCk2aiycO+v6Fm8K
ZY8cX+cbEOW3AM5rYVa6Rks029LIrFFzIutlo5MJ7uc7oMqciWrcsPtEh59QY+yJ
SENk6cLyWCAHl4jsvUTBvdNGy3fHKSEyQOjG5cmAMXiJTX/iiB/DJf7koTZAj4ub
wez3/HwuenMYjHgjsVXJAXprcEpTjpEcicg4W0MIDw07dPjol0dnRRNpwfJ1HMRc
dlTqLwlXqgs=
=uwRB
-----END PGP SIGNATURE-----
</code></pre>

<p>Also, here's a magnet link that includes trackers:</p>

<pre><code>magnet:?xt=urn:btih:0bb0521942f586ed96203c6f4d136324756f8a9a&amp;dn=bootstrap.dat&amp;tr=udp://tracker.openbittorrent.com:80&amp;tr=udp://tracker.publicbt.com:80&amp;tr=udp://tracker.ccc.de:80&amp;tr=udp://tracker.istole.it:80
</code></pre>

<p>Finally, as explained in <a href="https://bitcoin.stackexchange.com/questions/4145/can-i-regenerate-blkindex-dat-from-blk0001-dat">this answer</a>, you can also simply discard the index and regenerate it using the existing ondisk <code>blk000?.dat</code> files, using <code>-loadblock=blk0001.dat</code> and by deleting <code>blkindex.dat</code>.</p>

<p>Edit: note that with bitcoind 0.8 and up, it's actually easier and faster to just download the block chain from the network directly, so don't bother with the bittorrent/manual download.</p>

CC BY-SA 3.0
2013-02-18T20:28:35.887Z
2013-04-30T04:10:11.917Z
2017-04-13T12:47:36.707Z
anarcat
<p>I've installed Bitcoin-Qt after a clean WUBI install, and installed Bitcoin-Qt directly. Now it suddenly says "Error loading <code>blkindex.dat</code>".</p>

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

<p>How can I solve this issue?</p>

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

<pre><code>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
</code></pre>

<p>You should be able to find this in <code>~/.bitcoin/db.log</code>. This problem occured when interrupting the client suddenly or maybe because two of them opened the database at the same time.</p>

CC BY-SA 3.0
2012-12-21T19:34:33.533Z
I have this problem all the time. I just erase blk* but it will take 2 days long to download all blockchain again. I don't know why it is happening. I think it is a problem of the recent version.
Felipe
<block><ubuntu>
How can I recover from a corrupted blkindex.dat on Ubuntu 12.10?
Hyperfocus
# How can I recover from a corrupted blkindex.dat on Ubuntu 12.10?

(Asked by: username_0 on 2012-12-20)

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.

**Tags:** block, ubuntu

> **Comments:**
> **username_1**: I have this problem all the time. I just erase blk* but it will take 2 days long to download all blockchain again. I don't know why it is happening. I think it is a problem of the recent version.  

---

## 3 answers

### Answer by username_2 on 2013-10-09. Score: 6

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


---

### Answer by username_3 on 2012-12-21. Score: 6

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.*


---

### Answer by username_4 on 2013-02-18. Score: 3

To avoid having to redownload everything from the p2p network, which may be slow as you have to validate the whole chain, you can download the bootstrap chain file [from bitcoincharts.com](http://eu2.bitcoincharts.com/blockchain/)

It is also available through bittorrent, which may be faster for you. Here's a copy of the message posted above and in the [forums](https://bitcointalk.org/index.php?topic=117982.0) that authenticate the file (through GPG).

```
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Torrent info hash: 0bb0521942f586ed96203c6f4d136324756f8a9a
Torrent magnet link:
magnet:?xt=urn:btih:0bb0521942f586ed96203c6f4d136324756f8a9a&dn=bootstrap.dat

Filename: bootstrap.dat
Byte size: 2491771562
SHA1: e70ca90775dfdb13fd0014425805a0bdf4a31677
SHA256: a3f258e7af030165360596e4cb0b9beb24b4ce97352c22e65349b89ad5fc5d3e

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIVAwUBUHeHSdodwg8tvwyoAQJ2DA/8CcINxuD7DzLv96fE+R6GVLvRASLcy0ig
8d2YyDbJ9r9dPVODDPGC7I/ooDVJAcQsqdrLYHST2DTCt6c4zZ/7iXzFEahRopsH
PmxYOgkHie7438nqpmH9uC+d5t0pPHUFS6dBSBgdSVPaLfS86fToXrV/bx30rHBi
60FJz5A99aXrrrUny0cGIjafqVv8XjqNoA1lzjsRjeiu3EgTm8Ibcr8ZI6DLp/80
Siv3potlOArTI6sxjc/vKUa6nZILnW8mKdwc/d8LUdRaBPoo71c6Q4YOSQh/OVht
B1rZ8NEX/2SlS3PbhhMELcY/2wvgPGovkIqOgiw6dDIkhsD8iJAD1DqCkZbsq9S1
kKobGmceuQBcyRUCavkafdHJpZzyCAKLnQLV3FvZ3O4QZQVmYGPYn1H8a5UFRDQq
LGKcQmwm4Cet7162woEiNAaR9p7HvTJ4LV2uEvY56m2GfZbToCk2aiycO+v6Fm8K
ZY8cX+cbEOW3AM5rYVa6Rks029LIrFFzIutlo5MJ7uc7oMqciWrcsPtEh59QY+yJ
SENk6cLyWCAHl4jsvUTBvdNGy3fHKSEyQOjG5cmAMXiJTX/iiB/DJf7koTZAj4ub
wez3/HwuenMYjHgjsVXJAXprcEpTjpEcicg4W0MIDw07dPjol0dnRRNpwfJ1HMRc
dlTqLwlXqgs=
=uwRB
-----END PGP SIGNATURE-----

```

Also, here's a magnet link that includes trackers:

```
magnet:?xt=urn:btih:0bb0521942f586ed96203c6f4d136324756f8a9a&dn=bootstrap.dat&tr=udp://tracker.openbittorrent.com:80&tr=udp://tracker.publicbt.com:80&tr=udp://tracker.ccc.de:80&tr=udp://tracker.istole.it:80

```

Finally, as explained in [this answer](https://bitcoin.stackexchange.com/questions/4145/can-i-regenerate-blkindex-dat-from-blk0001-dat), you can also simply discard the index and regenerate it using the existing ondisk `blk000?.dat` files, using `-loadblock=blk0001.dat` and by deleting `blkindex.dat`.

Edit: note that with bitcoind 0.8 and up, it's actually easier and faster to just download the block chain from the network directly, so don't bother with the bittorrent/manual download.


---

