Bitcoin Forum
April 19, 2024, 04:12:49 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Error opening blocks database  (Read 1749 times)
bodom (OP)
Newbie
*
Offline Offline

Activity: 8
Merit: 11


View Profile
April 29, 2016, 11:17:17 PM
 #1

Hi there!

I have installed the Bitcoin client for Linux (bitcoin-qt).

I have started it, and it started synchronizing blocks. After a while, my disk got full.

I have then moved the ~/.bitcoin/blocks and ~/.bitcoin/chainstate to a different partition and created symlinks. The client started again and downloaded blocks for some hours, then also that partition got full.

I have a NAS mounted via cifs (smbfs) with huge disk space. If I move the blocks and chainstate folders there and symlink them, exactly in the same way i did with the other partition, I get an error opening blocks database. It asks me if I want to rebuild it. If I answer yes, it then says the same error again and exits.

Any ideas?

Thank you
1713543169
Hero Member
*
Offline Offline

Posts: 1713543169

View Profile Personal Message (Offline)

Ignore
1713543169
Reply with quote  #2

1713543169
Report to moderator
1713543169
Hero Member
*
Offline Offline

Posts: 1713543169

View Profile Personal Message (Offline)

Ignore
1713543169
Reply with quote  #2

1713543169
Report to moderator
"If you don't want people to know you're a scumbag then don't be a scumbag." -- margaritahuyan
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3374
Merit: 6511


Just writing some code


View Profile WWW
April 29, 2016, 11:44:36 PM
 #2

Hi there!

I have installed the Bitcoin client for Linux (bitcoin-qt).

I have started it, and it started synchronizing blocks. After a while, my disk got full.

I have then moved the ~/.bitcoin/blocks and ~/.bitcoin/chainstate to a different partition and created symlinks. The client started again and downloaded blocks for some hours, then also that partition got full.

I have a NAS mounted via cifs (smbfs) with huge disk space. If I move the blocks and chainstate folders there and symlink them, exactly in the same way i did with the other partition, I get an error opening blocks database. It asks me if I want to rebuild it. If I answer yes, it then says the same error again and exits.

Any ideas?

Thank you

I'm pretty sure that is a problem with cifs since I have done this before and it has failed. You should really only be doing it with locally connected drives.

bodom (OP)
Newbie
*
Offline Offline

Activity: 8
Merit: 11


View Profile
April 30, 2016, 01:15:20 PM
 #3

Why aren't network drivers ok?  Huh
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3374
Merit: 6511


Just writing some code


View Profile WWW
April 30, 2016, 02:28:07 PM
 #4

Why aren't network drivers ok?  Huh
I haven't fully investigated it yet, so I don't know why. But after some experimentation, I do know that network drives do not work.

bodom (OP)
Newbie
*
Offline Offline

Activity: 8
Merit: 11


View Profile
April 30, 2016, 09:45:02 PM
 #5

In theory, there should be no way for the Bitcoin software to distinguish between a local and a network drive. That's why I do not see why it should not work.

Is there a way to have a more precise error message saying what is wrong?
Is this the right place to ask support for that software?
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3374
Merit: 6511


Just writing some code


View Profile WWW
April 30, 2016, 09:54:31 PM
 #6

In theory, there should be no way for the Bitcoin software to distinguish between a local and a network drive. That's why I do not see why it should not work.
In theory, yes. In practice, the software implementation may be doing something which differs from a local drive and causes Bitcoin Core to react in unexpected ways.

Is there a way to have a more precise error message saying what is wrong?
Those error messages are in the debug.log. Can you post that here so that we can see what the errors are? IIRC, though, the error messages for this are not all to helpful.

Is this the right place to ask support for that software?
No. The developers do not use these forms anymore. The proper place to report bugs and issues is on the github issue tracker at https://github.com/bitcoin/bitcoin/issues

bodom (OP)
Newbie
*
Offline Offline

Activity: 8
Merit: 11


View Profile
April 30, 2016, 10:14:49 PM
 #7

Thank you for the explanations.

I have tried doing something very weird: I have created big image file inside the network share, then mounted it.
Goods news: it works. Bad news: it is incredibly slow, as expected.

So the network itself is definitely not a problem. Could be a permissions problem?

here is the debug.log:
Code:
2016-04-30 22:11:04 Bitcoin version v0.12.1.0-g9779e1e (Mon, 11 Apr 2016 13:01:43 +0200)
2016-04-30 22:11:04 InitParameterInteraction: parameter interaction: -listen=0 -> setting -upnp=0
2016-04-30 22:11:04 InitParameterInteraction: parameter interaction: -listen=0 -> setting -discover=0
2016-04-30 22:11:04 InitParameterInteraction: parameter interaction: -listen=0 -> setting -listenonion=0
2016-04-30 22:11:04 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2016-04-30 22:11:04 GUI: Bus::open: Can not get ibus-daemon's address.
2016-04-30 22:11:04 GUI: "sni-qt/26696" WARN  00:11:04.636 void StatusNotifierItemFactory::connectToSnw() Invalid interface to SNW_SERVICE
2016-04-30 22:11:04 Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2016-04-30 22:11:04 Default data directory /home/bodom/.bitcoin
2016-04-30 22:11:04 Using data directory /home/bodom/.bitcoin
2016-04-30 22:11:04 Using config file /home/bodom/.bitcoin/bitcoin.conf
2016-04-30 22:11:04 Using at most 125 connections (1024 file descriptors available)
2016-04-30 22:11:04 Using 4 threads for script verification
2016-04-30 22:11:04 Using wallet wallet.dat
2016-04-30 22:11:04 init message: Verifying wallet...
2016-04-30 22:11:04 scheduler thread start
2016-04-30 22:11:04 CDBEnv::Open: LogDir=/home/bodom/.bitcoin/database ErrorFile=/home/bodom/.bitcoin/db.log
2016-04-30 22:11:04 Cache configuration:
2016-04-30 22:11:04 * Using 12.5MiB for block index database
2016-04-30 22:11:04 * Using 29.9MiB for chain state database
2016-04-30 22:11:04 * Using 57.6MiB for in-memory UTXO set
2016-04-30 22:11:04 init message: Loading block index...
2016-04-30 22:11:04 Opening LevelDB in /home/bodom/.bitcoin/blocks/index
2016-04-30 22:11:04 IO error: /home/bodom/.bitcoin/blocks/index: Invalid argument
2016-04-30 22:11:06 init message: Loading block index...
2016-04-30 22:11:06 Wiping LevelDB in /home/bodom/.bitcoin/blocks/index
2016-04-30 22:11:06 Opening LevelDB in /home/bodom/.bitcoin/blocks/index
2016-04-30 22:11:06 IO error: /home/bodom/.bitcoin/blocks/index: Invalid argument
2016-04-30 22:11:07 scheduler thread interrupt
2016-04-30 22:11:07 Shutdown: In progress...
2016-04-30 22:11:07 StopNode()
2016-04-30 22:11:07 Shutdown: done

The folder giving an I/O error exists:

Code:
$stat /home/bodom/.bitcoin/blocks/index
  File: '/home/bodom/.bitcoin/blocks/index'
  Size: 0          Blocks: 0          IO Block: 16384  directory
Device: 32h/50d Inode: 74186757    Links: 2
Access: (0700/drwx------)  Uid: ( 1000/   bodom)   Gid: ( 1000/   bodom)
Access: 2016-05-01 00:11:06.264941600 +0200
Modify: 2016-05-01 00:11:06.268941500 +0200
Change: 2016-05-01 00:11:06.268941500 +0200
 Birth: -
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3374
Merit: 6511


Just writing some code


View Profile WWW
April 30, 2016, 10:20:10 PM
 #8

So the network itself is definitely not a problem. Could be a permissions problem?
I don't think it is permissions. I think it has to do with how cifs does file sharing, although, again, I'm not sure. I'll open an issue on github since I have also had this problem before.

bodom (OP)
Newbie
*
Offline Offline

Activity: 8
Merit: 11


View Profile
April 30, 2016, 10:33:16 PM
 #9

So following your hints I've found these links:
https://github.com/bitcoin/bitcoin/issues/4276
https://github.com/smira/aptly/issues/317

Quote
No, this is LevelDB reporting that an internal system call returned with an error status indicating that an invalid argument was passed.

I assume that the samba filesystem does not offer certain functionality that LevelDB requires of its databases, such a certain types of locking, syncing or mmaping.

Long story short, BitCoin uses LevelDB from Google, that seems to have some "undfined" issues with cifs. They could most probably be fixed/worked around, but that would require me to report the problem to the Bitcoin devs, then they to report it upstream, wait for Google to fix it, then update the LevelDB version in Bitcoin. I bet it could take years Cheesy

I am now exploring different solutions. At least, the image file works.

Thank you
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3374
Merit: 6511


Just writing some code


View Profile WWW
April 30, 2016, 10:49:16 PM
 #10

Long story short, BitCoin uses LevelDB from Google, that seems to have some "undfined" issues with cifs. They could most probably be fixed/worked around, but that would require me to report the problem to the Bitcoin devs, then they to report it upstream, wait for Google to fix it, then update the LevelDB version in Bitcoin. I bet it could take years Cheesy
I've already reported it to the devs: https://github.com/bitcoin/bitcoin/issues/7981. And since they maintain their own fork of LevelDB (https://github.com/bitcoin-core/leveldb), any fix probably has a good likelihood of making it into the next major release, 0.13. That will be in a few months though, since they usually don't have bug fixes for minor releases unless they are major problems.

bodom (OP)
Newbie
*
Offline Offline

Activity: 8
Merit: 11


View Profile
April 30, 2016, 10:58:19 PM
 #11

Oh, thanks.

I see it works under NFS. I am planning to use it meanwhile (if I can manage to set it up in a safe way).
2c0de
Full Member
***
Offline Offline

Activity: 138
Merit: 102


View Profile
May 04, 2016, 09:13:11 PM
 #12

Oh, thanks.

I see it works under NFS. I am planning to use it meanwhile (if I can manage to set it up in a safe way).

don't never do reindex, it's a waste of time.

sure. delete blocks/ and chainstate/
let it download for a day or so, on your best computer
once it's downloaded, backup blocks/ and chainstate/

regularly backup chainstate/  , blocks/index/ , and the blocks/blk,rev.dat files whose size did grow (you don't need previous except last dat files backup twice because they never change anyway)

If your chain becomes corrupt (Error opening blocks database), simply abort and recover known good chainstate/  , blocks/index/ , and  the corresponding blocks/blk,rev.dat files

once your backup is recovered bitcoin starts nearly instantly , no reindex needed

DHjxvnHB9RirtPbvkovSotn1fY2poNffoi
LWeT4wwDVdJ9x49UcXPyS6CznRpbQFM6nx
0x96273C2FD825f0A2745d917bbbfabD6032dC1aDD
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!