ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
16.2k stars 3.03k forks source link

ipfs daemon --mount not working #10340

Closed gdkrmr closed 2 months ago

gdkrmr commented 9 months ago

Checklist

Installation method

third-party binary

Version

Kubo version: 0.25.0
Repo version: 15
System version: amd64/linux
Golang version: go1.21.5

Config

{
  "API": {
    "HTTPHeaders": {}
  },
  "Addresses": {
    "API": "/ip4/127.0.0.1/tcp/5001",
    "Announce": [],
    "AppendAnnounce": [],
    "Gateway": "/ip4/127.0.0.1/tcp/8082",
    "NoAnnounce": [],
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001",
      "/ip4/0.0.0.0/udp/4001/quic-v1",
      "/ip4/0.0.0.0/udp/4001/quic-v1/webtransport",
      "/ip6/::/udp/4001/quic-v1",
      "/ip6/::/udp/4001/quic-v1/webtransport"
    ]
  },
  "AutoNAT": {},
  "Bootstrap": [
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
    "/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
    "/ip4/104.131.131.82/udp/4001/quic-v1/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
  ],
  "DNS": {
    "Resolvers": {}
  },
  "Datastore": {
    "BloomFilterSize": 0,
    "GCPeriod": "1h",
    "HashOnRead": false,
    "Spec": {
      "mounts": [
        {
          "child": {
            "path": "blocks",
            "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
            "sync": true,
            "type": "flatfs"
          },
          "mountpoint": "/blocks",
          "prefix": "flatfs.datastore",
          "type": "measure"
        },
        {
          "child": {
            "compression": "none",
            "path": "datastore",
            "type": "levelds"
          },
          "mountpoint": "/",
          "prefix": "leveldb.datastore",
          "type": "measure"
        }
      ],
      "type": "mount"
    },
    "StorageGCWatermark": 90,
    "StorageMax": "10GB"
  },
  "Discovery": {
    "MDNS": {
      "Enabled": true
    }
  },
  "Experimental": {
    "FilestoreEnabled": true,
    "GraphsyncEnabled": false,
    "Libp2pStreamMounting": false,
    "OptimisticProvide": false,
    "OptimisticProvideJobsPoolSize": 0,
    "P2pHttpProxy": false,
    "StrategicProviding": false,
    "UrlstoreEnabled": false
  },
  "Gateway": {
    "APICommands": [],
    "DeserializedResponses": null,
    "DisableHTMLErrors": null,
    "ExposeRoutingAPI": null,
    "HTTPHeaders": {},
    "NoDNSLink": false,
    "NoFetch": false,
    "PathPrefixes": [],
    "PublicGateways": null,
    "RootRedirect": ""
  },
  "Identity": {
    "PeerID": "12D3KooWGq9xUywoxFjVUrM4J2SvfEqZULS18oE3hnz3cnqYZ7kZ"
  },
  "Internal": {},
  "Ipns": {
    "RecordLifetime": "",
    "RepublishPeriod": "",
    "ResolveCacheSize": 128
  },
  "Migration": {
    "DownloadSources": [],
    "Keep": ""
  },
  "Mounts": {
    "FuseAllowOther": false,
    "IPFS": "/ipfs",
    "IPNS": "/ipns"
  },
  "Peering": {
    "Peers": null
  },
  "Pinning": {
    "RemoteServices": {}
  },
  "Plugins": {
    "Plugins": null
  },
  "Provider": {
    "Strategy": ""
  },
  "Pubsub": {
    "DisableSigning": false,
    "Router": ""
  },
  "Reprovider": {},
  "Routing": {
    "AcceleratedDHTClient": false,
    "Methods": null,
    "Routers": null
  },
  "Swarm": {
    "AddrFilters": null,
    "ConnMgr": {},
    "DisableBandwidthMetrics": false,
    "DisableNatPortMap": false,
    "RelayClient": {},
    "RelayService": {},
    "ResourceMgr": {},
    "Transports": {
      "Multiplexers": {},
      "Network": {},
      "Security": {}
    }
  }
}

Description

ipfs daemon --mount

does not work. I have seen similar issues reported here but I couldn't find this exact same issue.

kubo is installed through the Manjaro repositories. I have also tested this with the v0.26.0 binary downloaded from Github and a colleague confirmed the issue.

I have created /ipfs and /ipns and the folders belong to me

$ ll / | grep ip                                                                         
drwxr-xr-x   2 gkraemer gkraemer 4.0K Feb 12 22:17 ipfs
drwxr-xr-x   2 gkraemer gkraemer 4.0K Feb 12 22:17 ipns

after launching ipfs daemon --mount, something gets mounted in these folders

$ ll / | grep ip                                                        
d--x--x--x   1 root root    0 Feb 14 21:13 ipfs
d--x--x--x   1 root root    0 Feb 14 21:13 ipns

trying to access anything from these folders tells me "No such file or directory".

I have tried setting user_allow_other and changing the permissions of the directories while unmounted and mounted but to no avail.

aschmahmann commented 9 months ago

How are you running kubo? Are you running ipfs daemon as root (shouldn't be needed), the folder permissions changing looks suspicious.

3ri4nG0ld commented 9 months ago

This feature could be reimplemented using "ipfs filestore", I don't know if something similar is already thought of, or if you plan to keep the --mount, but both methods would seem useful to me.

gdkrmr commented 9 months ago

How are you running kubo? Are you running ipfs daemon as root (shouldn't be needed), the folder permissions changing looks suspicious.

I don't run kubo as root.

ProximaNova commented 3 months ago

Basic checklist for FUSE-mounting IPFS:

I know you said that you already did some of these things, but you didn't comment on the other things. Oh wait, I see that you posted '"FuseAllowOther": false,' - and that's almost certainly your problem.

Author input needed to mark this issue as solved?

gdkrmr commented 2 months ago

Thanks for looking at this. I followed the steps and get a different error now:

$ ipfs config --json Mounts.FuseAllowOther                                                                                                                                                   
true
$ ll / | grep ip  
drwxr-xr-x   2 gkraemer gkraemer 4.0K Feb 12  2024 ipfs
drwxr-xr-x   2 gkraemer gkraemer 4.0K Feb 12  2024 ipns
$ cat /etc/fuse.conf | grep user_allow_other                                                                                                                                                          
# user_allow_other - Using the allow_other mount option works fine as root, but
# in order to have it work as a regular user, you need to set user_allow_other
user_allow_other
$ echo test > test   
$ ipfs add test    
added QmeomffUNfmQy76CQGy9NdmqEnnHU9soCexBnGU3ezPHVH test
 5 B / 5 B [===============================================================================================================================================================================================] 100.00% 
$ ipfs name publish QmeomffUNfmQy76CQGy9NdmqEnnHU9soCexBnGU3ezPHVH                                                                                                                                    
Published to k51qzi5uqu5dis3bmsaehjsm3v6k1mc94yi0kk79uxxmqphsw5k6plo91jftd2: /ipfs/QmeomffUNfmQy76CQGy9NdmqEnnHU9soCexBnGU3ezPHVH
$ ipfs daemon --mount
Initializing daemon...
Kubo version: 0.29.0
Repo version: 15
System version: amd64/linux
Golang version: go1.22.4

[...]

RPC API server listening on /ip4/127.0.0.1/tcp/5002
WebUI: http://127.0.0.1:5002/webui
2024-09-05T10:46:46.946+0200    ERROR   node    node/mount_unix.go:96   error mounting: root can't be a file (unixfs type: File)

Error: root can't be a file (unixfs type: File)
ProximaNova commented 2 months ago

error mounting: root can't be a file (unixfs type: File) Error: root can't be a file (unixfs type: File)

It didn't work because you tried to publish a file to IPNS. You can only publish a folder to IPNS (I didn't write that in my steps). Run something like this (folder contains darkhttpd web server source code): "ipfs name publish /ipfs/bafybeiawvadz46hpwl2hw2darjone46gvajm7td4dgowjpdvz5f5eee7qi".

Above in this thread, I said that mounting IPFS doesn't work in 32-bit computers. That's not entirely correct. It didn't work in a specific ~decade-ago version of a certain Linux distro. This month I saw that I could mount IPFS in a 32-bit computer which is basically running a liveboot of the latest Debian. (Now my problem is that I cannot run Tor and torsocks in said 32-bit computer, even after hours of trying to fix it.)

gdkrmr commented 2 months ago

Thanks for taking the time to debug this for me! It works now for me.