<p>If Bitcoin Core continually gets killed before writing anything to your disk independently of your dbcache and mempool configurations and with no error logs in the debug.log, you are most likely lacking sufficient memory.</p>
<p>You can check if this is the case by monitoring your ram more closely <code>sudo free -h</code></p>
<p>If your system allows for it you can create a <a href="https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-20-04/" rel="nofollow noreferrer">swap file</a>, which resolved the issue for me, along with the commands found <a href="https://bitcoin.stackexchange.com/a/50743/61384">here</a>.</p>

CC BY-SA 4.0
2022-08-16T10:21:13.023Z
2022-08-16T10:37:34.983Z
2022-08-16T10:37:34.983Z
Jan Janssen
<p>I have been fiddling with this error for a little bit now and wondering what's going wrong. I'm running a testnet instance of Bitcoin Core on a relatively low-spec EC2 instance (2MB ram, 40gb disk)</p>
<p>It is unable to sync correctly. No matter the size of the dbcache and mempool, it will always crash before emptying it. There are no error messages in the debug.log, just the latest UpdateTip.</p>
<p>example with DBcache=4, mempool=5: <code>2022-08-15T13:25:48Z UpdateTip: new best=00000000781c1335e275cb33c0f16be3eb60c803482995f6fdf88fc1cc9cce8b height=21799 version=0x00000002 log2_work=48.609020 tx=33303 date='2012-08-30T16:51:17Z' progress=0.000525 cache=4.1MiB(22817txo) Killed</code>  Increasing the dbcache/mempool will allow it to run longer but it will inevitably be killed in the same way.</p>
<p>More debug.log:</p>
<pre><code>bitcoin@localhost:~$ bitcoind -testnet -rpcuser=&quot;user&quot; -rpcpassword=&quot;password&quot; -dbcache=20 -maxmempool=5 
2022-08-15T16:04:02Z Bitcoin Core version v23.0.0 (release build)
2022-08-15T16:04:02Z Assuming ancestors of block 00000000000163cfb1f97c4e4098a3692c8053ad9cab5ad9c86b338b5c00b8b7 have valid signatures.
2022-08-15T16:04:02Z Setting nMinimumChainWork=00000000000000000000000000000000000000000000064728c7be6fe4b2f961
2022-08-15T16:04:02Z Using the 'x86_shani(1way,2way)' SHA256 implementation
2022-08-15T16:04:02Z Using RdSeed as additional entropy source
2022-08-15T16:04:02Z Using RdRand as an additional entropy source
2022-08-15T16:04:02Z Default data directory /home/bitcoin/.bitcoin
2022-08-15T16:04:02Z Using data directory /home/bitcoin/.bitcoin/testnet3
2022-08-15T16:04:02Z Config file: /home/bitcoin/.bitcoin/bitcoin.conf (not found, skipping)
2022-08-15T16:04:02Z Command-line arg: dbcache=&quot;20&quot;
2022-08-15T16:04:02Z Command-line arg: maxmempool=&quot;5&quot;
2022-08-15T16:04:02Z Command-line arg: rpcpassword=****
2022-08-15T16:04:02Z Command-line arg: rpcuser=****
2022-08-15T16:04:02Z Command-line arg: testnet=&quot;&quot;
2022-08-15T16:04:02Z Using at most 125 automatic connections (1024 file descriptors available)
2022-08-15T16:04:02Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2022-08-15T16:04:02Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2022-08-15T16:04:02Z Script verification uses 0 additional threads
2022-08-15T16:04:02Z scheduler thread start
2022-08-15T16:04:02Z HTTP: creating work queue of depth 16
2022-08-15T16:04:02Z Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation.
2022-08-15T16:04:02Z HTTP: starting 4 worker threads
2022-08-15T16:04:02Z Using wallet directory /home/bitcoin/.bitcoin/testnet3/wallets
2022-08-15T16:04:02Z init message: Verifying wallet(s)…
2022-08-15T16:04:02Z Using /16 prefix for IP bucketing
2022-08-15T16:04:02Z init message: Loading P2P addresses…
2022-08-15T16:04:02Z Loaded 0 addresses from peers.dat  6ms
2022-08-15T16:04:02Z init message: Loading banlist…
2022-08-15T16:04:02Z SetNetworkActive: true
2022-08-15T16:04:02Z Failed to read fee estimates from /home/bitcoin/.bitcoin/testnet3/fee_estimates.dat. Continue anyway.
2022-08-15T16:04:02Z Cache configuration:
2022-08-15T16:04:02Z * Using 2.0 MiB for block index database
2022-08-15T16:04:02Z * Using 8.0 MiB for chain state database
2022-08-15T16:04:02Z * Using 10.0 MiB for in-memory UTXO set (plus up to 4.8 MiB of unused mempool space)
2022-08-15T16:04:02Z init message: Loading block index…
2022-08-15T16:04:02Z Switching active chainstate to Chainstate [ibd] @ height -1 (null)
2022-08-15T16:04:02Z Opening LevelDB in /home/bitcoin/.bitcoin/testnet3/blocks/index
2022-08-15T16:04:02Z Opened LevelDB successfully
2022-08-15T16:04:02Z Using obfuscation key for /home/bitcoin/.bitcoin/testnet3/blocks/index: 0000000000000000
2022-08-15T16:04:02Z LoadBlockIndexDB: last block file = 0
2022-08-15T16:04:02Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
2022-08-15T16:04:02Z Checking all blk files are present...
2022-08-15T16:04:02Z Initializing databases...
2022-08-15T16:04:02Z Opening LevelDB in /home/bitcoin/.bitcoin/testnet3/chainstate
2022-08-15T16:04:02Z Opened LevelDB successfully
2022-08-15T16:04:02Z Using obfuscation key for /home/bitcoin/.bitcoin/testnet3/chainstate: fb97b88490e524df
2022-08-15T16:04:02Z init message: Verifying blocks…
2022-08-15T16:04:02Z  block index              49ms
2022-08-15T16:04:02Z loadblk thread start
2022-08-15T16:04:02Z UpdateTip: new best=000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943 height=0 version=0x00000001 log2_work=32.000022 tx=1 date='2011-02-02T23:16:42Z' progress=0.000000 cache=0.0MiB(0txo)
2022-08-15T16:04:02Z block tree size = 1
2022-08-15T16:04:02Z nBestHeight = 0
2022-08-15T16:04:02Z AddLocal(-:18333,1)
2022-08-15T16:04:02Z Discover: IPv4 - eth0: 
2022-08-15T16:04:02Z Bound to 127.0.0.1:18334
2022-08-15T16:04:02Z Bound to [::]:18333
2022-08-15T16:04:02Z Bound to 0.0.0.0:18333
2022-08-15T16:04:02Z Failed to open mempool file from disk. Continuing anyway.
2022-08-15T16:04:02Z loadblk thread exit
2022-08-15T16:04:02Z torcontrol thread start
2022-08-15T16:04:02Z 0 block-relay-only anchors will be tried for connections.
2022-08-15T16:04:02Z init message: Starting network threads…
2022-08-15T16:04:02Z init message: Done loading
2022-08-15T16:04:02Z addcon thread start
2022-08-15T16:04:02Z opencon thread start
2022-08-15T16:04:02Z msghand thread start
2022-08-15T16:04:02Z dnsseed thread start
2022-08-15T16:04:02Z Loading addresses from DNS seed testnet-seed.bluematt.me.
2022-08-15T16:04:02Z net thread start
2022-08-15T16:04:03Z Loading addresses from DNS seed testnet-seed.bitcoin.jonasschnelli.ch.
2022-08-15T16:04:03Z Loading addresses from DNS seed seed.testnet.bitcoin.sprovoost.nl.
2022-08-15T16:04:03Z Loading addresses from DNS seed seed.tbtc.petertodd.org.
2022-08-15T16:04:03Z 62 addresses found from DNS seeds
2022-08-15T16:04:03Z dnsseed thread exit
</code></pre>
<pre><code>2022-08-15T16:09:21Z UpdateTip: new best=000000000e74e1d0d23ec2ad5ea79b01df8a7f423c0f1676cdef2d21ec9f43cf height=56054 version=0x00000002 log2_work=52.424615 tx=93808 date='2013-03-08T16:20:21Z' progress=0.001480 cache=13.3MiB(85444txo)
Killed
</code></pre>

CC BY-SA 4.0
2022-08-15T16:18:32.147Z
2 GB, not MB, yes? Either way, the machine does not have enough memory to run Bitcoin Core and that's why it keeps getting killed. You could disable the mempool by running in blocks only mode. That would allow you to free up some memory for the dbcache.
Ava Chow
CC BY-SA 4.0
2022-08-15T16:32:37.670Z
Correct. This was my suspicion also but I've read numerous accounts of people sucessfully running core with 1gb (or sometimes even less!?), and here there did not seem to be any obvious relation to the size of the dbcache/mempool. Thanks.
Jan Janssen
CC BY-SA 4.0
2022-08-15T17:10:03.937Z
What else is running on the machine that may be consuming RAM? You probably want a very lightweight OS, with little GUI/desktop things running on it. Also, testnet uses inherently more memory than mainnet as it has far more headers (probably ~300 MB just in headers alone).
Pieter Wuille
CC BY-SA 4.0
2022-08-15T18:11:52.267Z
OS indeed uses a decent chunk of the 2GB for reasons unknown. I resolved it using a swap file and core works fine now.
Jan Janssen
CC BY-SA 4.0
2022-08-16T09:46:34.540Z
If you wish, you could either tidy up by deleting your question or (better?) add an answer describing how you solved the problem in sufficient detail to help others with the same problem.
RedGrittyBrick
CC BY-SA 4.0
2022-08-16T10:21:27.790Z
@RedGrittyBrick Done. Will accept my own answer tomorrow.
Jan Janssen
CC BY-SA 4.0
2022-09-15T15:29:51.533Z
I wonder if you have been able to sync the blockchain with such a few disk space (even for testnet, is that enough?). For mainnet I use an Amazon EC2 instance type of "tx2.large" with 750Gb of SSB disk and 16Gb or RAM. And I start bitcoind with -dbcache=8192 and -banscore=10
Invest Data Systems FR
<synchronization>
Bitcoin core unable to write cache to disk
Jan Janssen
# Bitcoin core unable to write cache to disk

(Asked by: username_0 on 2022-08-15)

I have been fiddling with this error for a little bit now and wondering what's going wrong. I'm running a testnet instance of Bitcoin Core on a relatively low-spec EC2 instance (2MB ram, 40gb disk)

It is unable to sync correctly. No matter the size of the dbcache and mempool, it will always crash before emptying it. There are no error messages in the debug.log, just the latest UpdateTip.

example with DBcache=4, mempool=5: `2022-08-15T13:25:48Z UpdateTip: new best=00000000781c1335e275cb33c0f16be3eb60c803482995f6fdf88fc1cc9cce8b height=21799 version=0x00000002 log2_work=48.609020 tx=33303 date='2012-08-30T16:51:17Z' progress=0.000525 cache=4.1MiB(22817txo) Killed` Increasing the dbcache/mempool will allow it to run longer but it will inevitably be killed in the same way.

More debug.log:

```
bitcoin@localhost:~$ bitcoind -testnet -rpcuser="user" -rpcpassword="password" -dbcache=20 -maxmempool=5 
2022-08-15T16:04:02Z Bitcoin Core version v23.0.0 (release build)
2022-08-15T16:04:02Z Assuming ancestors of block 00000000000163cfb1f97c4e4098a3692c8053ad9cab5ad9c86b338b5c00b8b7 have valid signatures.
2022-08-15T16:04:02Z Setting nMinimumChainWork=00000000000000000000000000000000000000000000064728c7be6fe4b2f961
2022-08-15T16:04:02Z Using the 'x86_shani(1way,2way)' SHA256 implementation
2022-08-15T16:04:02Z Using RdSeed as additional entropy source
2022-08-15T16:04:02Z Using RdRand as an additional entropy source
2022-08-15T16:04:02Z Default data directory /home/bitcoin/.bitcoin
2022-08-15T16:04:02Z Using data directory /home/bitcoin/.bitcoin/testnet3
2022-08-15T16:04:02Z Config file: /home/bitcoin/.bitcoin/bitcoin.conf (not found, skipping)
2022-08-15T16:04:02Z Command-line arg: dbcache="20"
2022-08-15T16:04:02Z Command-line arg: maxmempool="5"
2022-08-15T16:04:02Z Command-line arg: rpcpassword=****
2022-08-15T16:04:02Z Command-line arg: rpcuser=****
2022-08-15T16:04:02Z Command-line arg: testnet=""
2022-08-15T16:04:02Z Using at most 125 automatic connections (1024 file descriptors available)
2022-08-15T16:04:02Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2022-08-15T16:04:02Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2022-08-15T16:04:02Z Script verification uses 0 additional threads
2022-08-15T16:04:02Z scheduler thread start
2022-08-15T16:04:02Z HTTP: creating work queue of depth 16
2022-08-15T16:04:02Z Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation.
2022-08-15T16:04:02Z HTTP: starting 4 worker threads
2022-08-15T16:04:02Z Using wallet directory /home/bitcoin/.bitcoin/testnet3/wallets
2022-08-15T16:04:02Z init message: Verifying wallet(s)…
2022-08-15T16:04:02Z Using /16 prefix for IP bucketing
2022-08-15T16:04:02Z init message: Loading P2P addresses…
2022-08-15T16:04:02Z Loaded 0 addresses from peers.dat  6ms
2022-08-15T16:04:02Z init message: Loading banlist…
2022-08-15T16:04:02Z SetNetworkActive: true
2022-08-15T16:04:02Z Failed to read fee estimates from /home/bitcoin/.bitcoin/testnet3/fee_estimates.dat. Continue anyway.
2022-08-15T16:04:02Z Cache configuration:
2022-08-15T16:04:02Z * Using 2.0 MiB for block index database
2022-08-15T16:04:02Z * Using 8.0 MiB for chain state database
2022-08-15T16:04:02Z * Using 10.0 MiB for in-memory UTXO set (plus up to 4.8 MiB of unused mempool space)
2022-08-15T16:04:02Z init message: Loading block index…
2022-08-15T16:04:02Z Switching active chainstate to Chainstate [ibd] @ height -1 (null)
2022-08-15T16:04:02Z Opening LevelDB in /home/bitcoin/.bitcoin/testnet3/blocks/index
2022-08-15T16:04:02Z Opened LevelDB successfully
2022-08-15T16:04:02Z Using obfuscation key for /home/bitcoin/.bitcoin/testnet3/blocks/index: 0000000000000000
2022-08-15T16:04:02Z LoadBlockIndexDB: last block file = 0
2022-08-15T16:04:02Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
2022-08-15T16:04:02Z Checking all blk files are present...
2022-08-15T16:04:02Z Initializing databases...
2022-08-15T16:04:02Z Opening LevelDB in /home/bitcoin/.bitcoin/testnet3/chainstate
2022-08-15T16:04:02Z Opened LevelDB successfully
2022-08-15T16:04:02Z Using obfuscation key for /home/bitcoin/.bitcoin/testnet3/chainstate: fb97b88490e524df
2022-08-15T16:04:02Z init message: Verifying blocks…
2022-08-15T16:04:02Z  block index              49ms
2022-08-15T16:04:02Z loadblk thread start
2022-08-15T16:04:02Z UpdateTip: new best=000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943 height=0 version=0x00000001 log2_work=32.000022 tx=1 date='2011-02-02T23:16:42Z' progress=0.000000 cache=0.0MiB(0txo)
2022-08-15T16:04:02Z block tree size = 1
2022-08-15T16:04:02Z nBestHeight = 0
2022-08-15T16:04:02Z AddLocal(-:18333,1)
2022-08-15T16:04:02Z Discover: IPv4 - eth0: 
2022-08-15T16:04:02Z Bound to 127.0.0.1:18334
2022-08-15T16:04:02Z Bound to [::]:18333
2022-08-15T16:04:02Z Bound to 0.0.0.0:18333
2022-08-15T16:04:02Z Failed to open mempool file from disk. Continuing anyway.
2022-08-15T16:04:02Z loadblk thread exit
2022-08-15T16:04:02Z torcontrol thread start
2022-08-15T16:04:02Z 0 block-relay-only anchors will be tried for connections.
2022-08-15T16:04:02Z init message: Starting network threads…
2022-08-15T16:04:02Z init message: Done loading
2022-08-15T16:04:02Z addcon thread start
2022-08-15T16:04:02Z opencon thread start
2022-08-15T16:04:02Z msghand thread start
2022-08-15T16:04:02Z dnsseed thread start
2022-08-15T16:04:02Z Loading addresses from DNS seed testnet-seed.bluematt.me.
2022-08-15T16:04:02Z net thread start
2022-08-15T16:04:03Z Loading addresses from DNS seed testnet-seed.bitcoin.jonasschnelli.ch.
2022-08-15T16:04:03Z Loading addresses from DNS seed seed.testnet.bitcoin.sprovoost.nl.
2022-08-15T16:04:03Z Loading addresses from DNS seed seed.tbtc.petertodd.org.
2022-08-15T16:04:03Z 62 addresses found from DNS seeds
2022-08-15T16:04:03Z dnsseed thread exit

```

```
2022-08-15T16:09:21Z UpdateTip: new best=000000000e74e1d0d23ec2ad5ea79b01df8a7f423c0f1676cdef2d21ec9f43cf height=56054 version=0x00000002 log2_work=52.424615 tx=93808 date='2013-03-08T16:20:21Z' progress=0.001480 cache=13.3MiB(85444txo)
Killed

```

**Tags:** synchronization

> **Comments:**
> **username_1**: 2 GB, not MB, yes? Either way, the machine does not have enough memory to run Bitcoin Core and that's why it keeps getting killed. You could disable the mempool by running in blocks only mode. That would allow you to free up some memory for the dbcache.  
> **username_0**: Correct. This was my suspicion also but I've read numerous accounts of people sucessfully running core with 1gb (or sometimes even less!?), and here there did not seem to be any obvious relation to the size of the dbcache/mempool. Thanks.  
> **username_2**: What else is running on the machine that may be consuming RAM? You probably want a very lightweight OS, with little GUI/desktop things running on it. Also, testnet uses inherently more memory than mainnet as it has far more headers (probably ~300 MB just in headers alone).  
> **username_0**: OS indeed uses a decent chunk of the 2GB for reasons unknown. I resolved it using a swap file and core works fine now.  
> **username_3**: If you wish, you could either tidy up by deleting your question or (better?) add an answer describing how you solved the problem in sufficient detail to help others with the same problem.  
> **username_0**: @username_3 Done. Will accept my own answer tomorrow.  
> **username_4**: I wonder if you have been able to sync the blockchain with such a few disk space (even for testnet, is that enough?). For mainnet I use an Amazon EC2 instance type of "tx2.large" with 750Gb of SSB disk and 16Gb or RAM. And I start bitcoind with -dbcache=8192 and -banscore=10  

---

## 1 answers

### Answer by username_0 on 2022-08-16. Score: 2 | Accepted answer

If Bitcoin Core continually gets killed before writing anything to your disk independently of your dbcache and mempool configurations and with no error logs in the debug.log, you are most likely lacking sufficient memory.

You can check if this is the case by monitoring your ram more closely `sudo free -h`

If your system allows for it you can create a [swap file](https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-20-04/), which resolved the issue for me, along with the commands found [here](https://bitcoin.stackexchange.com/a/50743/61384).


---

