Ipfs running bug

Q1:after I run “ipfs daemon > ./test.txt &” on linux, it seems the ipfs process be shutdown automatcilly after a while, maybe one day, maybe half a day. Is there any solutions to this problem?

Q2:how to run ipfs damon backgroundly on windows?

thank you

Q1: I have ipfs running on one of my nodes for weeks at a time without issues (interrupted only by server reboots following patch installations), so it’s probably not a general issue. I think troubleshooting this is going to require some additional information.

If you can capture some debugging information using ipfs --debug daemon &> ./debug.txt it might help show what’s happening leading up to the process crash.

edit: I was just thinking that the --debug flag may generate a lot of data over a day. The output from ipfs daemon &> ./debug.txt might be sufficient.

Q2: There are some ideas for how to do this with go-ipfs in this GitHub issue. FWIW it seems to be much easier to do on Linux.

1 Like

tnx for ur detailed reply. but I still have some questions.
I ran “ipfs --debug daemon &> ./debug.txt” on linux, but I couldnt find debug.txt in the file of “go-ipfs” and it showed all the process information in the command line. So I ran “ipfs daemon & > ./debug.txt”,but I also couldnt find “debug.txt”…

If you don’t see any output from the following command I’m guessing there’s something else wrong.

`ipfs --debug daemon &> ./debug.txt &`;sleep 5;ipfs shutdown;cat ./debug.txt

What this does:

  1. Starts the ipfs daemon in the background with logging to ./debug.txt
  2. waits for 5 seconds to give it time for some output to be generated
  3. shuts down the ipfs daemon
  4. spits out contents of ./debug.txt
1 Like

I really appreciate ur help. the ipfs seems running normally.tnx

Hi,it seems that the ipfs shutdown automatically…here is the screenshot of debug.txt


pls help me to resolve the problem. btw,I used “ipfs --debug daemon &> ./debug.txt &” to run ipfs online.
tnx

What was happening on the system when the process shut down? Did you log out of the machine, or did the machine go to sleep? Were you actively using it?

What you posted looks like what I see when I intentionally kill the daemon using CTRL+C; it doesn’t look like a crash from your screenshot. I’m guessing something is intentionally telling the ipfs daemon process to stop.

1 Like

thank you.
I used XShell to operate the server. I found that when I close the xshell which means I lose the connection to server, the ipfs shutdow automatically… is there anyway to run ipfs eternally?

It depends on your linux distribution’s init system. I personally use Ubuntu 16.04 server and have a custom systemd service created for ipfs at /lib/systemd/system/ipfs.service:

[Unit]
Description=IPFS daemon
After=network.target

[Service]
ExecStart=/usr/local/bin/ipfs daemon
User=*put your own user here*
Group=*put your own group here*

[Install]
WantedBy=multi-user.target

This assumes that you’ve installed ipfs to /usr/local/bin/ipfs, but if the executable is located somewhere else then you can update the path in the ipfs.service file.

After creating the service file I then configured the systemd service to automatically start by running the following commands:

sudo systemctl enable ipfs.service
sudo systemctl start ipfs.service

This should start the ipfs daemon in the background on boot and allow it to run without you needing to be connected.

This is very similar to the systemd example in the documentation, but if your distribution uses a different init system there are other examples here: https://github.com/ipfs/examples/tree/master/examples/init

2 Likes