GNU bug report logs - #77023
[PATCH 0/3] home: services: Add readymedia.

Previous Next

Package: guix-patches;

Reported by: Sughosha <sughosha <at> disroot.org>

Date: Sat, 15 Mar 2025 02:03:01 UTC

Severity: normal

Tags: moreinfo, patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Tanguy Le Carrour <tanguy <at> bioneland.org>, Gabriel Wicki <gabriel <at> erlikon.ch>, Sughosha <sughosha <at> disroot.org>, Andrew Tropin <andrew <at> trop.in>, Hilton Chain <hako <at> ultrarare.space>, 77023-done <at> debbugs.gnu.org, Janneke Nieuwenhuizen <janneke <at> gnu.org>
Subject: [bug#77023] [PATCH v5] home: services: Add readymedia.
Date: Mon, 19 May 2025 09:18:27 +0900
Hi Ludovic,

Ludovic Courtès <ludo <at> gnu.org> writes:

> Hi Sughosha,
>
> Sughosha <sughosha <at> disroot.org> writes:
>
>> * gnu/home/services/upnp.scm: New file.
>> * gnu/local.mk: Register it.
>> * gnu/services/upnp.scm: Export readymedia-activation and
>> readymedia-shepherd-service.
>> (<readymedia-configuration>)[home-service?]: New field.
>> [cache-directory]: Adjust value depending on 'for-home?'.
>> [log-directory]: Ditto.
>> (readymedia-shepherd-service): Adjust 'requirement' and 'start' according to
>> 'home-service?'.
>> (readymedia-activation): Adjust creating 'media-directories' with permissions
>> according to 'home-service?'.
>> * gnu/tests/upnp.scm (%readymedia-configuration-test): Configure port with
>> %readymedia-default-port.
>> * doc/guix.texi (Miscellaneous Home Services): Document Readymedia Service.
>> (Miscellaneous Services): Add cross-reference.
>>
>> Change-Id: I5c48595d84a815d98e03c7f68a716f048903720c
>
> Finally applied, thanks!
>
> The system test passes, but it fails once every two runs or so.  Could
> you take look?
>
> However, I do not see the ‘unshare’ issue that Maxim was reporting: I
> double-checked by running the test VM manually, and here’s what I could
> see:
>
> root <at> komputilo ~# herd status readymedia
> herd status readymedia
> ● Status of readymedia:
>   It is running since 10:12:32 PM (15 seconds ago).
>   Main PID: 145
>   Command: /gnu/store/39m4bp93cc65h8i60if803hcfjw5jzyj-minidlna -f /gnu/store/x8vqpc3yqbblm7wbmg0798vvl0mj2rn6-minidlna.conf -S
>   It is enabled.
>   Provides: readymedia
>   Requires: networking user-processes
>   Will be respawned.
>   Log file: /var/log/readymedia/minidlna.log
>
> Recent messages (use '-n' to view more or less):
>   2025-05-18 22:12:33 scanner.c:731: warn: Scanning /media
>   2025-05-18 22:12:33 scanner.c:820: warn: Scanning /media finished (0 files)!
>   2025-05-18 22:12:33 playlist.c:135: warn: Parsing playlists...
>   2025-05-18 22:12:33 playlist.c:269: warn: Finished parsing playlists.
>   2025-05-18 22:12:33 monitor_inotify.c:223: warn: WARNING: Inotify max_user_watches [8192] is low or close to the number of used watches [2] and I do not have permission to increase this limit.  Please do so manually by writing a higher value into /proc/sys/fs/inotify/max_user_watches.
> root <at> komputilo ~# cat /var/log/readymedia/minidlna.log
> cat /var/log/readymedia/minidlna.log
> 2025-05-18 22:12:33 utils.c:295: warn: make_dir: cannot create directory '/var/run/'
> 2025-05-18 22:12:33 minidlna.c:466: error: Unable to create pidfile directory: /var/run/minidlna/minidlna.pid
> 2025-05-18 22:12:33 minidlna.c:520: warn: Unset locale
> 2025-05-18 22:12:33 minidlna.c:1134: warn: Starting MiniDLNA version 1.3.3.
> 2025-05-18 22:12:33 minidlna.c:394: warn: Creating new database at /var/cache/readymedia/files.db
> 2025-05-18 22:12:33 minidlna.c:1182: warn: HTTP listening on port 8200
> 2025-05-18 22:12:33 scanner.c:731: warn: Scanning /media
> 2025-05-18 22:12:33 scanner.c:820: warn: Scanning /media finished (0 files)!
> 2025-05-18 22:12:33 playlist.c:135: warn: Parsing playlists...
> 2025-05-18 22:12:33 playlist.c:269: warn: Finished parsing playlists.
> 2025-05-18 22:12:33 monitor_inotify.c:223: warn: WARNING: Inotify max_user_watches [8192] is low or close to the number of used watches [2] and I do not have permission to increase this limit.  Please do so manually by writing a higher value into /proc/sys/fs/inotify/max_user_watches.

I had applied the diff below to fix it, maybe only is the unshare error
exposed?

--8<---------------cut here---------------start------------->8---
services: Fix readymedia service.

The containerized process didn't have access to the run and db directories.

* gnu/services/upnp.scm (%readymedia-run-directory)
(%readymedia-db-directory): New variables.
(readymedia-shepherd-service) <least-authority-wrapper>: Map directories.
(readymedia-activation): Create directories in activation script.

Change-Id: I76547eb483ee65472ab0e6ec7164bf7e40fd745b

1 file changed, 15 insertions(+), 1 deletion(-)
gnu/services/upnp.scm | 16 +++++++++++++++-

modified   gnu/services/upnp.scm
@@ -122,6 +122,10 @@ (define (readymedia-configuration->config-file config)
                            (string-append key "=" value "\n")))
                         extra-config)))))
 
+(define %readymedia-run-directory "/var/run/minidlna")
+
+(define %readymedia-db-directory "/var/db/minidlna")
+
 (define (readymedia-shepherd-service config)
   "Return a least-authority ReadyMedia/MiniDLNA Shepherd service."
   (match-record config <readymedia-configuration>
@@ -149,6 +153,14 @@ (define (readymedia-shepherd-service config)
                            (file-system-mapping
                             (source minidlna-conf)
                             (target source))
+                           (file-system-mapping
+                            (source %readymedia-db-directory)
+                            (target source)
+                            (writable? #t))
+                           (file-system-mapping
+                            (source %readymedia-run-directory)
+                            (target source)
+                            (writable? #t))
                            (map (lambda (directory)
                                   (file-system-mapping
                                    (source (readymedia-media-directory-path directory))
@@ -195,7 +207,9 @@ (define (readymedia-activation config)
                         (mkdir-p/perms directory
                                        (getpw #$%readymedia-user-account)
                                        #o755)))
-                    (list #$cache-directory #$log-directory))))))
+                    (list #$cache-directory #$log-directory
+                          #$%readymedia-db-directory
+                          #$%readymedia-run-directory))))))
 
 (define readymedia-service-type
   (service-type
--8<---------------cut here---------------end--------------->8---

-- 
Thanks,
Maxim




This bug report was last modified 2 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.