Cannot get media server running in combination with external USB HD (using Samba)

Having issues with your DietPi installation or found a bug? Post it here.
Post Reply
rosinski
Posts: 3
Joined: Wed Jul 28, 2021 8:25 pm

Cannot get media server running in combination with external USB HD (using Samba)

Post by rosinski »

I'm in the process of switching functionality of two of my Raspberry Pi's (3 and 4), and got the Raspberry 3 running fine (used it for DietPi running a wireless access point).

However, I can't get my Raspberry Pi running DietPi with a media server using the music stored on my external USB HD (files stored in /Music folder on that drive). I use DietPi and am able to get Samba running on it, and accessible on the rest of my network. But I can't get media servers running. I've tried MiniDLNA, Airsonic, and Ampache, followed the DietPi instructions, and none of them work. Specifically, none of them are starting successfully primarily because they don't seem to find the files on the external HD. Previously I had this set up and working on my Raspberry Pi 3 using MiniDLNA and Samba, and have used this successfully for about 2 years. I wanted to "upgrade" to the Pi 4 to hopefully get better performance.

My initial thoughts is this is a permissions issue. I see that DietPi creates a sub-folder in the "/mnt" folder called "dietpi_userdata" and does a "chown" command for the folder, along with a "chmod 0775". I changed the Samba setup so that my user data (the "dietpi_userdata" folder) is located on the external hard drive, and I've moved the files from my "/Music" folder to that same folder underneath the "diepi_userdata" folder, but it still doesn't work (although I've only tried that with MiniDLNA, and not Airsonic or Ampache yet).

Has anyone else got MiniDLNA, Airsonic or Ampache working with music files located on an external HD, and if so, how? I've tried installing Samba at the same time as the media server, and also tried it by installing Samba first, moving my userdata to the external HD, and then the media server, but it's still not working.

Thanks in advance for help with this.

Rick
Last edited by rosinski on Thu Jul 29, 2021 4:28 am, edited 1 time in total.
User avatar
Joulinar
Posts: 5998
Joined: Sat Nov 16, 2019 12:49 am

Re: Cannot get media server running in combination with external USB HD (using Samba)

Post by Joulinar »

let's put samba aside for time being. As I understood, your external HDD already contain the media files. correct?

let's check your HDD and how it is mounted

Code: Select all

cat /etc/fstab
lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
rosinski
Posts: 3
Joined: Wed Jul 28, 2021 8:25 pm

Re: Cannot get media server running in combination with external USB HD (using Samba)

Post by rosinski »

This problem is now solved, and the media server (MiniDLNA) is now working.

Before I saw the response to my message, I performed both "chown dietpi:dietpi" and "chmod0775" commands on the "/Music" folder of my external HD (which is also the Samba share), and that worked!

This seems to be a "bug", or at least something that should be fixed, with DietPi. DietPi never executed these commands when the userdata was moved to the Samba share, so it seems like this should be an easy fix.

I may end up trying another media server anyhow (as noted above, I had tried Airsonic), and I'll report back the results.

Thanks,

Rick
User avatar
Joulinar
Posts: 5998
Joined: Sat Nov 16, 2019 12:49 am

Re: Cannot get media server running in combination with external USB HD (using Samba)

Post by Joulinar »

Probably there is a misunderstanding on your side. Coping files using cp will never adjust file permissions nor file ownership to a specific user. usually files are copied with permission as is and thinks like user permissions would need to be set individually. This has nothing to do with DietPi as it is Linux standard behaviour.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
rosinski
Posts: 3
Joined: Wed Jul 28, 2021 8:25 pm

Re: Cannot get media server running in combination with external USB HD (using Samba)

Post by rosinski »

I'm still confused.

The external HD is a 5TB drive formatted under Windows 10, and the files were already on the HD prior to hooking it up to the DietPi RPi4 box. Also, this same HD was used with my RPi3 box (running Raspberry Pi OS), also running MiniDLNA. I was "upgrading" by moving over to my RPi4 and using DietPi as the OS. I had the user "Pi" on the old RPi3 box, and assume all the permissions were set for that folder (/Music) with that user. Therefore, when I hooked this up to the DietPi / RPi4 box, which had the primary user of "DietPi", wouldn't the permissions need to be changed to "DietPi" for this folder? And if the "dietpi_userdata" folders were moved by DietPi from the SD Card to the external HD, shouldn't DietPi also change the permissions automatically on the moved dietpi_userdata folders?

Rick
User avatar
Joulinar
Posts: 5998
Joined: Sat Nov 16, 2019 12:49 am

Re: Cannot get media server running in combination with external USB HD (using Samba)

Post by Joulinar »

Hi,

files and folder permission are set for individual users and groups. Moving the disk to another system will preserve permission from the original system. Means they still pointing to the old pi user, which is not existing on DietPi. Therefore you would need to set permission correctly again yourself. But this has nothing to do with DietPi. It would be same on other Linux based system. Just connection a disk, will never adjust permissions on that disk.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 3357
Joined: Sat Nov 18, 2017 6:21 pm

Re: Cannot get media server running in combination with external USB HD (using Samba)

Post by MichaIng »

To be more precise: File and directory owners and groups are tied to user IDs and group IDs. When attaching a drive from one system to another, the same IDs may be attached to a different user name, or none at all, which may cause quite some issues or confusion ;). On DietPi, the dietpi user and group both have the ID 1000. AFAIK on Raspberry Pi OS, those two IDs are used for the user pi. So for those, if my assumptions are right, nothing needs to be changed. But in general, it makes sense to freshly chown the content of newly attached drives, at least everything that was not owned by root (which always has ID 0, both user and group).
Post Reply