I’m running nohup ipfs daemon & to keep the node up on a server. But somehow it’s getting killed frequently.
A strange thing I noticed in the logs was this:
Initializing daemon... go-ipfs version: 0.4.22- Repo version: 7 System version: amd64/linux Golang version: go1.12.7 Swarm listening on /ip4/127.0.0.1/tcp/4001 Swarm listening on /ip4/172.31.40.167/tcp/4001 Swarm listening on /ip6/::1/tcp/4001 Swarm listening on /p2p-circuit Swarm announcing /ip4/127.0.0.1/tcp/4001 Swarm announcing /ip4/172.31.40.167/tcp/4001 Swarm announcing /ip6/::1/tcp/4001 API server listening on /ip4/127.0.0.1/tcp/5001 WebUI: http://127.0.0.1:5001/webui Gateway (readonly) server listening on /ip4/0.0.0.0/tcp/8080 Daemon is ready Received interrupt signal, shutting down... (Hit ctrl-c again to force-shutdown the daemon.) 19:59:56.490 ERROR core: failure on stop: context canceled builder.go:47
The interrupt part usually comes 5-6hr after I start the daemon. But I haven’t hit CTRL+C, also no one else has access to the server. Any idea how this could happen?
I just tried running ipfs daemon with systemd and got the following error
Jan 22 20:17:08 ip-172-31-40-167 ipfs[27219]: WebUI: http://127.0.0.1:5001/webui Jan 22 20:17:08 ip-172-31-40-167 ipfs[27219]: Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080 Jan 22 20:17:08 ip-172-31-40-167 ipfs[27219]: Daemon is ready Jan 22 20:18:37 ip-172-31-40-167 systemd[1]: ipfs.service: Start operation timed out. Terminating. Jan 22 20:18:37 ip-172-31-40-167 ipfs[27219]: Received interrupt signal, shutting down... Jan 22 20:18:37 ip-172-31-40-167 ipfs[27219]: (Hit ctrl-c again to force-shutdown the daemon.) Jan 22 20:18:37 ip-172-31-40-167 ipfs[27219]: 20:18:37.060 ERROR core: failure on stop: context canceled builder.go:47 Jan 22 20:18:37 ip-172-31-40-167 systemd[1]: Failed to start IPFS Daemon. Jan 22 20:18:37 ip-172-31-40-167 systemd[1]: ipfs.service: Unit entered failed state. Jan 22 20:18:37 ip-172-31-40-167 systemd[1]: ipfs.service: Failed with result 'timeout'.
But this time it got killed in a minute(see timestamps in the log). I will dig deeper into this. Maybe I’m just doing something silly here.
What’s your systemd service file definition? I see you’re using IPFS 0.4.22 but I’m guessing you may be using the systemd service definition from go-ipfs master.
The service definition in go-ipfs master expects the daemon to report a successful start via systemd’s notification system (Type=notify). If it doesn’t, systemd will think the unit has failed to start and will kill it.
Removing the Type=notify line from the service definition should fix this.