Cannot start ipfs daemon

Hello guys,

I am a complete beginner in ipfs and I wanted to install it in my ubuntu environment by using this tutorial here: Tutorial: Host your own IPFS node and help the next generation of web | by David Hawig | Pact Care

The problem is that when I want to start the daemon, the following errors occurs and I cannot seem to find a solution:

ERROR cmd/ipfs ipfs/daemon.go:344 error from node construction: failed to listen on any addresses: [listen tcp4 0.0.0.0:4001: bind: address already in use listen tcp6 [::]:4001: bind: address already in use]

Thank you,
Cristian

Hi Cristian, it sounds like you’re already running ipfs in a separate process. What OS are you using?

Hello @stebalien

Thank you for your reply. I am using Ubuntu 18.04.4 LTS

Cristian

What’s the result of?

systemctl status ipfs.service

And

sudo ss -l -A inet -p
1 Like

Hello @stebalien

Here is the data for the status:

ipfs.service - ipfs daemon
Loaded: loaded (/etc/systemd/system/ipfs.service; enabled; vendor preset: ena
Active: active (running) since Sat 2020-05-02 00:40:33 CEST; 9h ago
Main PID: 9020 (ipfs)
Tasks: 23 (limit: 4915)
CGroup: /system.slice/ipfs.service
└─9020 /usr/local/bin/ipfs daemon --enable-gc
May 02 00:40:34 zulu902 ipfs[9020]: Swarm listening on /ip4/172.17.0.1/tcp/4001
May 02 00:40:34 zulu902 ipfs[9020]: Swarm listening on /ip4/–myip–/tcp/4
May 02 00:40:34 zulu902 ipfs[9020]: Swarm listening on /p2p-circuit
May 02 00:40:34 zulu902 ipfs[9020]: Swarm announcing /ip4/127.0.0.1/tcp/4001
May 02 00:40:34 zulu902 ipfs[9020]: Swarm announcing /ip4/–myip–/tcp/400
May 02 00:40:34 zulu902 ipfs[9020]: API server listening on /ip4/127.0.0.1/tcp/5
May 02 00:40:34 zulu902 ipfs[9020]: WebUI: http://127.0.0.1:5001/webui
May 02 00:40:34 zulu902 ipfs[9020]: Gateway (readonly) server listening on /ip4/
May 02 00:40:34 zulu902 ipfs[9020]: Daemon is ready
May 02 00:40:40 zulu902 systemd[1]: ipfs.service: Current command vanished from

Here is the data for the second command:

NetidState Recv-Q Send-Q Local Address:Port Peer Address:Port
icmp6UNCONN 0 0 %enp2s0:ipv6-icmp : users:((“systemd-network”,pid=396,fd=17))
udp UNCONN 0 0 172.17.0.1:domain 0.0.0.0:
users:((“named”,pid=952,fd=519),(“named”,pid=952,fd=518))
udp UNCONN 0 0 --myip–:domain 0.0.0.0:* users:((“named”,pid=952,fd=517),(“named”,pid=952,fd=516))
udp UNCONN 0 0 127.0.0.1:domain 0.0.0.0:* users:((“named”,pid=952,fd=515),(“named”,pid=952,fd=514))
udp UNCONN 0 0 127.0.0.53%lo:domain 0.0.0.0:* users:((“systemd-resolve”,pid=643,fd=12))
udp UNCONN 0 0 --myip–%enp2s0:bootpc 0.0.0.0:* users:((“systemd-network”,pid=396,fd=19))
udp UNCONN 0 0 [::]:domain [::]:* users:((“named”,pid=952,fd=513),(“named”,pid=952,fd=512))
tcp LISTEN 0 128 127.0.0.1:postgresql 0.0.0.0:* users:((“postgres”,pid=2529,fd=7))
tcp LISTEN 0 100 0.0.0.0:smtp 0.0.0.0:* users:((“smtpd”,pid=2843,fd=6),(“master”,pid=2576,fd=13),(“smtpd”,pid=2028,fd=6))
tcp LISTEN 0 128 127.0.0.1:953 0.0.0.0:* users:((“named”,pid=952,fd=24))
tcp LISTEN 0 100 127.0.0.1:12346 0.0.0.0:* users:((“master”,pid=2576,fd=101))
tcp LISTEN 0 128 0.0.0.0:8443 0.0.0.0:* users:((“sw-cp-serverd”,pid=1761,fd=9),(“sw-cp-serverd”,pid=1759,fd=9))
tcp LISTEN 0 100 0.0.0.0:sieve 0.0.0.0:* users:((“dovecot”,pid=748,fd=15))
tcp LISTEN 0 128 127.0.0.1:12768 0.0.0.0:* users:((“psa-pc-remote”,pid=999,fd=3))
tcp LISTEN 0 128 0.0.0.0:4001 0.0.0.0:* users:((“ipfs”,pid=9020,fd=10))
tcp LISTEN 0 128 0.0.0.0:imaps 0.0.0.0:* users:((“dovecot”,pid=748,fd=39))
tcp LISTEN 0 128 0.0.0.0:pop3s 0.0.0.0:* users:((“dovecot”,pid=748,fd=24))
tcp LISTEN 0 128 127.0.0.1:5001 0.0.0.0:* users:((“ipfs”,pid=9020,fd=36))
tcp LISTEN 0 128 0.0.0.0:pop3 0.0.0.0:* users:((“dovecot”,pid=748,fd=23))
tcp LISTEN 0 128 127.0.0.1:spamd 0.0.0.0:* users:((“spamd child”,pid=29019,fd=5),(“spamd child”,pid=29018,fd=5),(“spamd”,pid=29014,fd=5))
tcp LISTEN 0 128 0.0.0.0:imap2 0.0.0.0:* users:((“dovecot”,pid=748,fd=38))
tcp LISTEN 0 128 127.0.0.1:http-alt 0.0.0.0:* users:((“ipfs”,pid=9020,fd=37))
tcp LISTEN 0 128 0.0.0.0:8880 0.0.0.0:* users:((“sw-cp-serverd”,pid=1761,fd=10),(“sw-cp-serverd”,pid=1759,fd=10))
tcp LISTEN 0 100 0.0.0.0:urd 0.0.0.0:* users:((“master”,pid=2576,fd=110))
tcp LISTEN 0 10 172.17.0.1:domain 0.0.0.0:* users:((“named”,pid=952,fd=25))
tcp LISTEN 0 10 --myip–:domain 0.0.0.0:* users:((“named”,pid=952,fd=23))
tcp LISTEN 0 10 127.0.0.1:domain 0.0.0.0:* users:((“named”,pid=952,fd=22))
tcp LISTEN 0 128 127.0.0.53%lo:domain 0.0.0.0:* users:((“systemd-resolve”,pid=643,fd=13))
tcp LISTEN 0 128 127.0.0.1:3030 0.0.0.0:* users:((“grafana-server”,pid=3099,fd=6))
tcp LISTEN 0 128 0.0.0.0:ssh 0.0.0.0:* users:((“sshd”,pid=1022,fd=3))
tcp LISTEN 0 128 :https : users:((“apache2”,pid=29287,fd=6),(“apache2”,pid=29286,fd=6),(“apache2”,pid=29248,fd=6),(“apache2”,pid=5557,fd=6))
tcp LISTEN 0 128 [::]:8443 [::]:
users:((“sw-cp-serverd”,pid=1761,fd=11),(“sw-cp-serverd”,pid=1759,fd=11))
tcp LISTEN 0 128 [::]:4001 [::]:* users:((“ipfs”,pid=9020,fd=9))
tcp LISTEN 0 128 *:mysql : users:((“mysqld”,pid=1398,fd=21))
tcp LISTEN 0 64 :poppassd : users:((“xinetd”,pid=1681,fd=6))
tcp LISTEN 0 128 :http : users:((“apache2”,pid=29287,fd=4),(“apache2”,pid=29286,fd=4),(“apache2”,pid=29248,fd=4),(“apache2”,pid=5557,fd=4))
tcp LISTEN 0 128 [::]:8880 [::]:
users:((“sw-cp-serverd”,pid=1761,fd=12),(“sw-cp-serverd”,pid=1759,fd=12))
tcp LISTEN 0 64 :ftp : users:((“xinetd”,pid=1681,fd=5))
tcp LISTEN 0 10 [::]:domain [::]:
users:((“named”,pid=952,fd=21))
tcp LISTEN 0 128 [::]:ssh [::]:
users:((“sshd”,pid=1022,fd=4))

In the above data I have changed my hosting IP address with: --myip–

Thanks,
Cristian

You’re already running an ipfs daemon through systemd. This daemon is using the same ports. You’ll either need to disable that instance (sudo systemctl disable --now ipfs.service) or just not try to run the daemon a second time.

Hi @stebalien

I thought that was the case after seeing the commands that you gave me to run…
What I did not understand is why I cannot see the webui. Shouldn’t it be accessible at: http://myserverip:5001/webui ?
When I access it, I get a server timeout message.

Thanks,
Cristian

The API and gateway run on localhost, not your public IP address. You can change this but be careful. The API is powerful and should not be exposed to the public internet.

1 Like

I understand, thank you for all your help :slight_smile:

Cristian