I run my bitcoin-qt on headless raspberrypi where it runs pretty smoothly.
The Issue starts when Marco gui crashes via vnc so the Bitcoin-qt GUI is hanging although that deamon is still running as a process when i check with

ps -ax | grep bitcoin

In short I can't access the gui and close it normaly the only way to still access is through ssh and I tried

bitcoin-qt stop
bitcoin-qt: cannot connect to xserver

What is the proper way to terminate/stop safely my bitcoin-qt process?

2 Answers 2


kill <PID> should just work fine.

  • Not the answer I look for cause I already used that one. My blockchain got corrupted.
    – Denja
    Commented Mar 1, 2018 at 18:23
  • That's a bit weird. Are you sure it does not get corrupted when you normally close it? superuser.com/questions/406920/…
    – Jannes
    Commented Mar 2, 2018 at 13:12
  • 1
    @Denja How long did you wait? Bitcoin Core may take seconds or even minutes to flush all its caches at shutdown time. If you can't see the UI it may be best to watch debug.log file to see when it is safely shut down. Commented Apr 1, 2018 at 15:03

My answer is no different to the answer by Jannes, just with more explanation.

If you key: kill PID then if no signal specified in the kill command, signal # 15 (SIGTERM), is sent by default. This is the same as kill -15 PID and is considered safe, so you can specify SIGTERM manually if you like. If this cannot close your process without corruption then it was probably inevitable.

Note that upon closing, bitcoin-qt opens a new GUI window for the close process, with the do not shut down your computer message.

It may be a better solution to try and revive your GUI session before you exit bitcoin-qt.

Note that if you starte bitcoin-qt with the correctly configured -server option you can use bitcoin-cli stop to close bitcoin-qt.

nixCraft - Kill Process in Linux or Terminate a Process in UNIX / Linux Systems - https://www.cyberciti.biz/faq/kill-process-in-linux-or-terminate-a-process-in-unix-or-linux-systems/

  • There is no reason why the "do not shut down" window couldn't be created, given that there already is an existing window. Commented Apr 1, 2018 at 15:02
  • @PieterWuille I was looking at the OP error: bitcoin-qt: cannot connect to xserver
    – Willtech
    Commented Apr 1, 2018 at 16:06
  • Yes, that's expected. He can't run bitcoin-qt from an environment without xserver. But the existing bitcoin-qt process clearly does have an environment with an xserver, and will open windows there. Commented Apr 1, 2018 at 17:02
  • @PieterWuille is receiving another SIGTERM handled if bitcoin-qt is already on the shutting down process window?
    – Willtech
    Commented Apr 1, 2018 at 22:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.