The officially official Devuan Forum!

You are not logged in.

#1 2026-01-04 06:23:51

maran
Member
Registered: 2025-11-13
Posts: 1  

Bug in MiniDLNA init script: missing chown for db_dir

Hi,

I've encountered an issue with the minidlna (ReadyMedia) init script on Devuan (SysVinit). The service fails to rebuild the database when the -R or -r flag is used, resulting in the following error:

minidlna.c:944: fatal: Failed to clean old file cache /var/cache/minidlna. EXITING

The Cause: The /etc/init.d/minidlna script correctly handles permissions for the LOGFILE and PIDFILE directories in the do_start() function, but it fails to do the same for the db_dir (default: /var/cache/minidlna). If the directory is owned by root (which happens during some installation scenarios or manual cleanups), the minidlna user cannot delete the old files.db.

Proposed Fix: In /etc/init.d/minidlna, within the do_start() function, we should ensure the database directory exists and has the correct ownership.

Currently, it only does:

mkdir -p "$(dirname "$LOGFILE")" && chown $USER:$GROUP "$(dirname "$LOGFILE")" || return 2
mkdir -p "$(dirname "$PIDFILE")" && chown $USER:$GROUP "$(dirname "$PIDFILE")" || return 2

It should also include something like:

mkdir -p /var/cache/minidlna && chown -R $USER:$GROUP /var/cache/minidlna || return 2

(Note: A more robust approach would be to parse db_dir from /etc/minidlna.conf, but ensuring the default path at least would solve most cases.)

Without this, any attempt to refresh the library after deleting files (which requires rebuilding the cache) fails silently or crashes the daemon.

Best regards,

Last edited by maran (2026-01-04 06:25:07)

Offline

Board footer