unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#30939: shepherd: detailed output should be placed into well-known location and not tty
@ 2018-03-25 18:35 ng0
  2018-03-26 13:41 ` Ludovic Courtès
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: ng0 @ 2018-03-25 18:35 UTC (permalink / raw)
  To: 30939

Problem, not just when a service is misbehaving after successful system reconfigure:

$ sudo herd start smtpd
Password: 
Service smtpd could not be started.
herd: failed to start service smtpd



This is on virtual terminal in X11, as well as in /var/log/messages,
/var/log/shepherd.log, etc.
This is not enough. If I wanted more info, I'd expect that
sudo herd status smtpd would give it (which it does not), so the only
reliable source of information so far is tty 1. Can we fix that in
one of the next shepherd releases? Or is this something we have to
fix in Guix?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#30939: shepherd: detailed output should be placed into well-known location and not tty
  2018-03-25 18:35 bug#30939: shepherd: detailed output should be placed into well-known location and not tty ng0
@ 2018-03-26 13:41 ` Ludovic Courtès
  2018-03-26 15:10   ` ng0
  2019-06-26 18:07 ` bug#30939: still relevant Robert Vollmert
  2020-07-18 16:27 ` bug#30939: shepherd: detailed output should be placed into well-known location and not tty conjaroy
  2 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2018-03-26 13:41 UTC (permalink / raw)
  To: ng0; +Cc: 30939

Hi ng0,

ng0 <ng0@n0.is> skribis:

> Problem, not just when a service is misbehaving after successful system reconfigure:
>
> $ sudo herd start smtpd
> Password: 
> Service smtpd could not be started.
> herd: failed to start service smtpd
>
>
>
> This is on virtual terminal in X11, as well as in /var/log/messages,
> /var/log/shepherd.log, etc.
> This is not enough. If I wanted more info, I'd expect that
> sudo herd status smtpd would give it (which it does not), so the only
> reliable source of information so far is tty 1. Can we fix that in
> one of the next shepherd releases? Or is this something we have to
> fix in Guix?

So you’re saying that you’d like shepherd to show more info as to why
the service could not be started, right?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#30939: shepherd: detailed output should be placed into well-known location and not tty
  2018-03-26 13:41 ` Ludovic Courtès
@ 2018-03-26 15:10   ` ng0
  2018-03-27  7:36     ` Ludovic Courtès
  0 siblings, 1 reply; 9+ messages in thread
From: ng0 @ 2018-03-26 15:10 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 30939, ng0

Hi Ludovic,

Ludovic Courtès transcribed 790 bytes:
> Hi ng0,
> 
> ng0 <ng0@n0.is> skribis:
> 
> > Problem, not just when a service is misbehaving after successful system reconfigure:
> >
> > $ sudo herd start smtpd
> > Password: 
> > Service smtpd could not be started.
> > herd: failed to start service smtpd
> >
> >
> >
> > This is on virtual terminal in X11, as well as in /var/log/messages,
> > /var/log/shepherd.log, etc.
> > This is not enough. If I wanted more info, I'd expect that
> > sudo herd status smtpd would give it (which it does not), so the only
> > reliable source of information so far is tty 1. Can we fix that in
> > one of the next shepherd releases? Or is this something we have to
> > fix in Guix?
> 
> So you’re saying that you’d like shepherd to show more info as to why
> the service could not be started, right?
> 
> Thanks,
> Ludo’.

Must have been late and too many failed attempts at what I'm trying to do.
Yes. So I can't make any daemons I run out there fail, but for the
current case I have in Guix for this:

Sometimes I succeed building a system generation with an OpenSMTPD config-file
which has syntax error that aren't picked up at configure time. When I reboot,
not being aware of this, I have to switch to tty to read the reasons why it
crashed.
Because this is a desktop system, I have to start the service again to see
the error output directly from the daemon.

I think I know why this happens (that the output goes to tty), but nevertheless
it would be good if shepherd were more capable than beint captain obvious:
Start: "Oh, you see it is started". Crashed: "Oh, no has your daemon crashed?",
like it is now.
....
Okay, I just looked at some other daemon controls I run, and maybe it's good that
shepherd is limited in its output. It does this one job. What I'd like to have
as a sysadmin is the ability to tail something like say /var/log/shepherd.fail.log
and services which are failing log into this file (or a set of files in /var/log/shepherd/
in files like $daemonname.fail.log).
Given the absence of the kitchensink of tools in systemd, you got used to something like
"status" and immediate "HELLO! This is why I failed: (5 lines)". With shepherd, you can't
even grep for the failures in locations newcomers to the system would assume (like:
/var/log/shepherd.log (it is the daemon control application)).

Long store short, greping for failures to fix daemon configurations and not having to
look at tty 1 (which can be noisy depending on what you run, I have some notorious tty
spammers) would be good.
And not sacrifice the simplicity of Shepherd :)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#30939: shepherd: detailed output should be placed into well-known location and not tty
  2018-03-26 15:10   ` ng0
@ 2018-03-27  7:36     ` Ludovic Courtès
  2018-03-27  9:15       ` ng0
                         ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Ludovic Courtès @ 2018-03-27  7:36 UTC (permalink / raw)
  To: ng0; +Cc: 30939

Hello,

ng0 <ng0@n0.is> skribis:

> Sometimes I succeed building a system generation with an OpenSMTPD config-file
> which has syntax error that aren't picked up at configure time. When I reboot,
> not being aware of this, I have to switch to tty to read the reasons why it
> crashed.
> Because this is a desktop system, I have to start the service again to see
> the error output directly from the daemon.

I think shepherd could capture stdout/stderr of the processes it starts
and make it available, in a way similar in spirit to what ‘journalctl’
does.  That would allow you to see the output of the daemon that failed.

That’s the only solution I can think of.  Of course we don’t have to do
that if the daemon writes error messages to syslog, but not all of them do.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#30939: shepherd: detailed output should be placed into well-known location and not tty
  2018-03-27  7:36     ` Ludovic Courtès
@ 2018-03-27  9:15       ` ng0
  2018-03-27 18:59       ` Clément Lassieur
  2018-03-27 20:13       ` Mark H Weaver
  2 siblings, 0 replies; 9+ messages in thread
From: ng0 @ 2018-03-27  9:15 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 30939, ng0

Ludovic Courtès transcribed 839 bytes:
> Hello,
> 
> ng0 <ng0@n0.is> skribis:
> 
> > Sometimes I succeed building a system generation with an OpenSMTPD config-file
> > which has syntax error that aren't picked up at configure time. When I reboot,
> > not being aware of this, I have to switch to tty to read the reasons why it
> > crashed.
> > Because this is a desktop system, I have to start the service again to see
> > the error output directly from the daemon.
> 
> I think shepherd could capture stdout/stderr of the processes it starts
> and make it available, in a way similar in spirit to what ‘journalctl’
> does.  That would allow you to see the output of the daemon that failed.

That sounds good.

> That’s the only solution I can think of.  Of course we don’t have to do
> that if the daemon writes error messages to syslog, but not all of them do.
> 
> Thanks,
> Ludo’.

Well, just a way to catch them would be good.

Thanks

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#30939: shepherd: detailed output should be placed into well-known location and not tty
  2018-03-27  7:36     ` Ludovic Courtès
  2018-03-27  9:15       ` ng0
@ 2018-03-27 18:59       ` Clément Lassieur
  2018-03-27 20:13       ` Mark H Weaver
  2 siblings, 0 replies; 9+ messages in thread
From: Clément Lassieur @ 2018-03-27 18:59 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 30939, ng0

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

> Hello,
>
> ng0 <ng0@n0.is> skribis:
>
>> Sometimes I succeed building a system generation with an OpenSMTPD config-file
>> which has syntax error that aren't picked up at configure time. When I reboot,
>> not being aware of this, I have to switch to tty to read the reasons why it
>> crashed.
>> Because this is a desktop system, I have to start the service again to see
>> the error output directly from the daemon.
>
> I think shepherd could capture stdout/stderr of the processes it starts
> and make it available, in a way similar in spirit to what ‘journalctl’
> does.  That would allow you to see the output of the daemon that failed.

That would be great!

> That’s the only solution I can think of.  Of course we don’t have to do
> that if the daemon writes error messages to syslog, but not all of them do.
>
> Thanks,
> Ludo’.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#30939: shepherd: detailed output should be placed into well-known location and not tty
  2018-03-27  7:36     ` Ludovic Courtès
  2018-03-27  9:15       ` ng0
  2018-03-27 18:59       ` Clément Lassieur
@ 2018-03-27 20:13       ` Mark H Weaver
  2 siblings, 0 replies; 9+ messages in thread
From: Mark H Weaver @ 2018-03-27 20:13 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 30939, ng0

ludo@gnu.org (Ludovic Courtès) writes:

> ng0 <ng0@n0.is> skribis:
>
>> Sometimes I succeed building a system generation with an OpenSMTPD config-file
>> which has syntax error that aren't picked up at configure time. When I reboot,
>> not being aware of this, I have to switch to tty to read the reasons why it
>> crashed.
>> Because this is a desktop system, I have to start the service again to see
>> the error output directly from the daemon.
>
> I think shepherd could capture stdout/stderr of the processes it starts
> and make it available, in a way similar in spirit to what ‘journalctl’
> does.  That would allow you to see the output of the daemon that failed.

This would be very helpful.

      Mark

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#30939: still relevant
  2018-03-25 18:35 bug#30939: shepherd: detailed output should be placed into well-known location and not tty ng0
  2018-03-26 13:41 ` Ludovic Courtès
@ 2019-06-26 18:07 ` Robert Vollmert
  2020-07-18 16:27 ` bug#30939: shepherd: detailed output should be placed into well-known location and not tty conjaroy
  2 siblings, 0 replies; 9+ messages in thread
From: Robert Vollmert @ 2019-06-26 18:07 UTC (permalink / raw)
  To: 30939

This came up again recently, compare the discussion here:

https://lists.gnu.org/archive/html/guix-devel/2019-06/msg00186.html

Here’s some code to wrap an executable manually to capture its output
and send it to syslog:

(define* (logger-wrapper name exec . args)
  "Return a derivation that builds a script to start a process with
standard output and error redirected to syslog via logger."
  (define exp
    #~(begin
        (use-modules (ice-9 popen))
        (let* ((pid    (number->string (getpid)))
               (logger #$(file-append inetutils "/bin/logger"))
               (args   (list "-t" #$name (string-append "--id=" pid)))
               (pipe   (apply open-pipe* OPEN_WRITE logger args)))
          (dup pipe 1)
          (dup pipe 2)
          (execl #$exec #$exec #$@args))))
  (program-file (string-append name "-logger") exp))

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#30939: shepherd: detailed output should be placed into well-known location and not tty
  2018-03-25 18:35 bug#30939: shepherd: detailed output should be placed into well-known location and not tty ng0
  2018-03-26 13:41 ` Ludovic Courtès
  2019-06-26 18:07 ` bug#30939: still relevant Robert Vollmert
@ 2020-07-18 16:27 ` conjaroy
  2 siblings, 0 replies; 9+ messages in thread
From: conjaroy @ 2020-07-18 16:27 UTC (permalink / raw)
  To: 30939

[-- Attachment #1: Type: text/plain, Size: 609 bytes --]

Hello -

I too have found that debugging is a challenge when a service's
stdout/stderr aren't captured automatically. From my point of view though,
the issue is not just that certain binaries lack syslog support: since a
service implementation's gexp can do much more than just exec a binary, and
since mistakes in gexps usually go unnoticed until a runtime, I've found it
easy to write scripts that trigger fatal Guile errors before the service
binary is even started (syntax errors, missing `use-modules` declarations,
etc.)

Will the solution proposed here capture output for this class of errors as
well?

[-- Attachment #2: Type: text/html, Size: 710 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-07-18 16:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-25 18:35 bug#30939: shepherd: detailed output should be placed into well-known location and not tty ng0
2018-03-26 13:41 ` Ludovic Courtès
2018-03-26 15:10   ` ng0
2018-03-27  7:36     ` Ludovic Courtès
2018-03-27  9:15       ` ng0
2018-03-27 18:59       ` Clément Lassieur
2018-03-27 20:13       ` Mark H Weaver
2019-06-26 18:07 ` bug#30939: still relevant Robert Vollmert
2020-07-18 16:27 ` bug#30939: shepherd: detailed output should be placed into well-known location and not tty conjaroy

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).