0

I am hosting a bitcoind on my AWS EC2 instace and I have made it as a user service using the following service file:

[Unit]
Description=Bitcoind

[Service]
Type=simple
ExecStart=/usr/local/bin/bitcoind
Restart=always

[Install]
WantedBy=default.target

In normal days things work just fine. I notice sometimes the bitcoind restarts quite heavily but that is another story and in the systemctl perspective at least it can restarted.

Here I includes a log which shows both normal and the problematic parts:

Mar 02 10:39:46 ip- systemd[2751]: Started Bitcoind.
Mar 02 10:40:07 ip- systemd[2751]: bitcoind.service: Service hold-off time over, scheduling restart.
Mar 02 10:40:07 ip- systemd[2751]: Stopped Bitcoind.
Mar 02 10:40:07 ip- systemd[2751]: Started Bitcoind.
Mar 02 21:06:26 ip- systemd[2751]: Stopping Bitcoind...
Mar 02 21:06:28 ip- systemd[2751]: Stopped Bitcoind.
Mar 03 03:37:45 ip- systemd[28091]: Started Bitcoind.
Mar 03 03:59:15 ip- systemd[28091]: bitcoind.service: Service hold-off time over, scheduling restart.
Mar 03 03:59:15 ip- systemd[28091]: Stopped Bitcoind.
Mar 03 03:59:15 ip- systemd[28091]: Started Bitcoind.
Mar 03 04:01:09 ip- systemd[28091]: Started Bitcoind.
Mar 03 04:01:16 ip- systemd[28091]: Started Bitcoind.
Mar 03 04:01:22 ip- systemd[28091]: bitcoind.service: Service hold-off time over, scheduling restart.
Mar 03 04:01:22 ip- systemd[28091]: Stopped Bitcoind.
Mar 03 04:01:22 ip- systemd[28091]: Started Bitcoind.
Mar 03 04:14:35 ip- systemd[28091]: Stopping Bitcoind...
Mar 03 04:14:35 ip- systemd[28091]: Stopped Bitcoind.
Mar 03 04:15:44 ip- systemd[13180]: Started Bitcoind.

From time to time, the service would stop but the systemctl didn't restart it. It is restarted only when I ssh to the instance and it seems to "make everything come back to live" again.

From the log this happens on

Mar 02 21:06:26 ip- systemd[2751]: Stopping Bitcoind...
Mar 02 21:06:28 ip- systemd[2751]: Stopped Bitcoind.
Mar 03 03:37:45 ip- systemd[28091]: Started Bitcoind.

Apparently systemctl notices the stopping of bitcoind but it only restarts until I ssh to the instance.

Is there any direction I can further troubleshoot the issue. Any help is appreciated and I will try my best to provide as many information as possible.

1

I have made it as a user service […] It is restarted only when I ssh to the instance […]

The per-user instance of systemd only runs when you have one or more active login sessions. As you can see in your log, there are three instances of it with three different process IDs. When the last of your login sessions hangs up, systemd-logind stops your per-user instance of systemd, and starts a fresh one when your next login session begins. Naturally, if there is no service manager the managed services are not running.

You can change this using the enable-linger subcommand of the loginctl command.

Further reading

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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