[bug#77943,1/2] services: shepherd: Provide the right #:kernel-log-file on the Hurd.

Message ID ee2ded1a592d8f91595c26c08f6f9f047d74b4f2.1745163830.git.ludo@gnu.org
State New
Headers
Series Using the Shepherd's system log on the Hurd |

Commit Message

Ludovic Courtès April 20, 2025, 3:54 p.m. UTC
* gnu/services/shepherd.scm (shepherd-system-log-service-type):
Pass #:kernel-log-file.

Reported-by: Yelninei <yelninei@tutamail.com>
Change-Id: I6f7a4b4e8e69a116069886e3879400d600645b30
---
 gnu/services/shepherd.scm | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Comments

tusharhero--- via Guix-patches via June 2, 2025, 2:35 p.m. UTC | #1
Hi Ludo,

I am a bit late to this:

Does it still make sense to duplicate the default kernel-log-file in guix and shepherd now that 1.0.5 is available?

The issue with ED_WOULD_BLOCK is still present on hurd-0.9.git20250420 on core-packages-team. 
I tried it for a while with #:kernel-log-file set to #f and it felt like it was slowing down shepherd significantly enough to be mildly annoying but idk if this is something I only noticed because I was actively looking for changes.


Apr 20, 2025, 15:54 by ludo@gnu.org:

> * gnu/services/shepherd.scm (shepherd-system-log-service-type):
> Pass #:kernel-log-file.
>
> Reported-by: Yelninei <yelninei@tutamail.com>
> Change-Id: I6f7a4b4e8e69a116069886e3879400d600645b30
> ---
> gnu/services/shepherd.scm | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
> index c8e01c9d83..156a36c2da 100644
> --- a/gnu/services/shepherd.scm
> +++ b/gnu/services/shepherd.scm
> @@ -781,6 +781,15 @@ (define shepherd-system-log-service-type
> (#f #~())
> (value #~(#:message-destination #$value)))
>
> +                               ;; The Shepherd <= 1.0.4 chooses /proc/kmsg
> +                               ;; unconditionally.  Fix that.
> +                               #:kernel-log-file
> +                               (cond ((string-contains %host-type "linux") ;Linux
> +                                      "/proc/kmsg")
> +                                     ((string-suffix? "-gnu" %host-type) ;GNU/Hurd
> +                                      "/dev/klog")
> +                                     (else #f))
> +
> #:date-format #$date-format
> #:history-size #$history-size
> #:max-silent-time #$max-silent-time)))))
> --
> 2.49.0
>
  
Ludovic Courtès June 2, 2025, 3:01 p.m. UTC | #2
Hi,

yelninei@tutamail.com writes:

> Does it still make sense to duplicate the default kernel-log-file in guix and shepherd now that 1.0.5 is available?

No, it’s no longer necessary.

> The issue with ED_WOULD_BLOCK is still present on hurd-0.9.git20250420 on core-packages-team. 

Right, I started looking into it back then but then didn’t take the time
to track it down.

> I tried it for a while with #:kernel-log-file set to #f and it felt
> like it was slowing down shepherd significantly enough to be mildly
> annoying but idk if this is something I only noticed because I was
> actively looking for changes.

How did you notice that it was slowing down?  That was with 1.0.5,
right?

Thanks,
Ludo’.
  
tusharhero--- via Guix-patches via June 2, 2025, 8:02 p.m. UTC | #3
Hello,

Jun 2, 2025, 16:09 by ludo@gnu.org:

> The issue with ED_WOULD_BLOCK is still present on hurd-0.9.git20250420 on core-packages-team. 
>
> Right, I started looking into it back then but then didn’t take the time
> to track it down.
>
>> I tried it for a while with #:kernel-log-file set to #f and it felt
>> like it was slowing down shepherd significantly enough to be mildly
>> annoying but idk if this is something I only noticed because I was
>> actively looking for changes.
>>
>
> How did you notice that it was slowing down?  That was with 1.0.5,
> right?
>

I dont know if I am just imagining this but anything ssh related felt a bit laggy but idk how the syslog should cause this except that sshd logs to syslog and shepherd is also managing the sshd socket.

 Also things like herd status felt a lot slower.

But all of this was not really consistent and I dont know if I am just making this up so this might be all wrong.
No this was all with 1.0.4, tested this on master around when you sent the initial version. And on core-packages-team shepherd is still 1.0.4.

> Thanks,
> Ludo’.
>
  

Patch

diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index c8e01c9d83..156a36c2da 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -781,6 +781,15 @@  (define shepherd-system-log-service-type
                                     (#f #~())
                                     (value #~(#:message-destination #$value)))
 
+                               ;; The Shepherd <= 1.0.4 chooses /proc/kmsg
+                               ;; unconditionally.  Fix that.
+                               #:kernel-log-file
+                               (cond ((string-contains %host-type "linux") ;Linux
+                                      "/proc/kmsg")
+                                     ((string-suffix? "-gnu" %host-type) ;GNU/Hurd
+                                      "/dev/klog")
+                                     (else #f))
+
                                #:date-format #$date-format
                                #:history-size #$history-size
                                #:max-silent-time #$max-silent-time)))))