unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* shepherd: prefix output with service names?
@ 2022-12-14 10:38 Ricardo Wurmus
  2022-12-14 13:51 ` Thompson, David
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ricardo Wurmus @ 2022-12-14 10:38 UTC (permalink / raw)
  To: Guix Devel

Hi Guix,

here is some output from “guix system reconfigure”:

--8<---------------cut here---------------start------------->8---
…
activating system...
The following derivation will be built:
  /gnu/store/7361cd8aasxwwb93ygdfwjp3ghn06ahb-switch-to-system.scm.drv

building /gnu/store/7361cd8aasxwwb93ygdfwjp3ghn06ahb-switch-to-system.scm.drv...
making '/gnu/store/rp04hkqlzx5j2lhxainsz77vpqqigsjz-system' the current system...
setting up setuid programs in '/run/setuid-programs'...
populating /etc from /gnu/store/gq2dvz09wf3sdmvynr2vdzy5wwj7k9fd-etc...
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

initdb: error: directory "/var/lib/postgresql/data" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/var/lib/postgresql/data" or run initdb
with an argument other than "/var/lib/postgresql/data".
Starting installation ...
Validate installation settings ...
Create file system structures ...
Create self-signed certificate database ...
Error: Instance creation failed!  Failed to start DS
The following derivation will be built:
  /gnu/store/5jx2cj780cqs2pp575rckvrx45j9kysy-install-bootloader.scm.drv

building /gnu/store/5jx2cj780cqs2pp575rckvrx45j9kysy-install-bootloader.scm.drv...
guix system: bootloader successfully installed on '(/dev/sda)'
shepherd: Evaluating user expression (and (defined? (quote transient?)) (map (# ?) ?)).
The following derivation will be built:
  /gnu/store/q933nvsqjx2f9zra91jbpjvb9x2yf2sn-upgrade-shepherd-services.scm.drv

building /gnu/store/q933nvsqjx2f9zra91jbpjvb9x2yf2sn-upgrade-shepherd-services.scm.drv...
shepherd: Service host-name has been started.
shepherd: Service user-homes has been started.
shepherd: Service sysctl has been started.
shepherd: Service host-name has been started.
shepherd: Service term-console could not be started.
shepherd: Service postgres-roles has been started.
shepherd: Service directory-server-localhost could not be started.
To complete the upgrade, run 'herd restart SERVICE' to stop,
upgrade, and restart each service that was not automatically restarted.
Run 'herd status' to view the list of services on your system.
--8<---------------cut here---------------end--------------->8---

You see that there is output of tools that run as part of service
activation snippets.  It is not clear which service is responsible for
any particular line of output.

What service produced the line “Error: Instance creation failed!  Failed
to start DS”, for example?  I know it’s the directory-server-localhost
service, because that’s what I’m working on right now, but it’s not
clear from the output.

What do you think of prefixing every line with the name of the service
that is responsible for it?  This way we could probably also
prettify/post-process the output somewhat.

-- 
Ricardo


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

* Re: shepherd: prefix output with service names?
  2022-12-14 10:38 shepherd: prefix output with service names? Ricardo Wurmus
@ 2022-12-14 13:51 ` Thompson, David
  2022-12-14 14:18 ` Attila Lendvai
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Thompson, David @ 2022-12-14 13:51 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Guix Devel

Hi Ricardo,

On Wed, Dec 14, 2022 at 5:44 AM Ricardo Wurmus <rekado@elephly.net> wrote:
>
> What do you think of prefixing every line with the name of the service
> that is responsible for it?  This way we could probably also
> prettify/post-process the output somewhat.

I think that's a great idea!

- Dave


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

* Re: shepherd: prefix output with service names?
  2022-12-14 10:38 shepherd: prefix output with service names? Ricardo Wurmus
  2022-12-14 13:51 ` Thompson, David
@ 2022-12-14 14:18 ` Attila Lendvai
  2022-12-15  3:47 ` Maxim Cournoyer
  2022-12-15 15:04 ` Ludovic Courtès
  3 siblings, 0 replies; 5+ messages in thread
From: Attila Lendvai @ 2022-12-14 14:18 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Guix Devel

> What do you think of prefixing every line with the name of the service
> that is responsible for it? This way we could probably also
> prettify/post-process the output somewhat.


just a general warning here:

errors in the processing of output that resulted in some error messages getting silently swallowed by the infrastructure has cost me countless hours of unnecessary debugging.

i have already experienced this in multiple places also in the Guix codebase.

-- 
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“To have a right to do a thing is not at all the same as to be right in doing it.”
	— G.K. Chesterton



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

* Re: shepherd: prefix output with service names?
  2022-12-14 10:38 shepherd: prefix output with service names? Ricardo Wurmus
  2022-12-14 13:51 ` Thompson, David
  2022-12-14 14:18 ` Attila Lendvai
@ 2022-12-15  3:47 ` Maxim Cournoyer
  2022-12-15 15:04 ` Ludovic Courtès
  3 siblings, 0 replies; 5+ messages in thread
From: Maxim Cournoyer @ 2022-12-15  3:47 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Guix Devel

Hi Ricardo,

Ricardo Wurmus <rekado@elephly.net> writes:

[...]

> What do you think of prefixing every line with the name of the service
> that is responsible for it?  This way we could probably also
> prettify/post-process the output somewhat.

I think that's a great idea; I'm not sure if you've noticed, but mcron
is now doing that for the job it runs, so it'd be consistent if Shepherd
also did that.

-- 
Thanks,
Maxim


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

* Re: shepherd: prefix output with service names?
  2022-12-14 10:38 shepherd: prefix output with service names? Ricardo Wurmus
                   ` (2 preceding siblings ...)
  2022-12-15  3:47 ` Maxim Cournoyer
@ 2022-12-15 15:04 ` Ludovic Courtès
  3 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2022-12-15 15:04 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Guix Devel

Hi!

Ricardo Wurmus <rekado@elephly.net> skribis:

> here is some output from “guix system reconfigure”:
>
> …
> activating system...
> The following derivation will be built:
>   /gnu/store/7361cd8aasxwwb93ygdfwjp3ghn06ahb-switch-to-system.scm.drv
>
> building /gnu/store/7361cd8aasxwwb93ygdfwjp3ghn06ahb-switch-to-system.scm.drv...
> making '/gnu/store/rp04hkqlzx5j2lhxainsz77vpqqigsjz-system' the current system...
> setting up setuid programs in '/run/setuid-programs'...
> populating /etc from /gnu/store/gq2dvz09wf3sdmvynr2vdzy5wwj7k9fd-etc...
> The files belonging to this database system will be owned by user "postgres".
> This user must also own the server process.
>
> The database cluster will be initialized with locale "en_US.utf8".
> The default database encoding has accordingly been set to "UTF8".
> The default text search configuration will be set to "english".
>
> Data page checksums are disabled.
>
> initdb: error: directory "/var/lib/postgresql/data" exists but is not empty
> If you want to create a new database system, either remove or empty
> the directory "/var/lib/postgresql/data" or run initdb
> with an argument other than "/var/lib/postgresql/data".
> Starting installation ...
> Validate installation settings ...
> Create file system structures ...
> Create self-signed certificate database ...
> Error: Instance creation failed!  Failed to start DS

These lines are produced by activation snippets; they don’t go through
shepherd.

> You see that there is output of tools that run as part of service
> activation snippets.  It is not clear which service is responsible for
> any particular line of output.
>
> What service produced the line “Error: Instance creation failed!  Failed
> to start DS”, for example?  I know it’s the directory-server-localhost
> service, because that’s what I’m working on right now, but it’s not
> clear from the output.
>
> What do you think of prefixing every line with the name of the service
> that is responsible for it?  This way we could probably also
> prettify/post-process the output somewhat.

I agree it would be great; it’s not related to shepherd though (shepherd
already does that).

Now, maybe some activation snippets could be moved to the ‘start’ method
of the corresponding service.  That is, instead of:

  (make-forkexec-constructor …)

you’d have:

  (lambda ()
    (invoke …) ;run some initialization command here
    (fork+exec-command …))

In some cases that may be more appropriate; as a bonus, it would solve
the logging problem since shepherd would log it correctly.

WDYT?

Ludo’.


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

end of thread, other threads:[~2022-12-15 15:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-14 10:38 shepherd: prefix output with service names? Ricardo Wurmus
2022-12-14 13:51 ` Thompson, David
2022-12-14 14:18 ` Attila Lendvai
2022-12-15  3:47 ` Maxim Cournoyer
2022-12-15 15:04 ` Ludovic Courtès

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).