gomobile-ipfs icon indicating copy to clipboard operation
gomobile-ipfs copied to clipboard

route ip+net: netlinkrib: permission denied

Open liming1010 opened this issue 4 years ago • 10 comments

`compileSdkVersion 30 buildToolsVersion "30.0.3"

defaultConfig {
    applicationId "com.example.ipfs_andorid"
    minSdkVersion 28
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}`

basichost failed to resolve local interface addresses {"error": "route ip+net: netlinkrib: permission denied"}

liming1010 avatar May 12 '21 05:05 liming1010

Do not set targetSdkVersion to 30 and 31. 29 or less works fine. Not all devices have problems.

alx696 avatar Oct 19 '21 12:10 alx696

What can I do if another dependency requires SDK Version 31?

RangerMauve avatar Apr 05 '22 04:04 RangerMauve

Doing some more searching it sounds like you need to set up a WifiManager.MulticastLock lock before you set up the gomobile-ipfs code.

Gonna try this tomorrow to see if it fixes it and report back. Not sure how hard it'd be to add directly into gomobile-ipfs.

I think even if you aren't using SDK 31, you'll want to do this since a lot of phones will just drop the multicast frames otherwise.

https://developer.android.com/reference/android/net/wifi/WifiManager#createMulticastLock(java.lang.String)

RangerMauve avatar Apr 05 '22 04:04 RangerMauve

Adding the multicast lock did not help. 🙃

I think the remaining issue is that you can no longer enumerate the list of network interfaces. Not sure what to do as next steps to work around this.

RangerMauve avatar Apr 05 '22 17:04 RangerMauve

This is a bug in the Go runtime itself and the current recommendation is to work around it in application code. 🙃

https://github.com/golang/go/issues/40569#issuecomment-1050381441

RangerMauve avatar Apr 05 '22 17:04 RangerMauve

Fixed in https://github.com/golang/go/issues/40569#issuecomment-1190950966

flyskywhy avatar Jul 21 '22 02:07 flyskywhy

I've successfully compiled ipfs-update and ipfs Kubo from source (With Termux) for Android 13 Kernel 5.10.107-android13-4-ga753e5105cfd #1 Mon Oct 3 19:27:52 UTC 2022.

The issue is, running ipfs daemon it wants to do a migration for fs-repo. It fails and returns these errors which are fitting to this issue:

Failed to download migrations.
The migrations of fs-repo failed:
failed to download migrations: fs-repo-6-to-7 fs-repo-7-to-8 fs-repo-8-to-9 fs-repo-9-to-10 fs-repo-10-to-11 fs-repo-11-to-12

404 Not Found: ipfs resolve -r /ipfs/QmdaCHYBDHEhXCMoynH5UcohEay6m1XayZCcxWZzKAHNVN/fs-repo-8-to-9/v1.0.1/fs-repo-8-to-9_v1.0.1_android-arm64.tar.gz: no link named "fs-repo-8-to-9_v1.0.1_android-arm64.tar.gz" under QmdvqRKYxzkLDChkvYPDZpjtHZsDVmdAJvXweWYzgJcaMQ

* constructing the node (see log for full detail): route ip+net: netlinkrib: permission denied

Khyta avatar Oct 13 '22 20:10 Khyta

Hello @Khyta . This issue is about the error "route ip+net: netlinkrib: permission denied" which comes from running gomobile-ipfs . We will merge the solution soon, but it is only a solution for gomobile-ipfs. It looks like you are running kubo directly on your phone. Is that right?

jefft0 avatar Oct 14 '22 08:10 jefft0

Yes, I dowloaded golang for Termux and then also downloaded and installed IPFS with these steps: https://github.com/ipfs/kubo#install-go

The compiling worked flawlessly. Running ipfs also works as expected. It's just that running ipfs daemon returns this:

Initializing daemon...                                  
Kubo version: 0.17.0-dev-9e3745ebe                      
Repo version: 12                                        
System version: arm64/android                           
Golang version: go1.19.2                                
Found outdated fs-repo, migrations need to be run. Run migrations now? [y/N]

And when I say Y it inevitably returns the affromentioned error.

Khyta avatar Oct 14 '22 10:10 Khyta

@Khyta , you may have found this issue by searching for the error. We will fix the error in gomobile-ipfs, but it won't help you running ipfs daemon directly. I think you need to ask on the Kubo help forums.

jefft0 avatar Oct 14 '22 10:10 jefft0

The pull request was merged for Android 30 support. This should fix the problem in this issue.

jefft0 avatar Oct 20 '22 15:10 jefft0