Today I updated my cubox - and minidlna was included in the updates to 1.1.5-2 with a warning that the service now starts with user/group minidlna:minidlna - however on reboot the service fails. I was previously running perfectly successfully with user mike.
I have made the necessary changes to the ownsership of the relevant directories and files:
$this->bbcode_second_pass_code('', '
[root@cubox1 ~]# ls -ld /var/cache/minidlna/
drwxr-xr-x 2 minidlna minidlna 4096 Feb 29 19:40 /var/cache/minidlna/
[root@cubox1 ~]# ls -ld /var/run/minidlna/
drwxr-xr-x 2 minidlna minidlna 60 Feb 29 20:28 /var/run/minidlna/
[root@cubox1 ~]# cat /etc/systemd/system/minidlna.service
[Unit]
Description=minidlna server
After=network.target
[Service]
Type=simple
User=minidlna
Group=minidlna
ExecStart=/usr/bin/minidlnad -S
ProtectSystem=full
ProtectHome=read-only
PrivateDevices=on
NoNewPrivileges=on
[Install]
WantedBy=multi-user.target
')
and in /etc/minidlna.conf there is no user specified so it runs as default minidlna:
$this->bbcode_second_pass_code('', '
# specify the user account name or uid to run as
#user=jmaggard
#user=nobody
#user=minidlna
#user=mike
# set this to the directory you want scanned.
# * if you want multiple directories, you can have multiple media_dir= lines
# * if you want to restrict a media_dir to specific content types, you
# can prepend the types, followed by a comma, to the directory:
# + "A" for audio (eg. media_dir=A,/home/jmaggard/Music)
# + "V" for video (eg. media_dir=V,/home/jmaggard/Videos)
# + "P" for images (eg. media_dir=P,/home/jmaggard/Pictures)
# + "PV" for pictures and video (eg. media_dir=PV,/home/jmaggard/digital_camera)
#media_dir=/opt
media_dir=A,/home/mike/Music/
media_dir=P,/home/mike/Pictures/
media_dir=V,/home/mike/Videos/
')
Yet when restarting the service, and at boot I see:
$this->bbcode_second_pass_code('', '
[root@cubox1 ~]# systemctl --no-pager -l status minidlna
* minidlna.service - minidlna server
Loaded: loaded (/etc/systemd/system/minidlna.service; disabled; vendor preset: disabled)
Active: active (running) since Mon 2016-02-29 20:28:27 GMT; 27min ago
Main PID: 623 (minidlnad)
CGroup: /system.slice/minidlna.service
`-623 /usr/bin/minidlnad -S
Feb 29 20:28:27 cubox1 systemd[1]: Started minidlna server.
Feb 29 20:28:28 cubox1 minidlnad[623]: [2016/02/29 20:28:28] minidlna.c:614: error: Media directory "A,/home/mike/Music/" not accessible [Permission denied]
Feb 29 20:28:28 cubox1 minidlnad[623]: [2016/02/29 20:28:28] minidlna.c:614: error: Media directory "P,/home/mike/Pictures/" not accessible [Permission denied]
Feb 29 20:28:28 cubox1 minidlnad[623]: [2016/02/29 20:28:28] minidlna.c:614: error: Media directory "V,/home/mike/Videos/" not accessible [Permission denied]
Feb 29 20:28:28 cubox1 minidlnad[623]: minidlna.c:1030: warn: Starting MiniDLNA version 1.1.5.
Feb 29 20:28:28 cubox1 minidlnad[623]: minidlna.c:1070: warn: HTTP listening on port 8200
')
yet the media directories should be readable by all:
$this->bbcode_second_pass_code('', '
[root@cubox1 ~]# ls -l /home/mike/
total 16
drwxrwxrwx 8 mike mike 4096 Dec 26 16:33 Music
drwxrwxrwx 3 mike mike 4096 Oct 3 2001 Pictures
drwxrwxrwx 14 mike mike 4096 Nov 4 19:36 Videos
drwxr-xr-x 2 mike mike 4096 Sep 21 21:03 minidlna
')
Until today I was running as user mike, and not as user minidlna - with the user specified in /etc/minidlna.conf as well as the user and group set to mike in the minidlna systemd service file - along with ProtectHome set to read-only - and that worked.
Strangely if I set the user back to mike, and alter the directory ownership of the /var/cache/minidlna and /var/run/minidlna directories then restart the minidlna service it starts fine without errors - but if I reboot the machine then I get minidlna failing to start!
Can anyone advise on how to resolve this?
/code]