On createwallet: BerkeleyBatch: Error 2, can't open database wallet.dat #15361

issue Kexkey opened this issue on February 7, 2019
  1. Kexkey commented at 12:34 AM on February 7, 2019: none

    Workaround: restart bitcoind.

    Problem:

    /usr/bin $ ./bitcoin-cli createwallet hello true
    error code: -1
    error message:
    BerkeleyBatch: Error 2, can't open database wallet.dat
    

    That's the end result, but before the error, here's what I did...

    Steps to reproduce:

    /usr/bin $ ./bitcoin-cli createwallet hello true
    {
      "name": "hello",
      "warning": ""
    }
    /usr/bin $ ./bitcoin-cli createwallet hello true
    error code: -4
    error message:
    Wallet hello already exists.
    /usr/bin $ ./bitcoin-cli unloadwallet hello
    /usr/bin $ ./bitcoin-cli createwallet hello true
    error code: -4
    error message:
    Wallet hello already exists.
    /usr/bin $ rm -rf /.bitcoin/testnet3/wallets/hello
    /usr/bin $ ./bitcoin-cli createwallet hello true
    error code: -1
    error message:
    BerkeleyBatch: Error 2, can't open database wallet.dat
    
    /usr/bin $ ./bitcoin-cli --version
    Bitcoin Core RPC client version v0.17.0
    

    I was working in an Alpine docker container on an OSX host.

    Pertinent debug.log:

    2019-02-07T00:13:44Z UpdateTip: new best=000000000000007358c3ae2fdc8e18f5ff5ea44bb736106a3d6fe9e977cc5e80 height=1456002 version=0x3fffe000 log2_work=71.910296 tx=48779126 date='2019-02-07T00:13:43Z' progress=1.000000 cache=0.5MiB(3600txo) warning='47 of last 100 blocks have unexpected version'
    2019-02-07T00:15:52Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
    2019-02-07T00:15:52Z Using wallet wallet.dat
    2019-02-07T00:15:52Z BerkeleyEnvironment::Open: LogDir=/.bitcoin/testnet3/wallets/hello/database ErrorFile=/.bitcoin/testnet3/wallets/hello/db.log
    2019-02-07T00:15:53Z init message: Loading wallet...
    2019-02-07T00:15:53Z [hello] nFileVersion = 170000
    2019-02-07T00:15:53Z [hello] Keys: 0 plaintext, 0 encrypted, 0 w/ metadata, 0 total. Unknown wallet records: 0
    2019-02-07T00:15:53Z [hello] Performing wallet upgrade to 169900
    2019-02-07T00:15:53Z [hello] Wallet completed loading in              34ms
    2019-02-07T00:15:53Z [hello] setKeyPool.size() = 0
    2019-02-07T00:15:53Z [hello] mapWallet.size() = 0
    2019-02-07T00:15:53Z [hello] mapAddressBook.size() = 0
    2019-02-07T00:16:15Z [hello] Releasing wallet
    2019-02-07T00:17:02Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
    2019-02-07T00:17:02Z Using wallet wallet.dat
    2019-02-07T00:17:02Z init message: Loading wallet...
    2019-02-07T00:17:02Z [hello] Releasing wallet
    2019-02-07T00:19:58Z UpdateTip: new best=00000000000000e37b2a67230b87e31bdfe55534d96eb918ce46794e9471baa1 height=1456003 version=0x20000000 log2_work=71.910316 tx=48779158 date='2019-02-07T00:19:29Z' progress=1.000000 cache=0.5MiB(3626txo) warning='46 of last 100 blocks have unexpected version'
    

    Thanks!

  2. Kexkey commented at 12:38 AM on February 7, 2019: none

    Maybe fixed with #15297? Haven't tried it.

  3. fanquake added the label Wallet on Feb 7, 2019
  4. promag commented at 6:43 PM on February 11, 2019: member

    Checked that master (1bc149d05b) doesn't have the problem. You can close this issue.

  5. MarcoFalke closed this on Feb 11, 2019

  6. DrahtBot locked this on Dec 16, 2021
Contributors
Labels

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me