GNU bug report logs - #51141
guix home reconfigure does not apply changes to shepherd services

Previous Next

Package: guix;

Reported by: Oleg Pykhalov <go.wigust <at> gmail.com>

Date: Mon, 11 Oct 2021 22:54:01 UTC

Severity: normal

To reply to this bug, email your comments to 51141 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#51141; Package guix. (Mon, 11 Oct 2021 22:54:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 11 Oct 2021 22:54:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: bug-guix <bug-guix <at> gnu.org>
Cc: Andrew Tropin <andrew <at> trop.in>
Subject: guix home reconfigure does not apply changes to shepherd services
Date: Tue, 12 Oct 2021 01:53:09 +0300
[Message part 1 (text/plain, inline)]
After changing a home shepherd service I tried to reconfigure with 'guix
home reconfigure'.

Process started by a service did not restart.  Assuming home shepherd is
like Guix System shepherd I tried to 'herd restart SERVICE_NAME', the
process restarted but without changes in a service definition.

To forcely apply the changes I invoked 'herd stop root' and then ran
'guix home reconfigure' again which spawned new shepherd with applied
changes.

Oleg.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#51141; Package guix. (Fri, 15 Oct 2021 06:22:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: Oleg Pykhalov <go.wigust <at> gmail.com>, bug-guix <bug-guix <at> gnu.org>
Subject: Re: guix home reconfigure does not apply changes to shepherd services
Date: Fri, 15 Oct 2021 09:21:36 +0300
[Message part 1 (text/plain, inline)]
On 2021-10-12 01:53, Oleg Pykhalov wrote:

> After changing a home shepherd service I tried to reconfigure with 'guix
> home reconfigure'.
>
> Process started by a service did not restart.  Assuming home shepherd is
> like Guix System shepherd I tried to 'herd restart SERVICE_NAME', the
> process restarted but without changes in a service definition.

It's intentional, only `herd load root new-config.conf` called on
activation, so existing services are not affected to prevent situations,
where emacs daemon or other important process killed in the middle of
unsaved work.

You can do `herd unload root SERVICE_NAME` and after that reconfigure
will apply the latest configuration and start the service (if
auto-start? is true).

>
> To forcely apply the changes I invoked 'herd stop root' and then ran
> 'guix home reconfigure' again which spawned new shepherd with applied
> changes.
>
> Oleg.

-- 
Best regards,
Andrew Tropin
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#51141; Package guix. (Sat, 16 Oct 2021 15:07:02 GMT) Full text and rfc822 format available.

Message #11 received at 51141 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Andrew Tropin <andrew <at> trop.in>
Cc: 51141 <at> debbugs.gnu.org
Subject: Re: bug#51141: guix home reconfigure does not apply changes to
 shepherd services
Date: Sat, 16 Oct 2021 18:06:14 +0300
[Message part 1 (text/plain, inline)]
Hi Andrew,

Andrew Tropin <andrew <at> trop.in> writes:

> On 2021-10-12 01:53, Oleg Pykhalov wrote:
>
>> After changing a home shepherd service I tried to reconfigure with 'guix
>> home reconfigure'.
>>
>> Process started by a service did not restart.  Assuming home shepherd is
>> like Guix System shepherd I tried to 'herd restart SERVICE_NAME', the
>> process restarted but without changes in a service definition.
>
> It's intentional, only `herd load root new-config.conf` called on
> activation, so existing services are not affected to prevent situations,
> where emacs daemon or other important process killed in the middle of
> unsaved work.

If I change something inside a system service definition
SERVICE-shepherd-service and then invoke 'guix system reconfigure', the
service will not restart and not produce any effect until I inoke 'sudo
herd restart SERVICE'.

After herd restart the service will be running with applied changes and
does not require 'herd unload root SERVICE_NAME'.
E.g. nginx-service-type.

I think this behaviour should be the same for home services.  WDYT?
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#51141; Package guix. (Mon, 18 Oct 2021 10:05:02 GMT) Full text and rfc822 format available.

Message #14 received at 51141 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: 51141 <at> debbugs.gnu.org
Subject: Re: bug#51141: guix home reconfigure does not apply changes to
 shepherd services
Date: Mon, 18 Oct 2021 13:04:24 +0300
[Message part 1 (text/plain, inline)]
On 2021-10-16 18:06, Oleg Pykhalov wrote:

> Hi Andrew,
>
> Andrew Tropin <andrew <at> trop.in> writes:
>
>> On 2021-10-12 01:53, Oleg Pykhalov wrote:
>>
>>> After changing a home shepherd service I tried to reconfigure with 'guix
>>> home reconfigure'.
>>>
>>> Process started by a service did not restart.  Assuming home shepherd is
>>> like Guix System shepherd I tried to 'herd restart SERVICE_NAME', the
>>> process restarted but without changes in a service definition.
>>
>> It's intentional, only `herd load root new-config.conf` called on
>> activation, so existing services are not affected to prevent situations,
>> where emacs daemon or other important process killed in the middle of
>> unsaved work.
>
> If I change something inside a system service definition
> SERVICE-shepherd-service and then invoke 'guix system reconfigure', the
> service will not restart and not produce any effect until I invoke 'sudo
> herd restart SERVICE'.
>
> After herd restart the service will be running with applied changes and
> does not require 'herd unload root SERVICE_NAME'.
> E.g. nginx-service-type.
>
> I think this behaviour should be the same for home services.  WDYT?

Yes, make sense.

According to what I see in the shepherd tests:
https://git.savannah.gnu.org/cgit/shepherd.git/tree/tests/replacement.sh?h=4c5176f5a7a5a1e7d7f258f585e8ed127a21b99a#n61

and how it's implemented in home-shepherd:
https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/home/services/shepherd.scm?h=7c3f28fdc4edc00f66801cd51a5ba08eee44f77f#n59

It should work as you expect it.

Tried to do the following: I updated documentation field for a shepherd
service, reconfigured and it got loaded after I restarted a service.

--8<---------------cut here---------------start------------->8---
~ $ herd doc state
Init, update and maybe destroy state.
~ $ herd restart state
Service state has been stopped.
Service state has been started.
~ $ herd doc state
Really init, update and maybe destroy state.
--8<---------------cut here---------------end--------------->8---

Didn't check if start action gexp is updated too, but I expect it was.

-- 
Best regards,
Andrew Tropin
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#51141; Package guix. (Thu, 21 Oct 2021 23:34:02 GMT) Full text and rfc822 format available.

Message #17 received at 51141 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Andrew Tropin <andrew <at> trop.in>
Cc: 51141 <at> debbugs.gnu.org
Subject: Re: bug#51141: guix home reconfigure does not apply changes to
 shepherd services
Date: Fri, 22 Oct 2021 02:32:51 +0300
[Message part 1 (text/plain, inline)]
Andrew Tropin <andrew <at> trop.in> writes:

[…]

> According to what I see in the shepherd tests:
> https://git.savannah.gnu.org/cgit/shepherd.git/tree/tests/replacement.sh?h=4c5176f5a7a5a1e7d7f258f585e8ed127a21b99a#n61
>
> and how it's implemented in home-shepherd:
> https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/home/services/shepherd.scm?h=7c3f28fdc4edc00f66801cd51a5ba08eee44f77f#n59
>
> It should work as you expect it.

It doesn't.

> Tried to do the following: I updated documentation field for a shepherd
> service, reconfigured and it got loaded after I restarted a service.
>
> ~ $ herd doc state
> Init, update and maybe destroy state.
> ~ $ herd restart state
> Service state has been stopped.
> Service state has been started.
> ~ $ herd doc state
> Really init, update and maybe destroy state.
>
> Didn't check if start action gexp is updated too, but I expect it was.

The start action is the interest, or configuration record, or service
extension.

(guix scripts system reconfigure) has a upgrade-shepherd-services
procedure, which was created in 240b57f0ca576708ebf6cfa0dfe2803fa9ff2323
and discussed in https://issues.guix.gnu.org/22039


[ The following text only describes how to reproduce the issue. ]


When I tried to write goimapnotify service no changes applied after
modifications in home-goimapnotify-shepherd-service [1] and [2], which
are typical service-type and record.  I didn't have similar issues with
self-written system services.

[1]: https://gitlab.com/wigust/dotfiles/-/blob/ea2111906233099267f3b581b4aae39ad9645c2d/dotfiles/guixsd/modules/home/services/mail.scm#L28-45
[2]: https://gitlab.com/wigust/dotfiles/-/blob/ea2111906233099267f3b581b4aae39ad9645c2d/dotfiles/guixsd/home.scm#L40-65


Service extension also requires to unload service, e.g. mcron service
extension in [1] and [2].

[1]: https://gitlab.com/wigust/dotfiles/-/blob/ea2111906233099267f3b581b4aae39ad9645c2d/dotfiles/guixsd/modules/home/services/package-management.scm#L16-50
[2]: https://gitlab.com/wigust/dotfiles/-/blob/ea2111906233099267f3b581b4aae39ad9645c2d/dotfiles/guixsd/home.scm#L154-161

If I remove the guix-delete-generations service from home configuration,
mcron job still exists according to 'herd schedule mcron'.
--8<---------------cut here---------------start------------->8---
(home-environment
 (services
  (list (service guix-delete-generations-service-type ;; ...
                 ))))
--8<---------------cut here---------------end--------------->8---

Oleg.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#51141; Package guix. (Sat, 23 Oct 2021 07:12:01 GMT) Full text and rfc822 format available.

Message #20 received at 51141 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: 51141 <at> debbugs.gnu.org
Subject: Re: bug#51141: guix home reconfigure does not apply changes to
 shepherd services
Date: Sat, 23 Oct 2021 10:11:20 +0300
[Message part 1 (text/plain, inline)]
On 2021-10-22 02:32, Oleg Pykhalov wrote:

> Andrew Tropin <andrew <at> trop.in> writes:
>
> […]
>
>> According to what I see in the shepherd tests:
>> https://git.savannah.gnu.org/cgit/shepherd.git/tree/tests/replacement.sh?h=4c5176f5a7a5a1e7d7f258f585e8ed127a21b99a#n61
>>
>> and how it's implemented in home-shepherd:
>> https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/home/services/shepherd.scm?h=7c3f28fdc4edc00f66801cd51a5ba08eee44f77f#n59
>>
>> It should work as you expect it.
>
> It doesn't.
>
>> Tried to do the following: I updated documentation field for a shepherd
>> service, reconfigured and it got loaded after I restarted a service.
>>
>> ~ $ herd doc state
>> Init, update and maybe destroy state.
>> ~ $ herd restart state
>> Service state has been stopped.
>> Service state has been started.
>> ~ $ herd doc state
>> Really init, update and maybe destroy state.
>>
>> Didn't check if start action gexp is updated too, but I expect it was.
>
> The start action is the interest, or configuration record, or service
> extension.

From the experiment above it's clear that new configuration got loaded
and service record get updated after restart (at least one field of it).

>
> (guix scripts system reconfigure) has a upgrade-shepherd-services
> procedure, which was created in 240b57f0ca576708ebf6cfa0dfe2803fa9ff2323
> and discussed in https://issues.guix.gnu.org/22039

The difference with update-shepherd-services is the usage of Shepherd
CLI in home service instead of Shepherd API in system service.  So the
problem can hide somewhere around this part.

Automatic unloading in home-service doesn't happens and as I said it's
by design to prevent cases of losing unsaved work.  However, it can be
implemented with an optional separate flag to shepherd configuration
record and extension to run-on-change-service or as it done in system
shepherd with the list of services, which doesn't have to be unloaded
automatically.

>
>
> [ The following text only describes how to reproduce the issue. ]
>
>
> When I tried to write goimapnotify service no changes applied after
> modifications in home-goimapnotify-shepherd-service [1] and [2], which
> are typical service-type and record.  I didn't have similar issues with
> self-written system services.
>
> [1]: https://gitlab.com/wigust/dotfiles/-/blob/ea2111906233099267f3b581b4aae39ad9645c2d/dotfiles/guixsd/modules/home/services/mail.scm#L28-45
> [2]: https://gitlab.com/wigust/dotfiles/-/blob/ea2111906233099267f3b581b4aae39ad9645c2d/dotfiles/guixsd/home.scm#L40-65
>

I'm out of office for next 1.5 week, will check it when I come back.

>
> Service extension also requires to unload service, e.g. mcron service
> extension in [1] and [2].
>
> [1]: https://gitlab.com/wigust/dotfiles/-/blob/ea2111906233099267f3b581b4aae39ad9645c2d/dotfiles/guixsd/modules/home/services/package-management.scm#L16-50
> [2]: https://gitlab.com/wigust/dotfiles/-/blob/ea2111906233099267f3b581b4aae39ad9645c2d/dotfiles/guixsd/home.scm#L154-161
>
> If I remove the guix-delete-generations service from home configuration,
> mcron job still exists according to 'herd schedule mcron'.
> --8<---------------cut here---------------start------------->8---
> (home-environment
>  (services
>   (list (service guix-delete-generations-service-type ;; ...
>                  ))))
> --8<---------------cut here---------------end--------------->8---
>
> Oleg.

BTW, please remove unreviewed changes to interpose function, they are
incorrect.
https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/services/configuration.scm?id=41492639e0223dc8fc1a357e1f9537577c055db7#n362

The explanation: https://issues.guix.gnu.org/50967#66
The correct version: https://git.sr.ht/~abcdw/rde/commit/4961f47c3f97c21799a39b3e906fa99b2625f331

-- 
Best regards,
Andrew Tropin
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 2 years and 194 days ago.

Previous Next


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