Restarting ipfs after reboots and logouts (Linux systemd issues)


I’ve been trying to get an IPFS node running 24/7 on my Raspberry PI with Fedora.

Installation went fine and everything seems to be running correctly with

$ systemctl --user enable ipfs.service
$ systemctl --user start ipfs.service

Of course it stops the service when I log out, as per user instance behaviour for systemd. I tried invoking it as a system instance with a defined user, and ran into a series of SELinux issues I can’t even begin to understand, let alone resolve. So, I went back to a systemd user instance and (not happily) ran “loginctl enable-linger craig”

Now ipfs remains running when I log out, however it doesn’t restart on reboot. After rebooting, the status shows:

$ systemctl --user status ipfs.service
○ ipfs.service - IPFS Daemon
     Loaded: loaded (/home/craig/.config/systemd/user/ipfs.service; enabled; vendor preset: disabled)
     Active: inactive (dead)

And weirdly, I can’t find anything from ipfs in journalctl timestamped after the reboot ( Oh, how I miss /var/log/messages and UNIX text tools :slight_smile: )

Does anybody know how to get this working?

My ipfs.service file is as follows:

Description=IPFS Daemon



ExecStart=/usr/local/bin/ipfs daemon

1 Like

Following up …

The best I was able to do for now was to create the following script (ipfs_alive)


while true
    sleep 60
    STATE=`systemctl --user is-active ipfs.service`
    if [ $STATE == 'inactive' ]; then
        systemctl --user start ipfs.service

and then modify my crontab with “crontab -e”


@reboot ipfs_alive

This functions, but doesn’t seem ideal.