View previous topic :: View next topic |
Author |
Message |
pimiento n00b
Joined: 09 Dec 2017 Posts: 22
|
Posted: Fri Aug 30, 2024 6:47 pm Post subject: MiniDLNA starts manually but not using init script [SOLVED] |
|
|
When I do
Code: |
/usr/sbin/minidlnad -f /etc/minidlna.conf -u 1001 -g 1001
|
it works (I see the scanning process at /var/log/minidlna/minidlna.log).
But when I run init-script I get the error
Code: |
# /etc/init.d/minidlna restart
minidlna | * Caching service dependencies ... [ ok ]
minidlna |minidlna | * Executing: /lib/rc/sh/openrc-run.sh /lib/rc/sh/openrc-run.sh /etc/init.d/minidlna stop
minidlna | * Stopping MiniDLNA ...
minidlna | * start-stop-daemon: fopen `/run/minidlna/minidlna.pid': No such file or directory
minidlna | * Will stop /usr/sbin/minidlnad
minidlna | * Will stop processes of `/usr/sbin/minidlnad'
minidlna | * start-stop-daemon: no matching processes found [ ok ]
minidlna |minidlna | * Executing: /lib/rc/sh/openrc-run.sh /lib/rc/sh/openrc-run.sh /etc/init.d/minidlna start
minidlna | * Starting MiniDLNA ...
minidlna | * start-stop-daemon: fopen `/run/minidlna/minidlna.pid': No such file or directory
minidlna | * Detaching to start `/usr/sbin/minidlnad' ...
# /etc/init.d/minidlna status
* Executing: /lib/rc/sh/openrc-run.sh /lib/rc/sh/openrc-run.sh /etc/init.d/minidlna status
* status: crashed
|
It looks like the problem not in my config but in init-script. Here is my /etc/conf.d/minidlna
Code: |
# cat /etc/conf.d/minidlna |egrep -v '^#|^$'
RESCAN="false"
M_USER="torrent"
M_GROUP="torrent"
|
Code: |
# id torrent
uid=1001(torrent) gid=1001(torrent) groups=1001(torrent),339(minidlna)
|
Help me please. My daughter wants to watch cartoons but it doesn't work :(
UPD.1 I re-emerged net-misc/minidlna and reseted configs but it has the same problem even with default configs.
UPD.2 I've added flag to command arguments and Code: | /etc/init.d/minidlna start | now shows it updates the database. Looks like without -d flag it doesn't set pid-file while synchronisation is going
Last edited by pimiento on Sun Sep 01, 2024 4:45 am; edited 1 time in total |
|
Back to top |
|
|
grknight Retired Dev
Joined: 20 Feb 2015 Posts: 1918
|
Posted: Fri Aug 30, 2024 7:12 pm Post subject: |
|
|
pimiento wrote: | Code: |
# cat /etc/conf.d/minidlna |egrep -v '^#|^$'
RESCAN="false"
M_USER="torrent"
M_GROUP="torrent"
|
|
Because you changed M_USER and M_GROUP, you would also need to change the settings of /run/minidlna/ on each boot, otherwise it cannot create the pidfile there.
The easiest way to accomplish this is to copy /usr/lib/tmpfiles.d/minidlna.conf to /etc/tmpfiles.d/minidlna.conf and change the latter.
Remove that --debug (-d) flag which forces into foreground
I also do not recommend rc_verbose for OpenRC's rc.conf as it only confuses users more than it helps in many cases.
If more debug is necessary, as the user "torrent" (not root!), run /usr/sbin/minidlnad -P /run/minidlna/minidlna.pid -f /etc/minidlna.conf as that is what the script does (or complains about). It will not use the -u or -g options of minidlnad. |
|
Back to top |
|
|
pimiento n00b
Joined: 09 Dec 2017 Posts: 22
|
Posted: Sat Aug 31, 2024 1:42 am Post subject: |
|
|
May I do something wrong? Looks like everything should be ok but it isn't
Code: |
# /etc/init.d/minidlna restart
minidlna |minidlna | * Executing: /lib/rc/sh/openrc-run.sh /lib/rc/sh/openrc-run.sh /etc/init.d/minidlna start
minidlna | * Starting MiniDLNA ...
minidlna | * start-stop-daemon: fopen `/run/minidlna/minidlna.pid': No such file or directory
minidlna | * Detaching to start `/usr/sbin/minidlnad' ... [ ok ]
# /etc/init.d/minidlna status
* Executing: /lib/rc/sh/openrc-run.sh /lib/rc/sh/openrc-run.sh /etc/init.d/minidlna status
* status: crashed
# ls -ld /run/minidlna/
drwxr-x--- 2 torrent torrent 40 Aug 31 06:39 /run/minidlna/
# ls -l /run/minidlna/
total 0
# cat /etc/tmpfiles.d/minidlna.conf
d /run/minidlna 0755 torrent torrent -
|
|
|
Back to top |
|
|
dmpogo Advocate
Joined: 02 Sep 2004 Posts: 3425 Location: Canada
|
Posted: Sat Aug 31, 2024 5:48 am Post subject: |
|
|
You always show restart version, where already stop fails because there is no .pid files
Can you show clean start.
First run
/etc/init.d/minidlna stop
it will probably fail then run
rc-service minidlna zap
that should clear out all remnants of crashed service. Then try a clean start
/etc/init.d/minidlna start
and tell us what does it say, or puts in a log |
|
Back to top |
|
|
pimiento n00b
Joined: 09 Dec 2017 Posts: 22
|
|
Back to top |
|
|
grknight Retired Dev
Joined: 20 Feb 2015 Posts: 1918
|
Posted: Sat Aug 31, 2024 1:18 pm Post subject: |
|
|
What does namei -l /var/log/minidlna/minidlna.log say? |
|
Back to top |
|
|
pimiento n00b
Joined: 09 Dec 2017 Posts: 22
|
Posted: Sat Aug 31, 2024 1:29 pm Post subject: |
|
|
grknight wrote: | What does namei -l /var/log/minidlna/minidlna.log say? |
Code: |
# namei -l /var/log/minidlna/minidlna.log
f: /var/log/minidlna/minidlna.log
drwxr-xr-x root root /
drwxr-xr-x root root var
drwxr-xr-x root root log
drwxr-x--- minidlna minidlna minidlna
-rw-r--r-- root root minidlna.log
|
|
|
Back to top |
|
|
grknight Retired Dev
Joined: 20 Feb 2015 Posts: 1918
|
Posted: Sat Aug 31, 2024 1:44 pm Post subject: |
|
|
pimiento wrote: | grknight wrote: | What does namei -l /var/log/minidlna/minidlna.log say? |
Code: |
# namei -l /var/log/minidlna/minidlna.log
f: /var/log/minidlna/minidlna.log
drwxr-xr-x root root /
drwxr-xr-x root root var
drwxr-xr-x root root log
drwxr-x--- minidlna minidlna minidlna
-rw-r--r-- root root minidlna.log
|
|
So this is probably the main issue. The service cannot write to the log as the user torrent. Please change the owner and retry. |
|
Back to top |
|
|
dmpogo Advocate
Joined: 02 Sep 2004 Posts: 3425 Location: Canada
|
Posted: Sat Aug 31, 2024 3:42 pm Post subject: |
|
|
What we learned is that minidlna did not crash (as in having bug), it received SIGTERM signal, i.e. was asked tp stop by the system, probably for doing something illegal, as writing where it does not have permissions to
Can you manually change
chmod 777 /var/log/minidlna
to see if that is the log dir permission issue ? Or try to run minidlna with minidlna user |
|
Back to top |
|
|
pimiento n00b
Joined: 09 Dec 2017 Posts: 22
|
Posted: Sat Aug 31, 2024 7:19 pm Post subject: |
|
|
dmpogo wrote: |
What we learned is that minidlna did not crash (as in having bug), it received SIGTERM signal, i.e. was asked tp stop by the system, probably for doing something illegal, as writing where it does not have permissions to
Can you manually change
chmod 777 /var/log/minidlna
to see if that is the log dir permission issue ? Or try to run minidlna with minidlna user |
Nothing helps. By the way there are no log entries about signal 15 when I'm restarting (or stop, zap, start) minidlna. Now it is just crashed without any additional info. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22649
|
Posted: Sat Aug 31, 2024 8:32 pm Post subject: |
|
|
Linux will not generate SIGTERM due to permissions problems. Based on the timestamp, it looks like the SIGTERM came long after the startup.
grknight told you to fix the permissions. Did you try that? What is the output of namei -l /var/log/minidlna/minidlna.log now, after you fixed those permissions? |
|
Back to top |
|
|
pimiento n00b
Joined: 09 Dec 2017 Posts: 22
|
Posted: Sun Sep 01, 2024 4:45 am Post subject: |
|
|
dmpogo wrote: |
What we learned is that minidlna did not crash (as in having bug), it received SIGTERM signal, i.e. was asked tp stop by the system, probably for doing something illegal, as writing where it does not have permissions to
Can you manually change
chmod 777 /var/log/minidlna
to see if that is the log dir permission issue ? Or try to run minidlna with minidlna user |
Ok. I got it! The problim is with /var/log/minidlna/minidlna.log itself. I removed it and then it was re-created with proper owner torrent:torrent. Now everything works. Thank you a lot for your help. Wish you all the best in your life) |
|
Back to top |
|
|
|