Skip to content

fix(daemon): keep gateway up when --mount fails - #11463

Open
karawitan wants to merge 1 commit into
ipfs:masterfrom
karawitan:fix/daemon-gateway-when-mount-fails-8977
Open

karawitan wants to merge 1 commit into
ipfs:masterfrom
karawitan:fix/daemon-gateway-when-mount-fails-8977

Conversation

@karawitan

Copy link
Copy Markdown
Contributor

What

Fixes #8977.

When ipfs daemon --mount was requested but the FUSE mount failed (missing or unusable mount points, no FUSE support, permission errors, etc.), the daemon aborted before reaching serveHTTPGateway, so the node silently stopped acting as a gateway. The startup output did not even mention the gateway.

Why

The startup sequence in cmd/ipfs/kubo/daemon.go ordered the FUSE mount (mountFuse) before serveHTTPGateway:

if mount {
    if err := mountFuse(req, cctx); err != nil {
        return err          // <-- daemon exits here
    }
    ...
}
...
gwErrc, err := serveHTTPGateway(req, cctx)   // <-- never reached

A FUSE mount is an optional, experimental feature. Its failure should not take down the HTTP gateway the operator asked the daemon to serve, nor the rest of the daemon (GC, libp2p gateway, metrics, MFS pinning).

Change

When mountFuse fails, print a warning to stderr and via the log, then continue without FUSE mounts so the rest of the daemon — including the HTTP gateway — starts normally. The unmount cleanup defer only runs when the mount actually succeeded.

This is a bug fix for the kind/bug/help wanted issue #8977; it does not touch the /api/v0/ RPC API, the HTTP gateway contract, the CID recipe, or any wire behavior.

Verification

  • go build ./cmd/ipfs/ and go vet ./cmd/ipfs/ ./test/cli/ pass.
  • New regression test TestDaemonGatewayUpWhenMountFails in test/cli/daemon_mount_test.go:
    • starts the daemon with --mount and non-existent mount paths (forces mountFuse to fail at checkFusePath, no FUSE support needed on the host),
    • asserts the gateway still serves content (GET /ipfs/<cid> → 200),
    • asserts the mount failure is reported on stderr and nothing was silently mounted.
  • Test passes locally.
=== RUN   TestDaemonGatewayUpWhenMountFails
--- PASS: TestDaemonGatewayUpWhenMountFails (2.87s)
    --- PASS: TestDaemonGatewayUpWhenMountFails/gateway_still_serves_content (0.00s)
    --- PASS: TestDaemonGatewayUpWhenMountFails/mount_failure_was_reported_on_stderr (0.00s)
PASS

Changelog

Added a highlight to docs/changelogs/v0.44.md.

Generated with Devin

When `ipfs daemon --mount` was requested but the FUSE mount failed
(missing/unusable mount points, no FUSE support, permission errors,
etc.), mountFuse returned an error and the daemon aborted before
reaching serveHTTPGateway, so the node silently stopped acting as a
gateway with no clear indication why. The gateway, libp2p gateway, GC,
and the rest of the daemon startup sequence after the mount step never
ran.

A FUSE mount is an optional, experimental feature; its failure should
not take down the gateway the operator asked the daemon to serve. Warn
on stderr and via the log, then continue without FUSE mounts so the
rest of the daemon (gateway included) starts normally.

Closes ipfs#8977.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@karawitan
karawitan requested a review from a team as a code owner September 11, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ipfs daemon doesn't act as a gateway if --mount fails

1 participant