<p>The solution is time consuming but easy. The flash drive was finally reporting read/write errors after a harsh shutdown. Formatting it and new install of bitcoind and loading all blocks again (I had no other drive where I could have copied this amount of data to and wanted to exclude potential issues with the old file permissions).</p>

<p>So the next few days I assume the machine will be busy. However now at block 8000 the CPU is only using 1-2% (Intel Core i5 with 8GB RAM on fedora linux)</p>

CC BY-SA 3.0
2018-04-20T15:53:17.993Z
Higher dbcache will improve performance. Also, this will destroy your flash drive. Those are not designed for I/O heavy database loads.
Pieter Wuille
CC BY-SA 3.0
2018-04-20T16:58:20.157Z
Thanks Pieter, I started bitcoind now with dbcache=40000 and maxconnections=40 but still only 2% CPU and 3% memory usage. Any idea?
Marc O
CC BY-SA 3.0
2018-04-20T17:44:09.520Z
Yes, don't use a flash drive. It's not designed for heavy database loads.
Pieter Wuille
CC BY-SA 3.0
2018-04-20T14:29:43.397Z
2018-04-20T14:29:43.397Z
Marc O
<p>Lenovo E460, 8GB RAM,
Fedora 26,
bitcoin core command line version 0.16.0,
All blocks completely downloaded on a flash drive with 256GB capacity.</p>

<p>I rebooted my machine today without stopping the bitcoind before and since then the following happens:
1) starting "bitcoind -daemon -datadir=/path/to/flash/drive"
2) I see with "top" the process 'bitcoind'  running  for about 30-45 seconds
3) Suddenly under same process id the process names changes to "bitcoin-shutdown" and disappears a second after.
4) Stop or new start of bitcoind is not possible, message is "Error: Cannot obtain a lock on data directory /path/to/flash/drive. Bitcoin Core is probably already running." 
5) Only way to start bitcoind again is to reboot the linux. Then loop 1)-5) starts again.</p>

<p>Any help appreciated!
Thanks!</p>

CC BY-SA 3.0
2018-04-18T21:33:30.020Z
can you post the error log?
zhiyan114
CC BY-SA 3.0
2018-04-18T21:43:15.517Z
This is what I see when sarching for the PID in the journalctl:
-- Reboot --
Apr 18 21:40:23 user.fritz.box audit[3373]: ANOM_ABEND auid=1000 uid=1000 gid=1000 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=3373 comm="bitcoin-shutoff" exe="/usr/local/bin/bitcoind" sig=6 res=1

Not sure if this is enough. If not in what path are the log/error log files?
Thanks!
Marc O
CC BY-SA 3.0
2018-04-18T21:47:08.000Z
Might need to post the whole log, try to use pastebin.com and paste the whole log into it.
Usually under your bitcoin data folder (file named: debug.log)
zhiyan114
CC BY-SA 3.0
2018-04-18T21:57:00.057Z
Thanks! Found it, see here:
https://pastebin.com/embed_iframe/09eG9h9Q
Marc O
CC BY-SA 3.0
2018-04-18T22:14:34.433Z
Hmm the log you posted didn't really tell me about why it crashes.

So make sure your usb has 150GB+ storage right?
zhiyan114
CC BY-SA 3.0
2018-04-18T22:22:16.617Z
The USB has 259GB, 190GB used and 70GB free
Marc O
CC BY-SA 3.0
2018-04-18T23:29:26.347Z
Can you run it without -daemon and post what happens? Also, to avoid the "Cannot obtain lock error", if you are sure that bitcoind is no longer running (check ps and top), go to the datadir and delete the .lock file.
Ava Chow
CC BY-SA 3.0
2018-04-18T23:58:11.683Z
Without -daemon the response is this:
"Error: Error: A fatal internal error occurred, see debug.log for details
terminate called after throwing an instance of 'std::runtime_error'
  what():  CDB: Error 30, can't open database wallet.dat
Aborted (core dumped)
"
Marc O
CC BY-SA 3.0
2018-04-18T23:58:51.543Z
ps and top is not showing bitcoind
Marc O
CC BY-SA 3.0
2018-04-19T00:02:00.167Z
The new debug file is here:
https://pastebin.com/embed_iframe/eY3kCNQe
Marc O
CC BY-SA 3.0
2018-04-19T00:03:26.427Z
the .lock file had 0 Bytes. Didn't delete it. Would need to change the permission. Still helpful where it is empty anyway?
Marc O
CC BY-SA 3.0
2018-04-19T03:27:26.197Z
Yes, you have to delete that file.  It's normal for it to be 0 bytes - just the fact that it exists signals to Bitcoin Core that another instance is running.  Of course it would be wise to back up your wallet.dat first, just in case.
Nate Eldredge
CC BY-SA 3.0
2018-04-19T06:57:19.743Z
Tks! How to delet .locks? rm is not working, reply is "read-only file system". Then I tried to chmod it, same reply. So currenty it's chmod 644 and change of this or deletion vie rm command is not working.
Marc O
CC BY-SA 3.0
2018-04-19T07:58:57.113Z
you are giving permissions to file by using chmod, you have to run `sudo rm -rf  ...`
Tailer
CC BY-SA 3.0
2018-04-19T09:19:30.397Z
Thanks! Didn't work yet, this is what I tried:

$ sudo chmod 777 .lock
chmod: changing permissions of '.lock': Read-only file system
$ sudo rm -rf .lock
rm: cannot remove '.lock': Read-only file system
Marc O
CC BY-SA 3.0
2018-04-19T16:22:44.690Z
May be uninstalling and new installing helps ... going to try.
Marc O
CC BY-SA 3.0
2018-04-19T18:24:58.203Z
Still struggeling: After reinstall it's still not running, but at least I could delete the .locks. with the cmmand line and the GUI version, both give me as feedback "cannot obtain a lock on data directory /path/to/flash/drive/. Bitcoin Core is probably already running"

Further help would be appreciated!
Marc O
<bitcoind>
bitcoind starting and then quickly shutting down automatically
Marc O
# bitcoind starting and then quickly shutting down automatically

(Asked by: username_0 on 2018-04-18)

Lenovo E460, 8GB RAM,
Fedora 26,
bitcoin core command line version 0.16.0,
All blocks completely downloaded on a flash drive with 256GB capacity.

I rebooted my machine today without stopping the bitcoind before and since then the following happens:
1) starting "bitcoind -daemon -datadir=/path/to/flash/drive"
2) I see with "top" the process 'bitcoind' running for about 30-45 seconds
3) Suddenly under same process id the process names changes to "bitcoin-shutdown" and disappears a second after.
4) Stop or new start of bitcoind is not possible, message is "Error: Cannot obtain a lock on data directory /path/to/flash/drive. Bitcoin Core is probably already running."
5) Only way to start bitcoind again is to reboot the linux. Then loop 1)-5) starts again.

Any help appreciated!
Thanks!

**Tags:** bitcoind

> **Comments:**
> **username_1**: can you post the error log?  
> **username_0**: This is what I see when sarching for the PID in the journalctl: -- Reboot -- Apr 18 21:40:23 user.fritz.box audit[3373]: ANOM_ABEND auid=1000 uid=1000 gid=1000 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=3373 comm="bitcoin-shutoff" exe="/usr/local/bin/bitcoind" sig=6 res=1  Not sure if this is enough. If not in what path are the log/error log files? Thanks!  
> **username_1**: Might need to post the whole log, try to use pastebin.com and paste the whole log into it. Usually under your bitcoin data folder (file named: debug.log)  
> **username_0**: Thanks! Found it, see here: https://pastebin.com/embed_iframe/09eG9h9Q  
> **username_1**: Hmm the log you posted didn't really tell me about why it crashes.  So make sure your usb has 150GB+ storage right?  
> **username_0**: The USB has 259GB, 190GB used and 70GB free  
> **username_2**: Can you run it without -daemon and post what happens? Also, to avoid the "Cannot obtain lock error", if you are sure that bitcoind is no longer running (check ps and top), go to the datadir and delete the .lock file.  
> **username_0**: Without -daemon the response is this: "Error: Error: A fatal internal error occurred, see debug.log for details terminate called after throwing an instance of 'std::runtime_error'   what():  CDB: Error 30, can't open database wallet.dat Aborted (core dumped) "  
> **username_0**: ps and top is not showing bitcoind  
> **username_0**: The new debug file is here: https://pastebin.com/embed_iframe/eY3kCNQe  
> **username_0**: the .lock file had 0 Bytes. Didn't delete it. Would need to change the permission. Still helpful where it is empty anyway?  
> **username_3**: Yes, you have to delete that file.  It's normal for it to be 0 bytes - just the fact that it exists signals to Bitcoin Core that another instance is running.  Of course it would be wise to back up your wallet.dat first, just in case.  
> **username_0**: Tks! How to delet .locks? rm is not working, reply is "read-only file system". Then I tried to chmod it, same reply. So currenty it's chmod 644 and change of this or deletion vie rm command is not working.  
> **username_4**: you are giving permissions to file by using chmod, you have to run `sudo rm -rf  ...`  
> **username_0**: Thanks! Didn't work yet, this is what I tried:  $ sudo chmod 777 .lock chmod: changing permissions of '.lock': Read-only file system $ sudo rm -rf .lock rm: cannot remove '.lock': Read-only file system  
> **username_0**: May be uninstalling and new installing helps ... going to try.  
> **username_0**: Still struggeling: After reinstall it's still not running, but at least I could delete the .locks. with the cmmand line and the GUI version, both give me as feedback "cannot obtain a lock on data directory /path/to/flash/drive/. Bitcoin Core is probably already running"  Further help would be appreciated!  

---

## 1 answers

### Answer by username_0 on 2018-04-20. Score: 1

The solution is time consuming but easy. The flash drive was finally reporting read/write errors after a harsh shutdown. Formatting it and new install of bitcoind and loading all blocks again (I had no other drive where I could have copied this amount of data to and wanted to exclude potential issues with the old file permissions).

So the next few days I assume the machine will be busy. However now at block 8000 the CPU is only using 1-2% (Intel Core i5 with 8GB RAM on fedora linux)

> **Comments:**
> **username_5**: Higher dbcache will improve performance. Also, this will destroy your flash drive. Those are not designed for I/O heavy database loads.  
> **username_0**: Thanks username_5, I started bitcoind now with dbcache=40000 and maxconnections=40 but still only 2% CPU and 3% memory usage. Any idea?  
> **username_5**: Yes, don't use a flash drive. It's not designed for heavy database loads.  

---

