Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: Raini1110 on November 27, 2021, 11:27:30 AM



Title: Bitcoin Core 0.21 - error opening block database
Post by: Raini1110 on November 27, 2021, 11:27:30 AM
Hello.

I had a power outage while I was syncing my Bitcoin Coren Wallet.
Now I get the error " error opening block database".
How can I fix this error?

I have all the data and wallet backup at hand.

Maybe someone can help me in German language?

Thanks.


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: o_solo_miner on November 27, 2021, 11:41:15 AM
Well, it would be best to go to the german section then:
https://bitcointalk.org/index.php?board=16.0

Dort kannst du auch in Deutsch schreiben.


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: Raini1110 on November 27, 2021, 04:19:19 PM
Well, it would be best to go to the german section then:
https://bitcointalk.org/index.php?board=16.0

Dort kannst du auch in Deutsch schreiben.

Thank you very much. Can you maybe answer my question too?


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: o_solo_miner on November 27, 2021, 05:08:48 PM
I try, even you missed to tell us the OS you are using (Windows/Linux/Apple).
If you start bitcoind with the option --reindex, it will reload the relevant parts missing.

*Edit: corrected the switch name


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: Raini1110 on November 27, 2021, 08:42:39 PM
I try, even you missed to tell us the OS you are using (Windows/Linux/Apple).
If you start bitcoind with the option --reindex, it will reload the relevant parts missing.

*Edit: corrected the switch name

I use Windows 7.
Ok, Bitcoind I ran and download everything. Can I run Bitcoin Core normally again or is there anything else I need to be aware of?
Thanks


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: nc50lc on November 28, 2021, 06:43:32 AM
Ok, Bitcoind I ran and download everything. Can I run Bitcoin Core normally again or is there anything else I need to be aware of?
If the error persist after reaching the height where you've encountered the error, your blockchain may have been corrupted by the sudden shutdown.
If so, you can open your "debug.log" file from bitcoin data directory (default location (https://en.bitcoin.it/wiki/Data_directory#Default_Location)) to check for errors related to the corrupted block or for possible other issues.

If there's no error and you've reached the tip of the blockchain, then it's good.


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: Raini1110 on November 28, 2021, 01:49:07 PM
Ok, Bitcoind I ran and download everything. Can I run Bitcoin Core normally again or is there anything else I need to be aware of?
If the error persist after reaching the height where you've encountered the error, your blockchain may have been corrupted by the sudden shutdown.
If so, you can open your "debug.log" file from bitcoin data directory (default location (https://en.bitcoin.it/wiki/Data_directory#Default_Location)) to check for errors related to the corrupted block or for possible other issues.

If there's no error and you've reached the tip of the blockchain, then it's good.

Thank you. I see errors in the debug.

May I show this last section here? I do not know what to do.

Can I delete files until the last sync?
Can I save the blockchain and restart it in case of a PC crash?

MFG
Raimund


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: nc50lc on November 28, 2021, 02:26:26 PM
If the error persist after reaching the height where you've encountered the error, your blockchain may have been corrupted by the sudden shutdown.
If so, you can open your "debug.log" file from bitcoin data directory (default location (https://en.bitcoin.it/wiki/Data_directory#Default_Location)) to check for errors related to the corrupted block or for possible other issues.
Thank you. I see errors in the debug.

May I show this last section here? I do not know what to do.
The error may be logged before you opened bitcoind with reindex, have you experienced the same error after -reindex?
Yes you can, there's nothing in the debug log that can compromise your private keys, only some privacy-related info.

Quote from: Raini1110
Can I delete files until the last sync?
Can I save the blockchain and restart it in case of a PC crash?
  • (CMIIAW) I think you can delete the last block file and Bitcoin Core will detect it and issue -reindex then it will sync starting from the last valid block.
    However, if your blockchain is pruned, it will sync from start if you do that.
  • Yes, but not just the blockchain, if you're going to back it up, you may as well backup the whole data directory.


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: Raini1110 on November 28, 2021, 04:39:28 PM
If the error persist after reaching the height where you've encountered the error, your blockchain may have been corrupted by the sudden shutdown.
If so, you can open your "debug.log" file from bitcoin data directory (default location (https://en.bitcoin.it/wiki/Data_directory#Default_Location)) to check for errors related to the corrupted block or for possible other issues.
Thank you. I see errors in the debug.

May I show this last section here? I do not know what to do.
The error may be logged before you opened bitcoind with reindex, have you experienced the same error after -reindex?
Yes you can, there's nothing in the debug log that can compromise your private keys, only some privacy-related info.

Quote from: Raini1110
Can I delete files until the last sync?
Can I save the blockchain and restart it in case of a PC crash?
  • (CMIIAW) I think you can delete the last block file and Bitcoin Core will detect it and issue -reindex then it will sync starting from the last valid block.
    However, if your blockchain is pruned, it will sync from start if you do that.
  • Yes, but not just the blockchain, if you're going to back it up, you may as well backup the whole data directory.

Ok I will try.

Here is the last section of Debug.


2021-11-27T22:36:46Z Bitcoin Core version v22.0.0 (release build)
2021-11-27T22:36:46Z Qt 5.12.11 (static), plugin=windows (static)
2021-11-27T22:36:46Z Static plugins:
2021-11-27T22:36:46Z  QWindowsIntegrationPlugin, version 330752
2021-11-27T22:36:46Z  QWindowsVistaStylePlugin, version 330752
2021-11-27T22:36:46Z Style: windowsvista / QWindowsVistaStyle
2021-11-27T22:36:46Z System: Windows 7 SP 1 (6.1), x86_64-little_endian-llp64
2021-11-27T22:36:46Z Screen: \\.\DISPLAY1 1280x800, pixel ratio=1.0
2021-11-27T22:36:52Z Assuming ancestors of block 00000000000000000008a89e854d57e5667df88f1cdef6fde2fbca1de5b639ad have valid signatures.
2021-11-27T22:36:52Z Setting nMinimumChainWork=00000000000000000000000000000000000000001fa4663bbbe19f82de910280
2021-11-27T22:36:52Z Using the 'sse4(1way),sse41(4way)' SHA256 implementation
2021-11-27T22:36:52Z GUI: "registerShutdownBlockReason: Successfully registered: Bitcoin Core noch nicht sicher beendet…"
2021-11-27T22:36:52Z Default data directory C:\Users\Raini\AppData\Roaming\Bitcoin
2021-11-27T22:36:52Z Using data directory E:\Bitcoin
2021-11-27T22:36:52Z Config file: E:\Bitcoin\bitcoin.conf
2021-11-27T22:36:52Z Using at most 125 automatic connections (2048 file descriptors available)
2021-11-27T22:36:52Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2021-11-27T22:36:52Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2021-11-27T22:36:52Z Script verification uses 1 additional threads
2021-11-27T22:36:52Z scheduler thread start
2021-11-27T22:36:52Z Using wallet directory E:\Bitcoin
2021-11-27T22:36:52Z init message: Überprüfe Wallet(s)...
2021-11-27T22:36:52Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2021-11-27T22:36:52Z Using wallet E:\Bitcoin\wallet.dat
2021-11-27T22:36:52Z BerkeleyEnvironment::Open: LogDir=E:\Bitcoin\database ErrorFile=E:\Bitcoin\db.log
2021-11-27T22:36:53Z init message: Lade Bannliste…
2021-11-27T22:36:53Z SetNetworkActive: true
2021-11-27T22:36:53Z Using /16 prefix for IP bucketing
2021-11-27T22:36:53Z Cache configuration:
2021-11-27T22:36:53Z * Using 2.0 MiB for block index database
2021-11-27T22:36:53Z * Using 8.0 MiB for chain state database
2021-11-27T22:36:53Z * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
2021-11-27T22:36:53Z init message: Lade Block-Index...
2021-11-27T22:36:53Z Switching active chainstate to Chainstate [ibd] @ height -1 (null)
2021-11-27T22:36:53Z Opening LevelDB in E:\Bitcoin\blocks\index
2021-11-27T22:36:53Z Fatal LevelDB error: Corruption: 41 missing files; e.g.: E:\Bitcoin\blocks\index/000313.ldb
2021-11-27T22:36:53Z You can use -debug=leveldb to get more complete diagnostic messages
2021-11-27T22:36:53Z Fatal LevelDB error: Corruption: 41 missing files; e.g.: E:\Bitcoin\blocks\index/000313.ldb
2021-11-27T22:36:53Z : Error opening block database.
Please restart with -reindex or -reindex-chainstate to recover.
2021-11-27T22:36:55Z init message: Lade Block-Index...
2021-11-27T22:36:55Z should not be overwriting a chainstate
2021-11-27T22:36:55Z Error: Error opening block database
2021-11-27T22:36:56Z Shutdown: In progress...
2021-11-27T22:36:56Z scheduler thread exit
2021-11-27T22:36:56Z Shutdown: done


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: o_solo_miner on November 28, 2021, 05:09:36 PM
As I can see the fault now:

Code:
2021-11-27T22:36:53Z Opening LevelDB in E:\Bitcoin\blocks\index
2021-11-27T22:36:53Z Fatal LevelDB error: Corruption: 41 missing files; e.g.: E:\Bitcoin\blocks\index/000313.ldb
2021-11-27T22:36:53Z You can use -debug=leveldb to get more complete diagnostic messages
2021-11-27T22:36:53Z Fatal LevelDB error: Corruption: 41 missing files; e.g.: E:\Bitcoin\blocks\index/000313.ldb
2021-11-27T22:36:53Z : Error opening block database.
Please restart with -reindex or -reindex-chainstate to recover.

the best way will be starting bitcoin-qt from the cmd with the suggested -reindex

So you need to press [Start] and in the [Eingabeaufforderung] you type cmd to get a console
there you cd into your folder where bitcoin-qt is located
now you type: bitcoin-qt.exe -reindex and press enter


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: Raini1110 on November 28, 2021, 08:16:57 PM
As I can see the fault now:

Code:
2021-11-27T22:36:53Z Opening LevelDB in E:\Bitcoin\blocks\index
2021-11-27T22:36:53Z Fatal LevelDB error: Corruption: 41 missing files; e.g.: E:\Bitcoin\blocks\index/000313.ldb
2021-11-27T22:36:53Z You can use -debug=leveldb to get more complete diagnostic messages
2021-11-27T22:36:53Z Fatal LevelDB error: Corruption: 41 missing files; e.g.: E:\Bitcoin\blocks\index/000313.ldb
2021-11-27T22:36:53Z : Error opening block database.
Please restart with -reindex or -reindex-chainstate to recover.

the best way will be starting bitcoin-qt from the cmd with the suggested -reindex

So you need to press [Start] and in the [Eingabeaufforderung] you type cmd to get a console
there you cd into your folder where bitcoin-qt is located
now you type: bitcoin-qt.exe -reindex and press enter


I do not understand how to enter correctly.

CMD is ok.
See now
C:\Users\Raini\

My bitcoin-pt.exe
is located at
C:\Program Files\Bitcoin\bitcoin-pt.exe

How do I enter the data?

My data is stored externally on a memory E:\Bitcoin


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: vv181 on November 28, 2021, 08:36:54 PM
You can use datadir=<dir>

With that, the command should look like:
Code:
bitcoin-qt.exe -datadir=E:\Bitcoin -reindex


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: Raini1110 on November 28, 2021, 10:29:41 PM
You can use datadir=<dir>

With that, the command should look like:
Code:
bitcoin-qt.exe -datadir=E:\Bitcoin -reindex

Thank you, does not work.
This command does not work for me.

C:\Users\Raini>bitcoin-qt.exe -dir=E:\Bitcoin -reindex
The command "bitcoin-qt.exe" is either misspelled or
could not be found.

C:\Users\Raini>bitcoin-qt.exe -datadir=E:\Bitcoin -reindex
The command "bitcoin-qt.exe" is either misspelled or
could not be found.


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: nc50lc on November 29, 2021, 01:58:53 AM
-snip-
C:\Users\Raini>bitcoin-qt.exe -dir=E:\Bitcoin -reindex
You should start cmd in the directory where bitcoin-qt is located or change the working directory using "cd" command.
eg.:
Code:
cd C:\Program Files\Bitcoin
Then enter the command vv181 instructed you to use.


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: Raini1110 on November 29, 2021, 02:26:14 PM
-snip-
C:\Users\Raini>bitcoin-qt.exe -dir=E:\Bitcoin -reindex
You should start cmd in the directory where bitcoin-qt is located or change the working directory using "cd" command.
eg.:
Code:
cd C:\Program Files\Bitcoin
Then enter the command vv181 instructed you to use.

Ok, Bitcoin Core is open and doing Reindex. nothing to see.
What is that? vv181
Does not work for me in cmd

Thanks a lot.


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: vv181 on November 29, 2021, 03:18:31 PM
Ok, Bitcoin Core is open and doing Reindex. nothing to see.
What is that? vv181
Does not work for me in cmd

Thanks a lot.
Yeah, there is nothing to show in cmd. The command you entered on cmd is meant to open up Bitcoin Core (bitcoin-qt) with some additional configuration.

The -datadir=<dir> is a config to specify the data location of your Bitcoin Core, and what the -reindex did is to rebuild your block index and chain state(or to simplify it, it rebuild the blockchain).

As why the problem arises, it is likely caused by the power outage when you are still syncing. So the PC got unclean shutdown, and the data got corrupted because of it. You can see that in the debug.log you posted:
Code:
2021-11-27T22:36:53Z Opening LevelDB in E:\Bitcoin\blocks\index
2021-11-27T22:36:53Z Fatal LevelDB error: Corruption: 41 missing files; e.g.: E:\Bitcoin\blocks\index/000313.ldb
2021-11-27T22:36:53Z : Error opening block database.
Please restart with -reindex or -reindex-chainstate to recover.

So, if your Bitcoin Core is opening up and it reindexing, it should be good to go. It will rebuild the blockchain and will continue to sync it.

On a side note, how much RAM do you have available? If you have a pretty much available ram you might want to bump up the dbcache, it will speed up your syncing process.


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: Raini1110 on November 29, 2021, 04:54:48 PM
Ok, Bitcoin Core is open and doing Reindex. nothing to see.
What is that? vv181
Does not work for me in cmd

Thanks a lot.
Yeah, there is nothing to show in cmd. The command you entered on cmd is meant to open up Bitcoin Core (bitcoin-qt) with some additional configuration.

The -datadir=<dir> is a config to specify the data location of your Bitcoin Core, and what the -reindex did is to rebuild your block index and chain state(or to simplify it, it rebuild the blockchain).

As why the problem arises, it is likely caused by the power outage when you are still syncing. So the PC got unclean shutdown, and the data got corrupted because of it. You can see that in the debug.log you posted:
Code:
2021-11-27T22:36:53Z Opening LevelDB in E:\Bitcoin\blocks\index
2021-11-27T22:36:53Z Fatal LevelDB error: Corruption: 41 missing files; e.g.: E:\Bitcoin\blocks\index/000313.ldb
2021-11-27T22:36:53Z : Error opening block database.
Please restart with -reindex or -reindex-chainstate to recover.

So, if your Bitcoin Core is opening up and it reindexing, it should be good to go. It will rebuild the blockchain and will continue to sync it.

On a side note, how much RAM do you have available? If you have a pretty much available ram you might want to bump up the dbcache, it will speed up your syncing process.

It works, thank you. ;)
Synchronization has now been recorded. Still 9 years behind. The synchronization will take 3 days. How do I increase the dbcach?
I have 8 GB of RAM.


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: nc50lc on November 30, 2021, 03:28:47 AM
-snip- The synchronization will take 3 days. How do I increase the dbcach?
I have 8 GB of RAM.
You can set it in bitcoin-qt's setting or in the config file.
Since you're using QT: Open the menu "Settings->Options...", then put a reasonable value in "Size of database cache".
More or less half of your RAM, depending on the usage.

That requires you to restart Bitcoin core as the red message below the setting will say.


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: Raini1110 on December 09, 2021, 10:09:21 AM
-snip- The synchronization will take 3 days. How do I increase the dbcach?
I have 8 GB of RAM.
You can set it in bitcoin-qt's setting or in the config file.
Since you're using QT: Open the menu "Settings->Options...", then put a reasonable value in "Size of database cache".
More or less half of your RAM, depending on the usage.

That requires you to restart Bitcoin core as the red message below the setting will say.

Hello,
it all worked well and arrived in 2021 with synchronization. Now I had a power failure again and wanted to synchronize with
C:\Users\Raini>bitcoin-qt.exe -dir=E:\Bitcoin -reindex
to start again.

Error: C:\Users\Raini>bitcoin-qt.exe is not a reliable application. 

I have reinstalled the BitcoinQT, the error remains the same.
What can I do?


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: nc50lc on December 09, 2021, 10:55:59 AM
-snip-
Error: C:\Users\Raini>bitcoin-qt.exe is not a reliable application.  
I think you just forgot to point command prompt to the correct directory before executing the command.
cmd should be working in "C:\Program Files\Bitcoin" if you're using the default installation directory.

You should start cmd in the directory where bitcoin-qt is located or change the working directory using "cd" command.
eg.:
Code:
cd C:\Program Files\Bitcoin
Then enter the command vv181 instructed you to use.


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: bob123 on December 09, 2021, 11:02:37 AM
I use Windows 7.

If you are using core for development, i guess that's fine.

But if you intend to store money on your PC, please don't use Win 7 anymore. It is outdated, vulnerable and won't get any security updates.
It is not just missing lots of security features which are available in Win 10, but it has known vulnerabilities too.

Do yourself a favor and update to Win 10.


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: Raini1110 on December 09, 2021, 11:43:26 AM
I use Windows 7.

If you are using core for development, i guess that's fine.

But if you intend to store money on your PC, please don't use Win 7 anymore. It is outdated, vulnerable and won't get any security updates.
It is not just missing lots of security features which are available in Win 10, but it has known vulnerabilities too.

Do yourself a favor and update to Win 10.

I am aware of this.

How do I get rid of the error?

Is the entire BTC blockchain from BitcoinQT available for download as a ZIP?

Can I install Win 10 over Win 7 without losing my data?

I have ordered a new laptop but it takes a long time with the delivery.


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: bob123 on December 09, 2021, 12:21:51 PM
How do I get rid of the error?

As far as i can see in this thread, you fixed that problem already but it happened again due to another poweroutage?
You basically just need to do the same again (starting core with the reindex parameter). You probably just were in the wrong directory, that's why you were told there is no application.



Is the entire BTC blockchain from BitcoinQT available for download as a ZIP?

It is, but downloading the blockchain usually isn't the bottleneck. Processing is the bottleneck. So this wouldn't change much.
And i would highly recommend to build the chainstate yourself and to not trust on others data.


Can I install Win 10 over Win 7 without losing my data?

I am not sure about this since i'm not using windows, but i believe there is an "upgrade" option which keeps the data.
Even if there is not, you could just copy all of your data (blocks, chainstate, wallet, etc..) to a hard drive and then copy it back after installing Win 10. Then you don't need to downloaded and process the whole blockchain again.


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: Raini1110 on December 09, 2021, 12:56:47 PM
How do I get rid of the error?

As far as i can see in this thread, you fixed that problem already but it happened again due to another poweroutage?
You basically just need to do the same again (starting core with the reindex parameter). You probably just were in the wrong directory, that's why you were told there is no application.



Is the entire BTC blockchain from BitcoinQT available for download as a ZIP?

It is, but downloading the blockchain usually isn't the bottleneck. Processing is the bottleneck. So this wouldn't change much.
And i would highly recommend to build the chainstate yourself and to not trust on others data.


Can I install Win 10 over Win 7 without losing my data?

I am not sure about this since i'm not using windows, but i believe there is an "upgrade" option which keeps the data.
Even if there is not, you could just copy all of your data (blocks, chainstate, wallet, etc..) to a hard drive and then copy it back after installing Win 10. Then you don't need to downloaded and process the whole blockchain again.

How do I get rid of the error?

Error:
C:\Users\Raini>Bitcoin-qt.exe is not a Reliable WIN32 Application?


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: nc50lc on December 10, 2021, 04:09:06 AM
-snip-
How do I get rid of the error?

Error:
C:\Users\Raini>Bitcoin-qt.exe is not a Reliable WIN32 Application?
Looks like you missed my reply in the first page (post #20 (https://bitcointalk.org/index.php?topic=5373472.msg58664376#msg58664376)) since you only replied to Bob's post.

To expand it, it's showing that your cmd is currently working in "C:\Users\Raini" which is the default cmd directory if you launch it using start or hotkeys.
It should be working in the directory where Bitcoin-qt.exe is located or indicate the absolute path when launching bitcoin-qt.


Title: Re: Bitcoin Core 0.21 - error opening block database
Post by: Raini1110 on December 10, 2021, 08:25:34 AM
-snip-
How do I get rid of the error?

Error:
C:\Users\Raini>Bitcoin-qt.exe is not a Reliable WIN32 Application?
Looks like you missed my reply in the first page (post #20 (https://bitcointalk.org/index.php?topic=5373472.msg58664376#msg58664376)) since you only replied to Bob's post.

To expand it, it's showing that your cmd is currently working in "C:\Users\Raini" which is the default cmd directory if you launch it using start or hotkeys.
It should be working in the directory where Bitcoin-qt.exe is located or indicate the absolute path when launching bitcoin-qt.

  ;) Thank you very much. I really overlooked it. :o

C:\User\Raini>cd C:\Programs\Bitcoin

cd C:\Programs\Bitcoin>bitcoin-qt.exe -datadir=E:\Bitcoin -reindex

Thanks for your great help.