guix home reconfigure does not apply changes to shepherd services

  • Open
  • quality assurance status badge
Details
2 participants
  • Andrew Tropin
  • Oleg Pykhalov
Owner
unassigned
Submitted by
Oleg Pykhalov
Severity
normal
O
O
Oleg Pykhalov wrote on 12 Oct 2021 00:53
(name . bug-guix)(address . bug-guix@gnu.org)(name . Andrew Tropin)(address . andrew@trop.in)
87k0ijxjfu.fsf@gmail.com
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.
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmFkwFUUHGdvLndpZ3Vz
dEBnbWFpbC5jb20ACgkQFn+OpQAa+pwtUQ/7Bx9UIxCumw9uXhmp9TUf4PmV3m9g
T46S8/PBMjD2+z5PXSZrxWmMJhcabsxWtmxTLt3n4V3aR46R/Oto76BKkpEmddU8
JgteNLixn616unumtXV0WbT1advsCsI2jC2N7PDnV2/F2t+SrKtIMvmS6QevS5pj
eyeEY7+qdTg4tfxJDp60zAmUrG08bblI54NQvLpy320O+wZINa9onHLCNjvoy1jQ
uGIT0Z2axEOnkcVmDYPkP9SdFCrj6cdmFRmiZ1fPsF/2HDwpfrnjk4pBgdzw+U/J
f3BIoOU9Dx+QCqv0gW0cfEZkyiy4ZUy6v4Zg8+lQRmvkg8J/I0ud+/bdr/qKzMNa
UdeXwNgJLam1FP3kh/pGRn6ArltfbJtqi/6g475eG8/GxhOmuQJw7CYwDeNFEPgx
4l51dToHsN9oF8eKuUv4s6uq/9cE9iQIj5c8Xesdg027dupijdHhkirzcwEUohvY
H4GxY/yrez5Z0IqnjAMsnnX7yC3TxTnvht5vFu18BxEmSWBomYnPLCrB5wgcQ43L
9/ny4i32zhyQLF+zGZXkInIpKFNXT17dG+1f1+Vxbg3qxzTTzAH+G27wE/MvXapC
wkpyBKfcxfudmEUxWQaqqDhLKdoDLWcx7SEJ8dVcwBGtZ4h0PeWsmIxigR5pqvBO
YKEygnzHjiuzims=
=sorG
-----END PGP SIGNATURE-----

A
A
Andrew Tropin wrote on 15 Oct 2021 08:21
878ryuoljj.fsf@trop.in
On 2021-10-12 01:53, Oleg Pykhalov wrote:

Toggle quote (7 lines)
> 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).

Toggle quote (7 lines)
>
> 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
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmFpHfAACgkQIgjSCVjB
3rDzGQ//S8QfLSy6F4qRMh1wSn8EU8oaRHprb17CS2FkwWurfd6AMDuW1PBnUChz
D0wQOJKl7xL3UPuULrtFDTcbTSCcrY0XotMUT8u/JQCCzJkYAfQ4TCv2b1yyRQgT
WvIFac4FLIFeoq1PRFxIY0juIfkKHaTBd43LuhguQWbvZHRZSU26/kPuYh6yG483
6/B0dHD7/wp/ojuBZnNi2Jt+ijO81bVvy6sA6zvB7exdlpEJkLANyVOLrL1BjetT
mqcIBqHGEtNiM16L9rgVZAwd6dG+DItwN8L7ItOPjaX5zh8+isECG9N9Ff22UKpY
U5KfIfM16rttNlDaiJy+z4RvOH2s4/gcbRInnUCdaP/YXqkr6W+lGz3heRjeImlg
KO9nl6u5YnpK2LT9JilnrjsDlnjVB7pt3IC0jm+qgP11Y47MtP4l+Hx3Z65/ztXK
3JY00zBoYSuA7L+BNP6q+0+LSOgjJtJr336lAcpyosFh8v4TTRrx4chLHjp61sF6
OcP3baWtTiLscJ4MKTaTTwIyYfkii+imL/tD9tULoNce0bM9E0g+JBPzfsVR3gpu
bPNvxd6wKHoF1v7tLzoUJsD1pZPfjoI7K8XM2FdVCUtFGWYY/RCWu7KIRjhPlIdC
+7P1HkWjjs4Zt8ncZhcedQsb+lZ/4gUWmLV3K7ZHitAFoCPHBn4=
=tQZM
-----END PGP SIGNATURE-----

O
O
Oleg Pykhalov wrote on 16 Oct 2021 17:06
Re: bug#51141: guix home reconfigure does not apply changes to shepherd services
(name . Andrew Tropin)(address . andrew@trop.in)(address . 51141@debbugs.gnu.org)
87fst180wp.fsf@gmail.com
Hi Andrew,

Andrew Tropin <andrew@trop.in> writes:

Toggle quote (14 lines)
> 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?
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmFq6mYUHGdvLndpZ3Vz
dEBnbWFpbC5jb20ACgkQFn+OpQAa+pw/rg//XMp7YM4c2grdQlnKRlpzVYTrmy7/
WUnByU5fENGUdF6FrTa93NGz7cAnld930m8lPMgKApyBi/G9jX6TP5Oj+FNlX89x
SCAzXpoBhbBBB9wbHmz09OwatKcnLIf98zD9kQyyxxvZY7B3A4gbuP4+RMvZTYUk
46HAEeiGwSq7SEAsx7a9qo1/Mw/wXx+fNyO8ONK5J9Jdkta+o0agZYeatZUzZdfc
vGaXWevqJDbiABCIoCIiqEzamd36vTq4jH7ZseHtnfPF+O5d3KDm1qgmu6/csQG0
ZVIOx3Z/obTvW2M1uE15KVXDM2mkgTAP1fXKEHRVxdc9ntB+bLxHn0ewfsBGMkHJ
zbGG/iB3Fl2umTPiKQ6Cmmsrt3ZvkS7ygTrH08s27HwyLQnNPzbS3/jA2w8oq5lD
TAel487EX15marl9p6k7fRgGN+xjlhigdEbQhr5mVoPb1br2Wz8AG5CbVKzZVBFS
X1qBSUMe6He8w0p1CZI2ndjW9Mi8KjKMdhUrmooiexiQFXOiyo9+g0AWW2ZvF7MG
FXO/7tZNvnW2ARwl7aGWy8NGbUZwsjcvJYrNrPexPcYJa7zxCRbg9t80TeEHr2V3
YBr5I7QsOqRFbwsxeKBTOBHPabxaUzZOpSNJgM7VzOxXEXXwqxrI9+CzAn8nZvVB
XV1kriQ2FdRbpvQ=
=AFHX
-----END PGP SIGNATURE-----

A
A
Andrew Tropin wrote on 18 Oct 2021 12:04
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)(address . 51141@debbugs.gnu.org)
8735oyhcnr.fsf@trop.in
On 2021-10-16 18:06, Oleg Pykhalov wrote:

Toggle quote (29 lines)
> Hi Andrew,
>
> Andrew Tropin <andrew@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:

and how it's implemented in home-shepherd:

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.

Toggle snippet (9 lines)
~ $ 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.

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmFtRqgACgkQIgjSCVjB
3rBxfQ//d/ejTi6yo4hHtk7UzePVZLX9DZuMRM7hnHJWPI2nwRfQ14q4dRtZQwEZ
IryUK3KTxjypx+ZGVDrdRml3QOFmz212Fi9aeLV4vWADynnSeFcSRKLUJHUfPLdZ
/Bk28o4kYR8dXcyEYmCp0rjwONRiiqyj1CcodenWpm1f17vX8ol5AWJqXar46xK7
8EAqxiXQtGwcdST64Ic7/A7to6Sd63izz7e1zfmB+GX4iiFDSOsNUtfO5NuA5AsA
+G9JK/HI3aFA9UUWFFpzfdCDHPipWvXzspaiF2C03aFkz7dr0vGfsZ197IYTHlW+
1/sT5Jb2uA4BRufNoJtYC/AGj3TxEN1Vfi97q2erOebYFYRB1DBec3OM9DYwU8zB
pOlbOlyXLIj9N3bpeSQA2HJLhm8f8v4JFg0B7a3fn3QImmF2bOhk8hVLx0Jkc/fA
+0sAj8BgTClKX0eXUBdG5r//Fe0bq9AwZ1Xn8kLvGbRJ5CDN1PSrPHJ1MbNqk/NT
/d3A4cYYS0vC6CKLq9XwOnke1aGLbv17OB3b4SbpaCUqR1R8zmg19ybegUU9kHEr
ZVK9KNPF6fbPq9w103OAcOhebOHRmZsNwWQP2c6DDNSKyRzeyNTx6gBzCgZfXRNs
AJDOviItRpTS+e2Vz05HmG+5sQrUxrE95k8z4DJE8X+Zr+Q/hQY=
=joGb
-----END PGP SIGNATURE-----

O
O
Oleg Pykhalov wrote on 22 Oct 2021 01:32
(name . Andrew Tropin)(address . andrew@trop.in)(address . 51141@debbugs.gnu.org)
878rymt0m4.fsf@gmail.com
Andrew Tropin <andrew@trop.in> writes:

[…]

Toggle quote (8 lines)
> 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.

Toggle quote (13 lines)
> 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


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



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


If I remove the guix-delete-generations service from home configuration,
mcron job still exists according to 'herd schedule mcron'.
Toggle snippet (6 lines)
(home-environment
(services
(list (service guix-delete-generations-service-type ;; ...
))))

Oleg.
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmFx+KMUHGdvLndpZ3Vz
dEBnbWFpbC5jb20ACgkQFn+OpQAa+pz/DQ/+M3VbM5O3X1Fu4nQmBkt4j2L61vHC
zisO/DlZ7YwOJZkgfG0uBA3Fir55MwhJhmBDlOh5bWGzK+rxHa0xFaaALTqKXcpk
PLlgHBmq9qCJBdeMJX2T4whc6Zi9Ufnow1/pO/kQRfFwSbGGKB8F2dYud/rs89KZ
xinId2Y7zRY0HhR/MCGDVbKXFipAvyBw5Z9nYR1vfLkd2RmFuHdfiY+KI366iQ92
qfVTL3GMMJBNu2M9pciRi8vbMTz67C8VJNZy29W5gk6OmS8i5SSO/K7fJjBJJsmR
tbfaOWKapJnYwA6GBc7XrJ3oqag5ZflfyiUojjzCnlr4pRbWPncoIqmLz+gtoGik
znH3kNt8h55ePpL42VsdYZpLUNJ5FNV6LEdb9V6BW7ytBMxxnv5QZzX4ZeSj8D3J
AKRthel5VbZnmNNWLtRS6/SCoDW7+eUj7cwO5ndgly5FA3hfIwqhd8AMg4jnUarz
DAczxTZr0C9nuA8o6Y2OZ3vBxQeWLdZBMw6Gp764JHGJ7WBEn33ytFILJ8y2V9A4
rhMwIVTxPfZsJSUbhdw6cORpZenb0spJzI93XfNgkmrLlHmEWDxmfscE6OQQSHVF
Ycdd4hG3rrCYAOjCVOPiI9AQq8QsXrVPerYbwY88910N4CbdkR0XLOIxbIdB+ojS
rjUBtXG5IMq4wI0=
=m97Q
-----END PGP SIGNATURE-----

A
A
Andrew Tropin wrote on 23 Oct 2021 09:11
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)(address . 51141@debbugs.gnu.org)
87bl3gkyg7.fsf@trop.in
On 2021-10-22 02:32, Oleg Pykhalov wrote:

Toggle quote (30 lines)
> Andrew Tropin <andrew@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).

Toggle quote (5 lines)
>
> (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.

Toggle quote (14 lines)
>
>
> [ 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.

Toggle quote (18 lines)
>
> 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.

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmFztZgACgkQIgjSCVjB
3rCDNg//cfbza8wERHT56rQwiZN60nZ/NOK1MSFgCseazq4XfVath28H3fvHBEY8
vZwJW2JrDgph0+mJ6YyyPkuBszXWJGD+J8i43eQrEwWzzkIuOqVFlESHLHy3D1SK
lUS670xHYW7hdTCjksMs8H7kIycYqES1vsK47PFOGdxlbj0K/BfBqRAAnBi23aPS
0KOzQ8uPVz7poTZWufpIlRQ7CXkTd1vrXY6JBK/1MdIcWSUQ1C5tXMHk0uKWT08G
+r0oBbPQ5L/V7BYVYzYvjqg/mlEAxh0ewSRzh7ebLjo95yVK5xW5VRDzJu9f9qTu
Ne8R8ZJ7tO37T0w7XnlG2UROTbAaG2Vx91s3A6WQvHnFrVtUVXHxtP1/cxd6907K
ughs94fHTEnPXhBLc+49l1xpYa+1QfV+nLaWjr//QB8HlYMihBJ3PQgovR5Rnl4k
iXUcbF3rjX3wyWIRJNWRVL1oOKuNmin9lu4RhJLXLcqWN4Gk45gYeOAYnslrzqHe
qK3Pd53MoKaYkbAFJO/uZWYWN8prsCpQl6qr7lRXoaxJsC3oe8QX/1dZvaRrn8SG
Ikj5Hd7aZ9p/JDQZBO16I6XoUJ6bUy/qxK/1vRzOQSOIgRwBB4WYXQZG+QdeV4FA
ebQJP/8Zbqccv3ATkBGjmGiCY+kTuSRiUE2yQHIResFtZlarhxM=
=2f9C
-----END PGP SIGNATURE-----

?