Error using rclone serve dlna on Termux

First of all, since this is my first post here, thanks a lot for your work, I discovered rclone only some days ago and I don't know how I could have lived without it until now.

Getting to the problem, I am trying to launch a DLNA server from termux with:
rclone serve dlna myremote:

But I get this error:
2019/07/31 20:08:39 error writing to UDP socket: write udp> sendto: operation not permitted

After the command, I can see the DLNA server with the folders, but they are empty.

If I use the same command from my PC with the same rclone.conf and the same version (1.48.0), it works perfectly.

Do you know why this happens or have any suggestions? Thanks :slight_smile:

What OS are you running it on?

I get the error on Android 9 (with Termux), while I have no problems on Fedora.

Assuming you don't have the right privileges to open the ports it is asking for based on that error. I don't personally have or use any android though unfortunately.

Are you able to run the commands with elevated privs or something along those lines?

No, I don't have root permissions on Android unfortunately, but on Fedora it does not ask for superuser

This looks like an android permissions error of some kind.

You don't normally need root for this, but Android has an enhanced security model.

It might be worth asking in the termux community about this.

How did you install rclone on termux? If you installed it from the termux package it might be worth raising an issue here:

Yes, I installed it from the termux package, I filed an issue and I'll report back the answers, thanks :slightly_smiling_face:

1 Like

Update: Termux devs have not answered yet, but in the meantime I discovered that the DLNA server folders are empty because only image files are listed (.jpg and .png). This is strange since, as the rclone manual says, "Rclone will list all files present in the remote, without filtering based on media formats or file extensions".

Moreover, I compiled the rclone package from the official repo in Termux, and it has the same problem.

How did you discover that only the image files were shown?

I opened some music album folders with cover images in them and the audio files, like the video ones, were not listed, but the image ones yes.

So the dlna client didn't see them for some reason? I'm wondering whether the server served them though?

I just tried renaming a .mkv file to .jpg to see if I could see it, and I got an even stranger result, that is that now I see the file, but as if it was an empty folder :thinking:

Edit: No, for some reason renaming a file creates a folder with the same name of the file, with the file inside it, that the DLNA server does not list (but the file maintains the same extension as before the renaming) (Is this something related to the fact that it is a crypted remote?). I'll try uploading an extension changed video to see if it is served this way.

I uploaded the same file as .mp4, .doc, .rar and .jpg, and the .jpg one is the only listed.

Rclone definitely serves all the files, but your client isn't understanding what rclone sends for some reason...

This looks like the same problem as:

Maybe you could join in that issue and give details of your setup?

I don't think it's the same issue, I too have the same problem with my Samsung TV (that says that "the content cannot be displayed", and it does not show anything, indifferently if I start the DLNA server from PC or Android), but in that issue VLC on PC and Android DLNA client apps see the contents without problems (like they do for me too when I start the DLNA server from my PC), while in my case every client I use (VLC on Fedora and VLC, LocalCast and BubbleUPnP on Android) only sees images if I start the server from Termux on Android.

It's not a termux issue. Happens with any app that can run it. I think with dlna you can disable udp (or multicast I can't remember which) packets but I don't think this is available on rclone.

So are you saying that if you run rclone serve dlna on your PC it works fine, just not under Termux? That is puzzling!

Exactly, sorry if it wasn't clear in the first post.

Hmm, I wonder if this problem is caused entirely by the UDP broadcasts not getting through? I know very little about dlna though.

Maybe you could set your firewall on the PC to block the UDP packets and see if you get a similar result?

Blocking the UDP packets changed nothing on my PC.