Tech

Vagrant and bitcoind synced_folder problem

  • このエントリーをはてなブックマークに追加

Problem

If you are trying to build a bitcoind server with Vagrant, you’ll have problem with synced_folder.

Solution

I’m not very sure yet…
You shouldn’t use default synced_folder.

I tried NFS for synced_folder and it worked!!

My Vagrantfile

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "hashicorp/precise64"
  config.vm.provision :shell, :path => "bootstrap.sh", privileged: false

  config.vm.network :private_network, ip: "192.168.33.30"

# Original
#  config.vm.synced_folder "data/", "/home/vagrant/.bitcoin/"
# NFS version
  config.vm.synced_folder "data/", "/home/vagrant/.bitcoin/", type: "nfs"

  config.vm.provider "virtualbox" do |vb|
    vb.customize ["modifyvm", :id, "--memory", "1536"]
  end

  config.vm.provider "vmware" do |vmw|
    vmw.customize ["modifyvm", :id, "--memory", "1536"]
  end
end

See Vagrant document for NFS settings.
https://docs.vagrantup.com/v2/synced-folders/nfs.html

Other solution from Hasimir
https://github.com/bitcoin/bitcoin/issues/4276

Create a virtual disk on the file/network server.
Get VirtualBox (or VMWare or whatever) to see that.
Mount the disk image as normal.
As far as the VM/OS is concerned it’s just an ordinary drive.
This means you can do other nifty things to such a drive (like encrypt it with LUKS/dm-crypt).

Environment

  • Bitcoin Core 0.9.2
  • Vagrant with VirtualBox (Ubuntu 12.04 64bit on Mac OS X)

Summary

  • Samba(or file sharing) doesn’t support LevelDB feature. (I guess…)

Answer

From
https://github.com/bitcoin/bitcoin/issues/4276

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.

Errors

When you run bitcoind, you will see the error like…

: Error opening block database.

Do you want to rebuild the block database now?

In debug.log

2015-01-10 17:29:50 init message: Loading block index...
2015-01-10 17:29:50 Opening LevelDB in /home/vagrant/.bitcoin/blocks/index
2015-01-10 17:29:50 IO error: /home/vagrant/.bitcoin/blocks/index: Invalid argument

Ref.

Vagrant File I Used
https://github.com/tlehman/bitcoin-vagrant

http://bitcoin.stackexchange.com/questions/34291/bitcoind-running-in-vagrant-cant-import-bootstrap-dat-from-external-directory

search words

  • bitcoind, LevelDB, vagrant, virtualbox, vmware, samba, bootstrap.dat, blockchain, error
  • このエントリーをはてなブックマークに追加