Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux: failed: listen tcp4 127.0.0.1:5001: bind: address already in use #2216

Open
ankurpython opened this issue Jul 26, 2022 · 7 comments
Open
Labels
area/linux Linux kind/bug A bug in existing code (including security flaws) P2 Medium: Good to have, but can wait until someone steps up topic/linux Linux specific

Comments

@ankurpython
Copy link

👉️ Please describe what you were doing when this error happened.

Specifications

  • OS: linux
  • IPFS Desktop Version: 0.22.0
  • Electron Version: 19.0.8
  • Chrome Version: 102.0.5005.148

Error

Error: Initializing daemon...
Kubo version: 0.14.0
Repo version: 12
System version: amd64/linux
Golang version: go1.18.3
2022/07/26 11:07:10 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size for details.
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/172.16.25.82/tcp/4001
Swarm listening on /ip4/172.17.0.1/tcp/4001
Swarm listening on /ip4/172.18.0.1/tcp/4001
Swarm listening on /ip4/172.19.0.1/tcp/4001
Swarm listening on /ip4/172.20.0.1/tcp/4001
Swarm listening on /ip4/172.21.0.1/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.16.25.82/tcp/4001
Swarm announcing /ip6/::1/tcp/4001

Error: serveHTTPApi: manet.Listen(/ip4/127.0.0.1/tcp/5001) failed: listen tcp4 127.0.0.1:5001: bind: address already in use

    at errorTemplate (/opt/IPFS Desktop/resources/app.asar/src/daemon/migration-prompt.js:78:49)
    at loadWindow (/opt/IPFS Desktop/resources/app.asar/src/daemon/migration-prompt.js:115:26)
    at module.exports (/opt/IPFS Desktop/resources/app.asar/src/daemon/migration-prompt.js:120:3)
    a
@ankurpython ankurpython added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Jul 26, 2022
@SgtPooki SgtPooki moved this to To do in IPFS-GUI (PL EngRes) Jul 26, 2022
@hacdias hacdias changed the title [gui error report] Error: Initializing daemon... failed: listen tcp4 127.0.0.1:5001: bind: address already in use Jul 29, 2022
@hacdias
Copy link
Member

hacdias commented Jul 29, 2022

Hi @ankurpython,

It seems that IPFS Desktop failed to detect that something was already running on 5001, or it did and you chose not to change the ports. The error is clear, there is something running on port 5001. Do you perhaps know what it is?

I see you're on Linux, so if you run:

sudo netstat -tulpn | grep LISTEN | grep 5001

You can see whatever process is running on that port, shut it down, and retry.

@ipfs ipfs deleted a comment from welcome bot Jul 29, 2022
@hacdias hacdias added need/author-input Needs input from the original author and removed need/triage Needs initial labeling and prioritization labels Jul 29, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2022

Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.

@hacdias
Copy link
Member

hacdias commented Aug 9, 2022

@lidel as per our discussion yesterday, I checked if the workflow for detecting the busy ports is working correctly and it seems to be working well on both macOS and Windows. Could you check if it works well on your Linux distro? It may be an issue with Linux in general, or a specific distribution.

@SgtPooki SgtPooki added P2 Medium: Good to have, but can wait until someone steps up area/linux Linux topic/linux Linux specific labels Aug 15, 2022
@SgtPooki SgtPooki moved this from To do to Planning in IPFS-GUI (PL EngRes) Aug 15, 2022
@lidel
Copy link
Member

lidel commented Aug 15, 2022

@hacdias how did you test?

I've shut down IPFS node and run unrelated HTTP server on port 5001 via

$ npx serve -l 5001 -d

Then I started ./ipfs-desktop-0.22.0-linux-x86_64.AppImage and it failed silently like this:

$ ./ipfs-desktop-0.22.0-linux-x86_64.AppImage
2022-08-15T16:49:43.774Z info: [meta] logs can be found on /home/lidel/.config/IPFS Desktop
2022-08-15T16:49:44.980Z info: [web ui] loading STARTED
2022-08-15T16:49:45.637Z info: [App] startup time - 2.0857269892692565 seconds
2022-08-15T16:49:45.639Z info: [web ui] loading FINISHED 0.6585600352287293s
2022-08-15T16:49:45.655Z info: [web ui] window ready
2022-08-15T16:49:45.656Z info: [web ui] navigate to /
Checking for update
2022-08-15T16:49:45.662Z info: [tray] starting
2022-08-15T16:49:45.717Z info: [tray] started
2022-08-15T16:49:45.718Z info: [ipfsd] start daemon STARTED
2022-08-15T16:49:45.796Z error: [ipfsd] start daemon HTTPError: <!DOCTYPE html><head> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/> <style> body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; cursor: default; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; } main, aside, section { display: flex; justify-content: center; align-items: center; flex-direction: column; } main { height: 100%; } aside { background: #000; flex-shrink: 1; padding: 30px 20px; } aside p { margin: 0; color: #999999; font-size: 14px; line-height: 24px; } aside a { color: #fff; text-decoration: none; } section span { font-size: 24px; font-weight: 500; display: block; border-bottom: 1px solid #EAEAEA; text-align: center; padding-bottom: 20px; width: 100px; } section p { font-size: 14px; font-weight: 400; } section span + p { margin: 20px 0 0 0; } @media (min-width: 768px) { section { height: 40px; flex-direction: row; } section span, section p { height: 100%; line-height: 40px; } section span { border-bottom: 0; border-right: 1px solid #EAEAEA; padding: 0 20px 0 0; width: auto; } section span + p { margin: 0; padding-left: 20px; } aside { padding: 50px 0; } aside p { max-width: 520px; text-align: center; } } </style></head><body> <main> <section> <span>404</span> <p>The requested path could not be found</p> </section> </main></body>
    at Object.errorHandler [as handleError] (/tmp/.mount_ipfs-d4EwGbi/resources/app.asar/node_modules/ipfs-http-client/cjs/src/lib/core.js:84:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Client.fetch (/tmp/.mount_ipfs-d4EwGbi/resources/app.asar/node_modules/ipfs-utils/src/http.js:145:9)
    at async Object.id (/tmp/.mount_ipfs-d4EwGbi/resources/app.asar/node_modules/ipfs-http-client/cjs/src/id.js:12:17)
    at async Daemon.start (/tmp/.mount_ipfs-d4EwGbi/resources/app.asar/node_modules/ipfsd-ctl/src/ipfsd-daemon.js:268:16)
    at async startIpfsWithLogs (/tmp/.mount_ipfs-d4EwGbi/resources/app.asar/src/daemon/daemon.js:144:5)
    at async module.exports (/tmp/.mount_ipfs-d4EwGbi/resources/app.asar/src/daemon/daemon.js:194:17)
    at async startIpfs (/tmp/.mount_ipfs-d4EwGbi/resources/app.asar/src/daemon/index.js:47:17)
    at async module.exports (/tmp/.mount_ipfs-d4EwGbi/resources/app.asar/src/daemon/index.js:115:3)
    at async run (/tmp/.mount_ipfs-d4EwGbi/resources/app.asar/src/index.js:84:5)
2022-08-15T16:49:45.815Z info: [automatic gc] enabled
2022-08-15T16:49:45.816Z info: [pubsub] disabled
2022-08-15T16:49:45.816Z info: [ipns over pubsub] disabled
2022-08-15T16:49:45.820Z info: [launch on startup] disabled
[31913:0815/184946.096041:ERROR:browser_main_loop.cc(271)] Gdk: gdk_window_thaw_toplevel_updates: assertion 'window->update_and_descendants_freeze_count > 0' failed
Update for version 0.22.0 is not available (latest version: 0.22.0, downgrade is disallowed).
2022-08-15T16:49:46.651Z info: [updater] update not available
2022-08-15T16:50:16.169Z info: [web ui] window hidden
^C

No GUI informing user about port being taken, just webui in broken state:

2022-08-15-185014_1440x900_scrot

@hacdias
Copy link
Member

hacdias commented Aug 16, 2022

@lidel that is exactly what I did (albeit I used caddy instead of npx serve). I followed your steps on macOS and Windows and it works as expected.

image

It clearly is a problem with Linux, but we need to understand if it is a general error, or specifically to certain distributions.

@SgtPooki
Copy link
Member

Seems like we need to do some debugging in Linux

@SgtPooki SgtPooki removed the need/author-input Needs input from the original author label Aug 22, 2022
@SgtPooki
Copy link
Member

@lidel is OOO this week so this will probably be delayed until he gets back

@SgtPooki SgtPooki moved this from Planning to Needs Prep work / blocked in IPFS-GUI (PL EngRes) Nov 22, 2022
@hacdias hacdias removed their assignment May 27, 2024
@lidel lidel removed their assignment Jun 12, 2024
@lidel lidel changed the title failed: listen tcp4 127.0.0.1:5001: bind: address already in use Linux: failed: listen tcp4 127.0.0.1:5001: bind: address already in use Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/linux Linux kind/bug A bug in existing code (including security flaws) P2 Medium: Good to have, but can wait until someone steps up topic/linux Linux specific
Projects
No open projects
Status: Needs Prep Work / Blocked
Development

No branches or pull requests

4 participants