summaryrefslogtreecommitdiff
path: root/gnu/services/shepherd.scm
AgeCommit message (Collapse)Author
8 daysservices: shepherd: Support “free-form” services.Ludovic Courtès
* gnu/services/shepherd.scm (<shepherd-service>)[free-form]: New field. [start]: Add default value. (shepherd-service-file): Rename to… (shepherd-service-file/regular): … this. (shepherd-service-file/free-form): New procedure. (shepherd-service-file): Dispatch to one of the two procedures above. * doc/guix.texi (Shepherd Services): Document the ‘free-form’ field. Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Change-Id: I206374e950ef6d1e4a996c0f507fb5fcd9cadde3
2024-05-25services: shepherd: Failure to load a service does not prevent booting.Ludovic Courtès
Fixes <https://issues.guix.gnu.org/71144>. Fixes a bug whereby, when loading a service file would fail, for instance due to an unbound variable, a REPL would be opened on the console, preventing the system from booting. This fixes that by isolating service load errors and making them non-fatal. * gnu/services/shepherd.scm (shepherd-configuration-file)[config]: Remove call to ‘call-with-error-handling’. Use ‘filter-map’ instead of ‘map’ to iterate over service files, and catch exceptions raised by ‘load-compiled’. Change-Id: Ie6e76ea514837f85386232f797bc77b2882b5c22
2024-03-21services: shepherd: Load each service file in a fresh module.Ludovic Courtès
Fixes <https://issues.guix.gnu.org/67649>. * gnu/home/services/shepherd.scm (home-shepherd-configuration-file)[config]: Define ‘make-user-module’. Call ‘load’ in ‘save-module-excursion’. * gnu/services/shepherd.scm (shepherd-configuration-file): Likewise. Reported-by: Attila Lendvai <attila@lendvai.name> Change-Id: I7df11c81b5bbbf2b24a8daa02502a000e0826fe0
2024-01-28services: shepherd: Add respawn-limit and respawn-delay.Attila Lendvai
* gnu/services/shepherd.scm (<shepherd-service>): Add respawn-limit and respawn-delay. (shepherd-service-file): Emit the two values into the shepherd service constructor form. Change-Id: I54408e8fb4bcc0956d9610771bf5c566fdc2914c Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-01-08services: shepherd: Use the 0.10.x GOOPS-less interface.Ludovic Courtès
* gnu/services/shepherd.scm (%default-modules): Remove (oop goops). (shepherd-service-file): Use (service …) instead of (make <service> …). Use ‘actions’ instead of ‘make-actions’. (scm->go): Remove use of (oop goops). (shepherd-configuration-file): Pass ‘register-services’ a list. Use ‘start-in-the-background’ unconditionally. Change-Id: I0ad1ba32e339c56ee31e59f160b53d3581277d97
2024-01-05services: shepherd: Remove ‘dynamic-wind’ in ‘call-with-*-file’.Ludovic Courtès
Fixes <https://issues.guix.gnu.org/64653>. The ‘dynamic-wind’ was causing files to be closed prematurely when leaving the dynamic extent of PROC for instance via a delimited continuation, using Fibers (that ‘dynamic-wind’ call was also semantically incorrect in the first place). * gnu/services/shepherd.scm (shepherd-configuration-file) [config](call-with-file): Remove. (call-with-input-file, call-with-output-file): Rewrite in terms of ‘call-with-port’. Change-Id: Ica8af71a04f525a15be99985552063cb98cd6ee8
2023-06-25services: Validate 'provision' field of <shepherd-service>.Ludovic Courtès
Fixes <https://issues.guix.gnu.org/63979>. * gnu/services/shepherd.scm (validate-provision): New procedure. (<shepherd-service>)[provision]: Use it. Co-authored-by: Bruno Victal <mirai@makinata.eu>
2023-05-13services: shepherd: Default to 0.10.Ludovic Courtès
* gnu/services/shepherd.scm (<shepherd-configuration>)[shepherd]: Default to SHEPHERD-0.10. * gnu/home/services/shepherd.scm (<home-shepherd-configuration>)[shepherd]: Likewise.
2022-11-18services: shepherd: Define 'shepherd-configuration-action' helper.Ludovic Courtès
* gnu/services/shepherd.scm (shepherd-configuration-action): New * doc/guix.texi (Shepherd Services): Document it.
2022-09-29services: shepherd: Leave the finalization thread in peace.Ludovic Courtès
This gets rid of that (in)famous at boot time: error in finalization thread: Success This was caused by the file-descriptor closing loop, which would clause the finalization pipe, leading the finalization thread to (erroneously) error out. Thanks to Josselin Poiret for locating the problem! * gnu/services/shepherd.scm (shepherd-boot-gexp): In 'loop', replace 'close-fdes' with a pair of 'fcntl' calls to add FD_CLOEXEC.
2022-09-13services: shepherd: Install O_CLOEXEC variant of 'call-with-input-file' & co.Ludovic Courtès
Fixes a bug introduced with the Shepherd 0.9.2 upgrade in commit 1ba0e38267c9ff8bb476285091be6e297bbf136e whereby files opened by, say, the 'start' method of 'urandom-seed', could leak into the execution environment of some other service--e.g., 'term-tty4'. * gnu/services/shepherd.scm (shepherd-configuration-file)[config]: Override 'call-with-input-file' and 'call-with-output-file'.
2022-09-11services: shepherd: Open /dev/null as O_CLOEXEC.Ludovic Courtès
Failing to do that, that file descriptor could be inherited by child processes as of Shepherd 0.9.2. * gnu/services/shepherd.scm (shepherd-configuration-file): Open /dev/null as O_CLOEXEC.
2022-04-10services: shepherd: Do not unload transient services.Ludovic Courtès
Fixes <https://issues.guix.gnu.org/54812>. Starting with Shepherd 0.9.0 and the use of 'make-inetd-constructor' in commit 808b9e850491c7b1d867a5f1f4d5ee6f61f345d4, systems might be running transient Shepherd services such as those corresponding to SSH connections. Before this change, 'shepherd-service-upgrade' would have those transient services in the list of services to unload; concretely, that would lead all SSH connections to be closed upon 'guix system reconfigure'. * gnu/services/shepherd.scm (shepherd-service-upgrade): Remove transient services to TO-UNLOAD.
2022-04-07services: shepherd: Default to version 0.9.Ludovic Courtès
* gnu/services/shepherd.scm (scm->go): Define 'shepherd&co' and pass it to 'with-extensions'. (shepherd-configuration-file): Call 'start-in-the-background' when it is defined. (<shepherd-configuration>)[shepherd]: Default to SHEPHERD-0.9. * gnu/system.scm (hurd-default-essential-services): Use SHEPHERD-0.8.
2021-11-30services: Accept <inferior-package>s in lieu of <package>s.Tobias Geerinckx-Rice
* gnu/services/authentication.scm (fprintd-configuration) (nslcd-configuration): Substitute file-like objects for package ones. * gnu/services/cgit.scm (cgit-configuration, opaque-cgit-configuration): Likewise. * gnu/services/cups.scm (package-list?, cups-configuration): Likewise. * gnu/services/dns.scm (verify-knot-configuration) (ddclient-configuration): Likewise. * gnu/services/docker.scm (docker-configuration): Likewise. * gnu/services/file-sharing.scm (transmission-daemon-configuration): Likewise. * gnu/services/getmail.scm (getmail-configuration): Likewise. * gnu/services/mail.scm (dovecot-configuration) (opaque-dovecot-configuration): Likewise. * gnu/services/messaging.scm (prosody-configuration) (opaque-prosody-configuration): Likewise. * gnu/services/monitoring.scm (zabbix-server-configuration) (zabbix-agent-configuration): Likewise. * gnu/services/networking.scm (opendht-configuration): Likewise. * gnu/services/pm.scm (tlp-configuration): Likewise. * gnu/services/telephony.scm (jami-configuration): Likewise. * gnu/services/virtualization.scm (libvirt-configuration) (qemu-guest-agent-configuration): Likewise. * gnu/services/vpn.scm (openvpn-client-configuration): Likewise.
2021-03-03services: shepherd: Make 'assert-valid-graph' public.Andrew Tropin
* gnu/services/shepherd.scm (assert-valid-graph): Make public. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-02-25services: shepherd: Make /run/booted-system a symlink to the store item.Ludovic Courtès
Fixes <https://bugs.gnu.org/46767>. Previously /run/booted-system would end up referring to /var/guix/profiles/system-NNN-link; consequently, the booted system would not be GC-protected. * gnu/services/shepherd.scm (shepherd-boot-gexp): Call 'canonicalize-path' instead of 'readlink'.
2021-01-30services: shepherd: Allow custom 'shepherd' package.Maxime Devos
* gnu/services/shepherd.scm (<shepherd-configuration>): New record. (shepherd-boot-gexp, shepherd-root-service-type): Use it. (scm->go, shepherd-configuration-file): Allow passing custom shepherd package. * gnu/system.scm (operating-system-shepherd-service-names): Use the new record. * guix/scripts/system.scm (export-shepherd-graph): Adjust accordingly. * doc/guix.texi (Shepherd Services). Document it. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2021-01-13services: shepherd: 'shepherd-service-type' requires documentation.Ludovic Courtès
* gnu/services/shepherd.scm (shepherd-service-type): Require a 'description' form. * gnu/services/base.scm (root-file-system-service-type) (rngd-service-type, host-name-service-type): (virtual-terminal-service-type, console-keymap-service-type) (syslog-service-type, swap-service-type) (kmscon-service-type): Add description. * gnu/services/networking.scm (dhcp-client-service-type): Likewise. * gnu/system/install.scm (cow-store-service-type): Likewise. * gnu/system/linux-container.scm (dummy-networking-service-type): Likewise. * gnu/system/mapped-devices.scm (device-mapping-service-type): Likewise. * tests/guix-system.sh: Likewise.
2020-11-18services: shepherd: Map all the invalid store characters to dash.Ludovic Courtès
Fixes a regression introduced in 977eb5d023cfdf8e336f1896480eea9cef5c04e9 whereby file system services would now have a different name. * gnu/services/base.scm (file-system->shepherd-service-name): Revert changes introduced in 977eb5d023cfdf8e336f1896480eea9cef5c04e9. * gnu/services/shepherd.scm (%store-characters): New variable (shepherd-service-file-name): Map all the characters outside %STORE-CHARACTERS to #\-.
2020-06-14services: Add 'hurd-vm service-type'.Jan (janneke) Nieuwenhuizen
* gnu/services/virtualization.scm (hurd-vm-shepherd-service, hurd-vm-disk-image): New procedures. (%hurd-vm-operating-system, hurd-vm-service-type): New variables. (<hurd-vm-configuration>): New record type. * doc/guix.texi (Virtualization Services): Document it. * gnu/services/shepherd.scm (scm->go): Use let-system, remove FIXME. Fixes fixes cross-building of shepherd modules for the Hurd image.
2020-05-16services: shepherd: Silence Guile warnings.Ludovic Courtès
This avoids: WARNING: …: imported module (guix build utils) overrides core binding `delete' * gnu/services/shepherd.scm (%default-modules): #:hide 'delete' from (guix build utils). (shepherd-configuration-file)[config]: Wrap calls to 'load-compiled' in 'parameterize'.
2020-05-08Merge branch 'core-updates'Marius Bakke
2020-05-08services: Add descriptions.Ludovic Courtès
* gnu/services/dbus.scm (polkit-service-type)[description]: New field. * gnu/services/dict.scm (dicod-service-type)[description]: New field. * gnu/services/dns.scm (knot-service-type)[description]: New field. * gnu/services/networking.scm (dhcpd-service-type)[description]: New field. * gnu/services/shepherd.scm (shepherd-root-service-type)[description]: New field. * gnu/services/xorg.scm (slim-service-type)[description]: New field. (screen-locker-service-type)[description]: New field. * gnu/system/pam.scm (pam-root-service-type)[description]: New field. * gnu/system/shadow.scm (account-service-type)[description]: New field.
2020-04-25services: shepherd: Cross-compilation fix.Jan (janneke) Nieuwenhuizen
Fixes <https://bugs.gnu.org/40839>. Reported by Jan (janneke) Nieuwenhuizen <janneke@gnu.org> Fix suggested by Mathieu Othacehe <m.othacehe@gmail.com> However, <https://bugs.gnu.org/29296> still applies; %current-target-system may not be bound. * gnu/services/shepherd.scm (scm->go): Use `with-target' when cross-compiling.
2020-04-21gnu: shepherd: Update to 0.8.0.Ludovic Courtès
* gnu/packages/admin.scm (shepherd): Update to 0.8.0. * gnu/services/shepherd.scm (shepherd-configuration-file): Use 'default-pid-file-timeout' instead of fiddling with '%pid-file-timeout'.
2020-04-17services: Move 'user-processes' to (gnu services shepherd).Ludovic Courtès
* gnu/services/base.scm (%do-not-kill-file) (user-processes-shepherd-service, user-processes-service-type): Move to... * gnu/services/shepherd.scm: ... here.
2020-04-15services: shepherd: Increase the PID file timeout to 30s.Ludovic Courtès
When running the installation image off a DVD, early I/O operations are extremely slow, to the point that something like dbus-daemon would need ~20s to start. This change works around the issue. Fixes <https://bugs.gnu.org/40572>. Reported by Florian Pelz <pelzflorian@pelzflorian.de>. * gnu/services/shepherd.scm (shepherd-configuration-file): Set %pid-file-timeout to 30.
2020-03-29services: shepherd: Mark '.go' derivations as non-substitutable.Ludovic Courtès
* gnu/services/shepherd.scm (scm->go): Pass #:options to 'computed-file'.
2020-02-16services: shepherd: Spawn services with nothing but the PATH variable.Ludovic Courtès
Previously, services spawned with 'make-forkexec-constructor' & co. would all inherit the environment variables of PID 1, which includes things like 'BOOT_IMAGE'. This change resets it to the bare minimum. * gnu/services/shepherd.scm (shepherd-configuration-file): Add call to 'default-environment-variables'. Remove 'setenv' call.
2019-10-06services: shepherd: Compile service files.Ludovic Courtès
This reduces resident memory for PID 1 from 29.8MiB to 28.7MiB right after boot on a bare-bones system (x86_64-linux). * gnu/services/shepherd.scm (scm->go): New procedure. (shepherd-configuration-file)[config]: Call it and use 'load-compiled' instead of 'primitive-load'.
2019-04-23linux-container: Remove '%containerized-shepherd-service' hack.Ludovic Courtès
This hack worked around a defect in the Shepherd 0.5.0 and is no longer needed. * gnu/services/shepherd.scm (%containerized-shepherd-service): Remove. * gnu/system/linux-container.scm (container-essential-services): Don't use it.
2019-04-23services: shepherd: Support one-shot services.Ludovic Courtès
* gnu/services/shepherd.scm (<shepherd-service>)[one-shot?]: New field. (shepherd-service-file): Pass #:one-shot? to the <service> constructor. * doc/guix.texi (Shepherd Services): Document it.
2018-12-18file-systems: Spawn a REPL only when interaction is possible.Ludovic Courtès
Fixes <https://bugs.gnu.org/23697>. Reported by Jan Nieuwenhuizen <janneke@gnu.org>. * gnu/build/file-systems.scm (check-file-system): Call 'start-repl' only if current-input-port passes 'isatty?'. * gnu/services/shepherd.scm (shepherd-configuration-file): After 'for-each' expression, call 'redirect-port'. * gnu/tests/base.scm (run-basic-test)["stdin is /dev/null"]: New test.
2018-09-26services: shepherd: Add workaround for 0.5.0 in containers.Ludovic Courtès
* gnu/services/shepherd.scm (%containerized-shepherd-service): New service. * gnu/system.scm (essential-services): Use it when CONTAINER? is true.
2018-09-26guix system: Load all services on reconfigure, not just stopped ones.Carlo Zancanaro
This uses the 'replacement' service slot introduced in the Shepherd version 0.5.0. * gnu/services/shepherd.scm (shepherd-service-upgrade): Return a list of services that need to be restarted to complete their upgrade. * guix/scripts/system.scm (call-with-service-upgrade-info): Rename an internal variable to reflect the change to shepherd-service-upgrade. (upgrade-shepherd-services): Call 'load-services/safe' instead of 'load-services'. Print a message about services that need to be manually restarted. * gnu/services/herd.scm (load-services/safe): New procedure. * doc/guix.texi (Invoking guix system): Document the new behaviour. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2018-07-13services: shepherd: Support custom actions.Ludovic Courtès
* gnu/services/shepherd.scm (<shepherd-service>)[actions]: New field. (<shepherd-action>): New record type. (shepherd-service-file): Pass #:actions to 'make'. * doc/guix.texi (Shepherd Services): Document custom actions.
2018-06-20services: boot: Take gexps instead of monadic gexps.Ludovic Courtès
* gnu/services.scm (compute-boot-script): Rename 'mexps' to 'gexps' and remove 'mlet' form. (boot-service-type): Update comment. (cleanup-gexp): Remove 'with-monad' and 'return'. (activation-script): Rewrite in non-monadic style: use 'scheme-file' instead of 'gexp->file'. (gexps->activation-gexp): Remove 'mlet', return a gexp. * gnu/services/shepherd.scm (shepherd-boot-gexp): Remove 'with-monad' and 'return'. * gnu/system.scm (operating-system-boot-script): Remove outdated comment. * gnu/tests/base.scm (%cleanup-os): For 'dirty-service', remove 'with-monad' and 'return'.
2018-03-15services: 'shepherd-service-type' now accepts a default value.Ludovic Courtès
* gnu/services/shepherd.scm (shepherd-service-type): Add a second form with an additional 'default' parameter.
2018-01-21services: shepherd: Make 'shepherd-configuration-file' non-monadic.Ludovic Courtès
Suggested by atw on #guix. * gnu/services/shepherd.scm (shepherd-service-file): Use 'scheme-file' instead of 'gexp->file'. (shepherd-configuration-file): Likewise, and adjust to non-monadic style. (shepherd-boot-gexp): Adjust accordingly. * guix/scripts/system.scm (upgrade-shepherd-services): Use 'lower-object' in addition to 'shepherd-service-file'.
2017-05-03ui: Rename '_' to 'G_'.Ludovic Courtès
This avoids collisions with '_' when the latter is used as a 'match' pattern for instance. See <https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>. * guix/ui.scm: Rename '_' to 'G_'. * po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly. * build-aux/compile-all.scm (warnings): Remove 'format'. * gnu/packages.scm, gnu/services.scm, gnu/services/shepherd.scm, gnu/system.scm, gnu/system/shadow.scm, guix/gnupg.scm, guix/http-client.scm, guix/import/cpan.scm, guix/import/elpa.scm, guix/import/pypi.scm, guix/nar.scm, guix/scripts.scm, guix/scripts/archive.scm, guix/scripts/authenticate.scm, guix/scripts/build.scm, guix/scripts/challenge.scm, guix/scripts/container.scm, guix/scripts/container/exec.scm, guix/scripts/copy.scm, guix/scripts/download.scm, guix/scripts/edit.scm, guix/scripts/environment.scm, guix/scripts/gc.scm, guix/scripts/graph.scm, guix/scripts/hash.scm, guix/scripts/import.scm, guix/scripts/import/cpan.scm, guix/scripts/import/cran.scm, guix/scripts/import/crate.scm, guix/scripts/import/elpa.scm, guix/scripts/import/gem.scm, guix/scripts/import/gnu.scm, guix/scripts/import/hackage.scm, guix/scripts/import/nix.scm, guix/scripts/import/pypi.scm, guix/scripts/import/stackage.scm, guix/scripts/lint.scm, guix/scripts/offload.scm, guix/scripts/pack.scm, guix/scripts/package.scm, guix/scripts/perform-download.scm, guix/scripts/publish.scm, guix/scripts/pull.scm, guix/scripts/refresh.scm, guix/scripts/size.scm, guix/scripts/substitute.scm, guix/scripts/system.scm, guix/ssh.scm, guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-02-08services: shepherd: Replace spaces with hyphens in file names.Clément Lassieur
This fixes a bug whereby names of files defining services would be invalid if 'provisions' contained more than one element. * gnu/services/shepherd.scm (shepherd-service-file-name): Update 'match-lambda' accordingly. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2016-12-19services: Use 'file-append' in more places.Ludovic Courtès
* gnu/services/avahi.scm (avahi-shepherd-service): Use #$(file-append x y) instead of (string-append #$x y). * gnu/services/base.scm (unicode-start) (console-keymap-service-type, console-font-shepherd-services) (mingetty-shepherd-service, nscd-shepherd-service) (hydra-key-authorization, guix-shepherd-service) (guix-publish-shepherd-service, udev-shepherd-service) (gpm-shepherd-service, <kmscon-configuration>) (kmscon-service-type): Likewise. * gnu/services/shepherd.scm (shepherd-boot-gexp): Likewise.
2016-08-31services: shepherd: Add 'shepherd-service-upgrade', from 'guix system'.Ludovic Courtès
* guix/scripts/system.scm (service-upgrade): Move to... * gnu/services/shepherd.scm (shepherd-service-upgrade): ... here. * tests/system.scm ("service-upgrade: nothing to do", "service-upgrade: one unchanged, one upgraded, one new", "service-upgrade: service depended on is not unloaded", "service-upgrade: obsolete services that depend on each other"): Move to... * tests/services.scm: ... here. Adjust to 'service-upgrade' rename.
2016-08-31services: shepherd: Parameterize 'shepherd-service-back-edges'.Ludovic Courtès
* gnu/services/shepherd.scm (shepherd-service-back-edges): Add #:provision and #:requirement parameter. Honor them.
2016-08-31services: shepherd: Add 'shepherd-service-lookup-procedure'.Ludovic Courtès
* gnu/services/shepherd.scm (shepherd-service-lookup-procedure): New procedure. (shepherd-service-back-edges)[provision->service]: Use it. * tests/services.scm ("shepherd-service-lookup-procedure"): New test.
2016-07-19services: shepherd: Clarify error message about missing service.Ludovic Courtès
Suggested by Tobias Geerinckx-Rice <me@tobias.gr>. * gnu/services/shepherd.scm (assert-valid-graph)[assert-satisfied-requirements]: Clarify error message.
2016-07-12services: <shepherd-service> no longer has an 'imported-modules' field.Ludovic Courtès
* gnu/services/shepherd.scm (<shepherd-service>)[imported-modules]: Remove. (%default-imported-modules): Make private. (shepherd-service-file): Use 'with-imported-modules'. (shepherd-configuration-file): Remove 'modules' and the calls to 'imported-modules' and 'compiled-modules'. Use 'with-imported-modules' instead. * doc/guix.texi (Shepherd Services): Adjust accordingly. * gnu/services/base.scm (file-system-shepherd-service): Use 'with-imported-modules'. Remove 'imported-modules' field. * gnu/system/mapped-devices.scm (device-mapping-service-type): Remove 'imported-modules'. (open-luks-device): Use 'with-imported-modules'. * gnu/tests.scm (marionette-shepherd-service): Remove 'imported-modules' field and use 'with-imported-modules'.
2016-02-05service: shepherd: All of the config file is in 'call-with-error-handling'.Ludovic Courtès
* gnu/services/shepherd.scm (shepherd-configuration-file)[config]: Wrap all the body in 'call-with-error-handling'.
2016-02-05service: shepherd: Guard against exceptions raised by 'start'.Ludovic Courtès
Fixes <http://bugs.gnu.org/22548>. Reported by Albin <albin@fripost.org>, Mark H Weaver, and Alex Kost. * gnu/services/shepherd.scm (shepherd-configuration-file)[config]: Guard against 'service-error?'.