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

Serve DLNA doesn't work on Android #7316

Open
dxzdxz1 opened this issue Sep 18, 2023 · 7 comments
Open

Serve DLNA doesn't work on Android #7316

dxzdxz1 opened this issue Sep 18, 2023 · 7 comments

Comments

@dxzdxz1
Copy link

dxzdxz1 commented Sep 18, 2023

What is the problem you are having with rclone?

rclone serve dlna doesn't work on Android.

What is your rclone version (output from rclone version)

rclone v1.64.0

Which OS you are using and how many bits (e.g. Windows 7, 64 bit)

  • os/version: Android 13 - stock/non-rooted | OneUI 5.1 (Samsung device)
  • os/kernel: 5.15.78-android13-8-27100863-abS918BXXU3AWGJ (aarch64)
  • os/arch: arm64 (ARMv8 compatible)
  • go/version: go1.21.0

Which cloud storage system are you using? (e.g. Google Drive)

OneDrive for Business

The command you were trying to run (e.g. rclone copy /tmp remote:tmp)

./rclone serve dlna sharepoint: --config=rclone.conf --cache-dir=cache --vfs-cache-mode writes -vv --log-file=log.txt

A log from the command with the -vv flag (e.g. output from rclone -vv copy /tmp remote:tmp)

2023/09/18 14:55:46 DEBUG : Creating backend with remote "obusiness:"
2023/09/18 14:55:46 DEBUG : Using config file from "/data/data/com.termux/files/home/downloads/rclone.conf"
2023/09/18 14:55:46 list network interfaces: route ip+net: netlinkrib: permission denied 
2023/09/18 14:55:46 DEBUG : OneDrive root '': Next delta token is: 
2023/09/18 14:55:46 DEBUG : vfs cache: root is "/data/data/com.termux/files/home/downloads/cache"
2023/09/18 14:55:46 DEBUG : vfs cache: data root is "/data/data/com.termux/files/home/downloads/cache/vfs/obusiness"
2023/09/18 14:55:46 DEBUG : vfs cache: metadata root is "/data/data/com.termux/files/home/downloads/cache/vfsMeta/obusiness"
2023/09/18 14:55:46 DEBUG : Creating backend with remote "/data/data/com.termux/files/home/downloads/cache/vfs/obusiness/"
2023/09/18 14:55:46 DEBUG : fs cache: renaming cache item "/data/data/com.termux/files/home/downloads/cache/vfs/obusiness/" to be canonical "/data/data/com.termux/files/home/downloads/cache/vfs/obusiness"
2023/09/18 14:55:46 DEBUG : Creating backend with remote "/data/data/com.termux/files/home/downloads/cache/vfsMeta/obusiness/"
2023/09/18 14:55:46 DEBUG : fs cache: renaming cache item "/data/data/com.termux/files/home/downloads/cache/vfsMeta/obusiness/" to be canonical "/data/data/com.termux/files/home/downloads/cache/vfsMeta/obusiness"
2023/09/18 14:55:46 INFO  : vfs cache: cleaned: objects 0 (was 0) in use 0, to upload 0, uploading 0, total size 0 (was 0)
2023/09/18 14:55:46 NOTICE: OneDrive root '': Serving HTTP on 0.0.0.0:7879
2023/09/18 14:56:46 DEBUG : OneDrive root '': Checking for changes on remote
2023/09/18 14:56:46 INFO  : vfs cache: cleaned: objects 0 (was 0) in use 0, to upload 0, uploading 0, total size 0 (was 0)

If I try to use serve dlna on my Android phone, rclone starts the service, but it doesn't go anywhere.
Probably has something to do with the error list network interfaces: route ip+net: netlinkrib: permission denied
Searching for this error on Google, it seems to be related to golang/gomobile actually, but I'm not sure, and I don't even know if rclone works on Android without root, so there's also that.

I'm running termux (f-droid build) updated && upgraded + latest rclone from the Android testbuilds page.
Please let me know if you want me to run any tests on my device.
Thanks in advance!



How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.
@ncw
Copy link
Member

ncw commented Sep 18, 2023

I think you should be able to set the interface manually with this

  --interface stringArray                  The interface to use for SSDP (repeat as necessary)

I don't know what the interface should be but ifconfig in the terminal should give you a clue.

Did you use the version of rclone that termux build or the one from rclone's downloads? If you haven't tried the termux one, then give that a go.

@dxzdxz1
Copy link
Author

dxzdxz1 commented Sep 18, 2023

Did you use the version of rclone that termux build or the one from rclone's downloads? If you haven't tried the termux one, then give that a go.

I'm using the version from rclone Android testbuilds link. Before the official release of 1.64.0 I also build from source using termux on my phone and I was getting the same error, but I don't know if I was doing something wrong, so I waited for the official release of 1.64.0 to test

the ifconfig command outputs the following message:

~/downloads $ ifconfig
Warning: cannot open /proc/net/dev (Permission denied). Limited output.
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
inet 127.0.0.1  netmask 255.0.0.0
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
inet 192.168.15.4  netmask 255.255.255.0  broadcast 192.168.15.255
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 3000  (UNSPEC)

So I tried to run rclone with this command:

./rclone serve dlna obusiness: --config=rclone.conf --cache-dir=cache --vfs-cache-mode writes --interface wlan0 -vv

and I got this:

2023/09/18 20:13:22 DEBUG : Creating backend with remote "obusiness:"
2023/09/18 20:13:22 DEBUG : Using config file from "/data/data/com.termux/files/home/downloads/rclone.conf"
2023/09/18 20:13:22 DEBUG : 7 go routines active
2023/09/18 20:13:22 Failed to dlna: failed to resolve interface name 'wlan0': route ip+net: netlinkrib: permission denied

the same message appears if I try to use --interface with lo

@romanovj
Copy link

romanovj commented Sep 18, 2023

patches golang/go#61089

you can patch go files in /data/data/com.termux/files/usr/lib/go

I replaced "io/fs" with "internal/oserror"
and fs.ErrPermission with oserror.ErrPermission
for src/syscall/netlink_linux.go patches

termux rclone

~/rclone $ rclone serve dlna $HOME --interface wlan0
2023/09/18 22:49:14 NOTICE: Config file "/data/data/com.termux/files/home/.config/rclone/rclone.conf" not found - using defaults
2023/09/18 22:49:14 Failed to dlna: failed to resolve interface name 'wlan0': route ip+net: netlinkrib: permission denied

my own compiled after patching go files

~/rclone $ ./rclone serve dlna $HOME --interface wlan0
2023/09/18 22:49:20 NOTICE: Config file "/data/data/com.termux/files/home/.config/rclone/rclone.conf" not found - using defaults
2023/09/18 22:49:20 NOTICE: DLNA server on :7879: Started SSDP on wlan0
2023/09/18 22:49:20 NOTICE: Local file system at /data/data/com.termux/files/home: Serving HTTP on 0.0.0.0:7879

neutron player can access this dlna server

@ncw
Copy link
Member

ncw commented Sep 19, 2023

Great work patching Go to make this work.

Probably what you should do is comment on the Gerrit CL and/or on the GitHub PR that you've tried the patch and it resolves this issue (with a link to this issue) and we can hope that it gets some traction with the Go developers.

@dxzdxz1
Copy link
Author

dxzdxz1 commented Sep 19, 2023

patches golang/go#61089

you can patch go files in /data/data/com.termux/files/usr/lib/go

I replaced "io/fs" with "internal/oserror" and fs.ErrPermission with oserror.ErrPermission for src/syscall/netlink_linux.go patches

It worked! Thanks a lot!

@aicynide
Copy link

aicynide commented Sep 22, 2023

@romanovj neutron player?

@dosy4ev
Copy link

dosy4ev commented May 26, 2024

Upstream solution for this is a fork of net module. https://github.com/wlynxg/anet
I think idea behind it is a conditional dependency for android builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants