issues with chainstate files?

8 replies 417 views
Posts: 26 · Reputation: 197
#1Sep 1, 2023, 08:36 AM
So my PC crashed yesterday because of a graphics issue, totally unrelated to Bitcoin core. Tried to launch core again today and I’m hit with this error below. I checked the Chainstate folder and it looks like all the files are locked by Microsoft Access, any thoughts on fixing this? I even attempted to run it with the -reindex argument but still got the same error. Thanks a bunch 2024-02-28T10:21:38Z Opening LevelDB in E:\BitcoinNode\chainstate 2024-02-28T10:21:38Z Fatal LevelDB error: IO error: E:\BitcoinNode\chainstate/LOCK: The file or directory is corrupted and unreadable. 2024-02-28T10:21:38Z You can use -debug=leveldb to get more complete diagnostic messages 2024-02-28T10:21:38Z Fatal LevelDB error: IO error: E:\BitcoinNode\chainstate/LOCK: The file or directory is corrupted and unreadable. 2024-02-28T10:21:38Z : Error opening block database. Please restart with -reindex or -reindex-chainstate to recover. : Error opening block database. Please restart with -reindex or -reindex-chainstate to recover. 2024-02-28T10:21:38Z Aborted block database rebuild. Exiting. 2024-02-28T10:21:38Z Shutdown: In progress... 2024-02-28T10:21:38Z scheduler thread exit 2024-02-28T10:21:38Z Shutdown: done
3 Reply Quote Share
HyperRavenFull Member
Posts: 175 · Reputation: 633
#2Sep 1, 2023, 11:32 AM
What error do you receive when you're running the reindex? Try renaming the chainstate to another name before trying the reindex again. Bitcoin Core should trigger a reindex if it doesn't detect the chainstate directory in the datadir.
3 Reply Quote Share
Posts: 26 · Reputation: 197
#3Sep 1, 2023, 01:11 PM
2024-02-28T11:07:52Z Initializing databases... 2024-02-28T11:07:52Z Wiping LevelDB in E:\BitcoinNode\chainstate 2024-02-28T11:07:52Z Opening LevelDB in E:\BitcoinNode\chainstate 2024-02-28T11:07:52Z Fatal LevelDB error: IO error: E:\BitcoinNode\chainstate/LOCK: The file or directory is corrupted and unreadable.\x0d 2024-02-28T11:07:52Z You can use -debug=leveldb to get more complete diagnostic messages 2024-02-28T11:07:52Z Fatal LevelDB error: IO error: E:\BitcoinNode\chainstate/LOCK: The file or directory is corrupted and unreadable.\x0d 2024-02-28T11:07:52Z Error: Error opening block database 2024-02-28T11:07:52Z Shutdown: In progress... 2024-02-28T11:07:52Z scheduler thread exit 2024-02-28T11:07:52Z Shutdown: done ***UPDATE**** Renaming the Chainstate folder seems to have worked, currently reindexing.  Thanks will let ya know if it has further issues.
3 Reply Quote Share
LuckyCoinLegendary
Posts: 832 · Reputation: 4795
#4Sep 1, 2023, 07:16 PM
Yeah, as the diagnostic says, these kind of issues can almost always be fixed by running Core with -reindex (or -reindex-chainstate if only chainstate is corrupted).
3 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#5Sep 1, 2023, 09:15 PM
But, what actually fixed it is by renaming the chainstate folder which is somehow restricted by a certain Microsoft product, then --reindex after. The log and the errors in the second reply are the ones he got after using --reindex without renaming it first.
3 Reply Quote Share
LuckyCoinLegendary
Posts: 832 · Reputation: 4795
#6Sep 3, 2023, 09:15 AM
Why rename it? Old, corrupted chainstate folders still use a few GB. Wouldn't it be better to delete the folder entirely?
0 Reply Quote Share
HyperRavenFull Member
Posts: 175 · Reputation: 633
#7Sep 5, 2023, 08:20 AM
Of course, though I'm aware that chainstate would be rebuild regardless, I wanted to eliminate the possibility of the existence of the folder being an issue. Hence, the advice to rename instead of deleting it. In this case it is, so the chainstate can be deleted now.
0 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#8Sep 5, 2023, 09:35 AM
That besides the point. Of course OP can do that to get rid of the restricted files but it's what previously suggested and followed by the OP. But the point is, this particular issue can't be solved by --reindex/--reindex-chainstate alone as it somehow can't wipe the chainstate directory by itself.
1 Reply Quote Share
Posts: 26 · Reputation: 197
#9Sep 5, 2023, 01:47 PM
This is correct, I renamed the old, locked "chainstate" folder to "chain" then ran bitcoind -reindex.  Bitcoin core created a new chainstate folder,  until that point, --reindex/--reindex-chainstate wouldnt work.
0 Reply Quote Share

Related topics