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

netlinkrib: permission denied #9513

Open
3 tasks done
NatoBoram opened this issue Dec 18, 2022 · 6 comments
Open
3 tasks done

netlinkrib: permission denied #9513

NatoBoram opened this issue Dec 18, 2022 · 6 comments
Labels
kind/bug A bug in existing code (including security flaws) P4 Very low priority topic/linux Linux specific

Comments

@NatoBoram
Copy link
Contributor

NatoBoram commented Dec 18, 2022

Checklist

Installation method

built from source

Version

Kubo version: 0.19.0-dev-430a65ad5
Repo version: 13
System version: arm64/android
Golang version: go1.19.4

Config

{
  "API": {
    "HTTPHeaders": {}
  },
  "Addresses": {
    "API": "/ip4/127.0.0.1/tcp/5001",
    "Announce": [],
    "AppendAnnounce": [],
    "Gateway": "/ip4/127.0.0.1/tcp/8080",
    "NoAnnounce": [],
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001",
      "/ip4/0.0.0.0/udp/4001/quic",
      "/ip4/0.0.0.0/udp/4001/quic-v1",
      "/ip4/0.0.0.0/udp/4001/quic-v1/webtransport",
      "/ip6/::/udp/4001/quic",
      "/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/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": {
    "AcceleratedDHTClient": false,
    "FilestoreEnabled": false,
    "GraphsyncEnabled": false,
    "Libp2pStreamMounting": false,
    "P2pHttpProxy": false,
    "StrategicProviding": false,
    "UrlstoreEnabled": false
  },
  "Gateway": {
    "APICommands": [],
    "HTTPHeaders": {
      "Access-Control-Allow-Headers": [
        "X-Requested-With",
        "Range",
        "User-Agent"
      ],
      "Access-Control-Allow-Methods": [
        "GET"
      ],
      "Access-Control-Allow-Origin": [
        "*"
      ]
    },
    "NoDNSLink": false,
    "NoFetch": false,
    "PathPrefixes": [],
    "PublicGateways": null,
    "RootRedirect": "",
    "Writable": false
  },
  "Identity": {
    "PeerID": "12D3KooWRkhCTGb9ZC33x1QWeWPRNJE43EXbT1zkFuMN7RkvTufo"
  },
  "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": {
    "Methods": null,
    "Routers": null
  },
  "Swarm": {
    "AddrFilters": null,
    "ConnMgr": {},
    "DisableBandwidthMetrics": false,
    "DisableNatPortMap": false,
    "RelayClient": {},
    "RelayService": {},
    "ResourceMgr": {},
    "Transports": {
      "Multiplexers": {},
      "Network": {},
      "Security": {}
    }
  }
}

Description

Running ipfs daemon results in this error:

Initializing daemon...
Kubo version: 0.19.0-dev-430a65ad5
Repo version: 13
System version: arm64/android
Golang version: go1.19.4

Computing default go-libp2p Resource Manager limits based on:
    - 'Swarm.ResourceMgr.MaxMemory': "939 MB"
    - 'Swarm.ResourceMgr.MaxFileDescriptors': 16384

Applying any user-supplied overrides on top.
Run 'ipfs swarm limit all' to see the resulting limits.

2022-12-18T16:17:31.365Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}
2022-12-18T16:17:31.388Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}
2022-12-18T16:17:31.389Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}
2022-12-18T16:17:31.389Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}
2022-12-18T16:17:31.389Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}
2022-12-18T16:17:31.392Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}
2022-12-18T16:17:31.393Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}
2022-12-18T16:17:31.394Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}
2022-12-18T16:17:31.394Z        ERROR   core    core/builder.go:158     constructing the node: route ip+net: netlinkrib: permission denied

Error: constructing the node (see log for full detail): route ip+net: netlinkrib: permission denied
2022-12-18T16:17:31.395Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}

It happens on this hardware:

u0_a267@localhost
-----------------
OS: Android 13 aarch64
Host: google Pixel 3
Kernel: 4.9.332-NekoMiya+
Uptime: 1 day, 12 hours
Packages: 146 (dpkg), 1 (pkg)
Shell: bash 5.2.15
CPU: Qualcomm SDM845 (8) @ 1.766GHz
Memory: 2624MiB / 3582MiB
@NatoBoram NatoBoram added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Dec 18, 2022
@Jorropo
Copy link
Contributor

Jorropo commented Jan 4, 2023

related golang/go#40569

@guseggert guseggert added need/author-input Needs input from the original author status/blocked Unable to be worked further until needs are met P4 Very low priority and removed need/triage Needs initial labeling and prioritization labels Jan 30, 2023
@lidel lidel added topic/linux Linux specific and removed status/blocked Unable to be worked further until needs are met labels Feb 13, 2023
@lidel lidel removed the need/author-input Needs input from the original author label Feb 13, 2023
@Jorropo
Copy link
Contributor

Jorropo commented Feb 13, 2023

We should add a hint to enable the localisation authorizations in your app in your error message. Actually seems that this is unrelated, to investigate ?

A better fix would be able to run a transiant node without fetching local addresses but that a bigger refactor.

@yianding
Copy link

Checklist

Installation method

built from source

Version

Kubo version: 0.19.0-dev-430a65ad5
Repo version: 13
System version: arm64/android
Golang version: go1.19.4

Config

{
  "API": {
    "HTTPHeaders": {}
  },
  "Addresses": {
    "API": "/ip4/127.0.0.1/tcp/5001",
    "Announce": [],
    "AppendAnnounce": [],
    "Gateway": "/ip4/127.0.0.1/tcp/8080",
    "NoAnnounce": [],
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001",
      "/ip4/0.0.0.0/udp/4001/quic",
      "/ip4/0.0.0.0/udp/4001/quic-v1",
      "/ip4/0.0.0.0/udp/4001/quic-v1/webtransport",
      "/ip6/::/udp/4001/quic",
      "/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/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": {
    "AcceleratedDHTClient": false,
    "FilestoreEnabled": false,
    "GraphsyncEnabled": false,
    "Libp2pStreamMounting": false,
    "P2pHttpProxy": false,
    "StrategicProviding": false,
    "UrlstoreEnabled": false
  },
  "Gateway": {
    "APICommands": [],
    "HTTPHeaders": {
      "Access-Control-Allow-Headers": [
        "X-Requested-With",
        "Range",
        "User-Agent"
      ],
      "Access-Control-Allow-Methods": [
        "GET"
      ],
      "Access-Control-Allow-Origin": [
        "*"
      ]
    },
    "NoDNSLink": false,
    "NoFetch": false,
    "PathPrefixes": [],
    "PublicGateways": null,
    "RootRedirect": "",
    "Writable": false
  },
  "Identity": {
    "PeerID": "12D3KooWRkhCTGb9ZC33x1QWeWPRNJE43EXbT1zkFuMN7RkvTufo"
  },
  "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": {
    "Methods": null,
    "Routers": null
  },
  "Swarm": {
    "AddrFilters": null,
    "ConnMgr": {},
    "DisableBandwidthMetrics": false,
    "DisableNatPortMap": false,
    "RelayClient": {},
    "RelayService": {},
    "ResourceMgr": {},
    "Transports": {
      "Multiplexers": {},
      "Network": {},
      "Security": {}
    }
  }
}

Description

Running ipfs daemon results in this error:

Initializing daemon...
Kubo version: 0.19.0-dev-430a65ad5
Repo version: 13
System version: arm64/android
Golang version: go1.19.4

Computing default go-libp2p Resource Manager limits based on:
    - 'Swarm.ResourceMgr.MaxMemory': "939 MB"
    - 'Swarm.ResourceMgr.MaxFileDescriptors': 16384

Applying any user-supplied overrides on top.
Run 'ipfs swarm limit all' to see the resulting limits.

2022-12-18T16:17:31.365Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}
2022-12-18T16:17:31.388Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}
2022-12-18T16:17:31.389Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}
2022-12-18T16:17:31.389Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}
2022-12-18T16:17:31.389Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}
2022-12-18T16:17:31.392Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}
2022-12-18T16:17:31.393Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}
2022-12-18T16:17:31.394Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}
2022-12-18T16:17:31.394Z        ERROR   core    core/builder.go:158     constructing the node: route ip+net: netlinkrib: permission denied

Error: constructing the node (see log for full detail): route ip+net: netlinkrib: permission denied
2022-12-18T16:17:31.395Z        ERROR   basichost      basic/basic_host.go:334  failed to resolve local interface addresses     {"error": "route ip+net: netlinkrib: permission denied"}

It happens on this hardware:

u0_a267@localhost
-----------------
OS: Android 13 aarch64
Host: google Pixel 3
Kernel: 4.9.332-NekoMiya+
Uptime: 1 day, 12 hours
Packages: 146 (dpkg), 1 (pkg)
Shell: bash 5.2.15
CPU: Qualcomm SDM845 (8) @ 1.766GHz
Memory: 2624MiB / 3582MiB

Can you compile kubo with go 1.19.4? but it is show me that can not compile kubo with go 1.19 ,only compile with go 1.18
how do you compile kubo with go 1.19?
thanks

@NatoBoram
Copy link
Contributor Author

@yianding It's been a little while since I've setup Termux again, but it's essentially the same as on Windows/Linux/MacOS.

pkg install go git make openssh
git clone [email protected]:ipfs/kubo.git ipfs
cd ipfs
make install

@Khyta
Copy link

Khyta commented May 14, 2023

Edit: It seems that this is an Android issue. Quoting a Termux package maintainer:

Ways of retrieving network interface information through /proc/net netlink are closed and nothing can be done on Termux team side to fix this. I can only suggest using root and SELinux in permissive mode.

Note that issue affects not only ipfs but all other tools which retrieve networking interface information: ifconfig, ip, netstat and others. Packages that appears to be broken on new Android versions (10, 11, 12, 13+) will not be removed because there still many users who run them without problems.

Source: https://reddit.com/r/termux/comments/12v03bd/ipfs_daemon_crashing_on_android/

I managed to get it 'working' on Android 13 (Termux) by loosely following your steps:

pkg install golang
pkg install git
pkg install make
pkg install openssh
git clone https://github.com/ipfs/kubo.git
cd kubo
make install
export PATH=$PATH:/data/data/com.termux/files/home/kubo/cmd/ipfs:/data/data/com.termux/files/home/go/bin

And then running ipfs init and ipfs daemon.

I still get the same netlinkrib: permission denied but I decided to ignore the error and simply open the Web GUI on 127.0.0.1:5001/ipfs/blabla which surprisingly worked! I'm less sure about the ability to look up files as a CID I made on my Laptop around 24 hours ago gives a 404 on the Mobile client but is discoverable through ipfs.io and cloudflare-ipfs.

image

image

@wlynxg
Copy link

wlynxg commented Jul 1, 2023

I have found a solution to the issue of route ip+net: netlinkrib: permission denied that occurs with Go on Android 11. I provided an answer to this issue on the Go GitHub page: golang/go#40569 (comment).

Based on my investigation, I found that your issue is similar to the Go problem mentioned above, and I believe they can be resolved together. I have proposed a solution, which you can find here: https://github.com/wlynxg/anet.

Since I haven't reviewed the source code of "kubo," I am unable to submit a pull request (PR) myself. However, I hope someone else can take my solution and submit a PR to resolve the issue for everyone involved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) P4 Very low priority topic/linux Linux specific
Projects
None yet
Development

No branches or pull requests

7 participants