Minidlna cannot access media directory

After installing the minidlna and configuring the firewall, the minidlna appears as a source on the TV but with no media to stream.

with user=minidlna (default at package installation) in:
/etc/minidlna.conf
/usr/lib/systemd/system/minidlna.service

I extracted the following from systemd:

minidlna.service - MiniDLNA is a DLNA/UPnP-AV server software
     Loaded: loaded (/usr/lib/systemd/system/minidlna.service; enabled; vendor preset: disabled)
     Active: active (running) since Sun 2023-06-18 20:40:24 BST; 3min 42s ago
   Main PID: 1482 (minidlnad)
      Tasks: 2 (limit: 4915)
     CGroup: /system.slice/minidlna.service
             └─ 1482 /usr/sbin/minidlnad -S

Jun 18 20:40:24 gogglebox.mere systemd[1]: Started MiniDLNA is a DLNA/UPnP-AV server software.
Jun 18 20:40:24 gogglebox.mere minidlnad[1482]: [2023/06/18 20:40:24] minidlna.c:670: error: Media directory "A,/home/ajw/Music" not accessible [Permission denied]
Jun 18 20:40:24 gogglebox.mere minidlnad[1482]: [2023/06/18 20:40:24] minidlna.c:670: error: Media directory "V,/home/ajw/Videos" not accessible [Permission denied]
Jun 18 20:40:24 gogglebox.mere minidlnad[1482]: minidlna.c:1134: warn: Starting MiniDLNA version 1.3.1.
Jun 18 20:40:24 gogglebox.mere minidlnad[1482]: minidlna.c:1182: warn: HTTP listening on port 8200
Jun 18 20:40:24 gogglebox.mere minidlnad[1482]: getifaddr.c:343: info: Enabling interface 192.168.1.73/255.255.255.0

i.e. indicating /home/ajw/Music and /home/ajw/Videos not accessible.

with user=root in:
/etc/minidlna.conf
/usr/lib/systemd/system/minidlna.service

I extracted the following from systemd:

minidlna.service - MiniDLNA is a DLNA/UPnP-AV server software
     Loaded: loaded (/usr/lib/systemd/system/minidlna.service; enabled; vendor preset: disabled)
     Active: active (running) since Mon 2023-06-19 13:28:35 BST; 4min 25s ago
   Main PID: 1491 (minidlnad)
      Tasks: 2 (limit: 4915)
     CGroup: /system.slice/minidlna.service
             └─ 1491 /usr/sbin/minidlnad -S

Jun 19 13:28:35 gogglebox.mere systemd[1]: Started MiniDLNA is a DLNA/UPnP-AV server software.
Jun 19 13:28:35 gogglebox.mere minidlnad[1491]: [2023/06/19 13:28:35] minidlna.c:670: error: Media directory "A,/home/ajw/Music" not accessible [No such file or directory]
Jun 19 13:28:35 gogglebox.mere minidlnad[1491]: [2023/06/19 13:28:35] minidlna.c:670: error: Media directory "V,/home/ajw/Videos" not accessible [No such file or directory]
Jun 19 13:28:35 gogglebox.mere minidlnad[1491]: minidlna.c:1134: warn: Starting MiniDLNA version 1.3.1.
Jun 19 13:28:35 gogglebox.mere minidlnad[1491]: minidlna.c:1182: warn: HTTP listening on port 8200
Jun 19 13:28:35 gogglebox.mere minidlnad[1491]: getifaddr.c:343: info: Enabling interface 192.168.1.73/255.255.255.0

i.e. indicating /home/ajw/Music and /home/ajw/Videos do not exist; but the media folders do exist and are correctly entered into minidlna.conf; what can be preventing minidlna from seeing these media directories?

Thanks in advance.

The directorys need to be owned by the dedicated user “minidnla” and not by your normal user…so use “chown” to apply the correct ownership and permissions…

You did not describe how you installed it. If it was openSUSE package, then minidlna.service has

ProtectHome=true

and if you read man systemd.exec you will see

                                                                                  If true,
           the directories /home/, /root, and /run/user are made inaccessible and empty for
           processes invoked by this unit.

Nope!

3400g:~ # grep media_dir /etc/minidlna.conf|grep -v ^\#
media_dir=/home/Albums
3400g:~ # ll -d /home/Albums/
drwxr-xr-x 1 karl users 396 Apr 18  2022 /home/Albums/
3400g:~ # 

Administrators need to change service minidlna as follows (note the drop-in at /etc/systemd/system/minidlna.service.d/override.conf):

3400g:~ # systemctl cat minidlna.service 
# /usr/lib/systemd/system/minidlna.service
[Unit]
Description=MiniDLNA is a DLNA/UPnP-AV server software
After=network-online.target syslog.target local-fs.target
Wants=network-online.target

[Service]
# added automatically, for details please see
# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
ProtectSystem=full
ProtectHome=true
PrivateDevices=true
ProtectHostname=true
ProtectClock=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectControlGroups=true
RestrictRealtime=true
# end of automatic additions 
User=minidlna
Group=minidlna
PIDFile=/run/minidlna/minidlna.pid
Type=simple
ExecStart=/usr/sbin/minidlnad -S
ExecReload=/usr/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

# /etc/systemd/system/minidlna.service.d/override.conf
[Service]
ProtectHome=read-only
3400g:~ # 
1 Like

The problem was a ProtectHome=true setting in “/usr/lib/systemd/system/minidlna.service”; I set this false and access to the media folders under /home was enabled.