Commit graph

20 commits

Author SHA1 Message Date
Ludovic Courtès
ca81317389
shepherd: Remove ‘make-forkexec-constructor/container’.
This was superseded by ‘least-authority-wrapper’.

* gnu/build/shepherd.scm (read-pid-file/container)
(make-forkexec-constructor/container): Remove.

Change-Id: I6acccdff2609a35807608f865a4d381146113a88
2023-12-22 00:31:42 +01:00
Arun Isaac
3e866e24f0
shepherd: Set #o640 permissions for log file of service in container.
* gnu/build/shepherd.scm (make-forkexec-constructor/container): Set #o640
permissions for log file.
2022-09-02 16:32:16 +05:30
Ludovic Courtès
3682bd4003
Add (guix least-authority).
* guix/least-authority.scm: New file.
* Makefile.am (MODULES): Add it.
* gnu/build/shepherd.scm (default-mounts): Make public.
2022-05-01 21:30:35 +02:00
Leo Nikkilä
e1f0c88ea2
shepherd: Add #:supplementary-groups.
To support the argument introduced in Shepherd 0.9.0 when defining
container-bound services.

* gnu/build/shepherd.scm (exec-command*)
(make-forkexec-constructor/container): Add '#:supplementary-groups'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-04-12 23:40:44 +02:00
Ludovic Courtès
f429596627
shepherd: 'fork+exec-command/container' always returns a PID.
Fixes a regression introduced in
938448bf40 whereby
'fork+exec-command/container' would return #t, then used as the running
value of the 'guix-daemon' service in the installer.  Upon installation
completion, stopping the 'guix-daemon' service would fail with
wrong-type-arg because that #t would be passed to the 'stop' method in
lieu of a PID.

* gnu/build/shepherd.scm (fork+exec-command/container): Return a PID
rather than #t.
2022-04-11 00:25:33 +02:00
Ludovic Courtès
ada530acb1
shepherd: 'exec-command*' has a valid default #:directory.
Fixes a regression introduced in
938448bf40 where 'exec-command*' could
get #:directory #f, in particular when called by
'fork+exec-command/container'.

* gnu/build/shepherd.scm (exec-command*): Add default value for #:directory.
2022-04-11 00:25:33 +02:00
Ludovic Courtès
938448bf40
shepherd: Adjust 'fork+exec-command/container' for the Shepherd 0.9.
* gnu/build/shepherd.scm (exec-command*): New procedure, with code
formerly...
(make-forkexec-constructor/container): ... here.  Use it.
(fork+exec-command/container): Use 'fork+exec-command' only when
CONTAINER-SUPPORT? is false or PID is the current process.
2022-04-07 00:08:55 +02:00
Maxim Cournoyer
5b2b834269
build: shepherd: Use autoload to lazily bind Shepherd modules.
Instead of imperative module-autoload! directives.

* gnu/build/shepherd.scm: Replace module-autoload! directives by autoload
arguments for define-module.
2021-08-02 14:16:22 -04:00
Ludovic Courtès
e6934c0429
shepherd: Remove dependency on (guix utils).
Since commit 8ce6f4dc28, importing this
module in a gexp would pull in (guix config) from the host, thereby
leading to non-reproducible derivations.  Users in (gnu services ...) do
not expect that so simply remove the (guix utils) dependency for now.

* gnu/build/shepherd.scm (fork+exec-command/container)[strip-pid]: New
procedure.
Use it instead of 'strip-keyword-arguments'.
2020-11-05 16:13:50 +01:00
Mathieu Othacehe
6453915cf7
build: shepherd: Check for container support.
Fixes: <https://issues.guix.gnu.org/43533>.

* gnu/build/shepherd.scm (fork+exec-command/container): Check if containers
are supported before joining PID namespaces.
2020-09-21 10:22:12 +02:00
Mathieu Othacehe
8ce6f4dc28
installer: Run the installation inside a container.
When the store overlay is mounted, other processes such as kmscon, udev
and guix-daemon may open files from the store, preventing the
underlying install support from being umounted. See:
https://lists.gnu.org/archive/html/guix-devel/2018-12/msg00161.html.

To avoid this situation, mount the store overlay inside a container,
and run the installation from within that container.

* gnu/build/shepherd.scm (fork+exec-command/container): New procedure.
* gnu/services/base.scm (guix-shepherd-service): Support an optional PID
argument passed to the "start" method. If that argument is passed, ensure that
guix-daemon enters the given PID MNT namespace by using
fork+exec-command/container procedure.
* gnu/installer/final.scm (umount-cow-store): Remove it,
(install-system): run the installation from within a container.
* gnu/installer/newt/final.scm (run-install-shell): Remove the display hack.
2020-09-02 17:05:23 +02:00
Ludovic Courtès
8a02e45d93
shepherd: 'read-pid-file/container' terminates the whole process group.
This mirrors a change made in the Shepherd 0.8.0.  Previously, upon
startup failure, we could have left processes behind.

* gnu/build/shepherd.scm (read-pid-file/container): Kill (- PID) instead
of PID.
2020-06-12 00:04:42 +02:00
Ludovic Courtès
b6b95685d0
shepherd: Unblock signals in the child process.
Fixes <https://bugs.gnu.org/41791>.
Reported by Tobias Geerinckx-Rice <me@tobias.gr>.

This change mirrors changes made in the Shepherd 0.8.1, where signals
are blocked in the shepherd process in support of 'signalfd'.  The
regression was introduced with the switch to 0.8.1 in
3f9c62d1a8: child processes would not
receive SIGTERM upon 'herd stop SERVICE'.

* gnu/build/shepherd.scm <top level>: Autoload (shepherd system).
(make-forkexec-constructor/container): Call call to 'sigaction' and
'unblock-signals'.
2020-06-12 00:04:42 +02:00
Ludovic Courtès
464caf72f9
shepherd: Ensure the log file has correct ownership.
* gnu/build/shepherd.scm (make-forkexec-constructor/container): Ensure
LOG-FILE has correct ownership.
2019-09-26 23:15:28 +02:00
Ludovic Courtès
0d3a4fc867
shepherd: 'make-forkexec-constructor/container' keeps the log file.
* gnu/build/shepherd.scm (make-forkexec-constructor/container): Don't
call 'clean-up' on LOG-FILE.  This mirrors Shepherd commit
6892f638c78a14fedd075f664432757bc015c140.
2019-09-26 23:15:28 +02:00
Ludovic Courtès
5ccec77176
file-systems: Add /var/run/nscd to '%network-file-mappings'.
This allows containers created by "guix environment -CN" or by
"guix system container -N" to talk to the host nscd.

* gnu/system/file-systems.scm (%network-file-mappings): Add
"/var/run/nscd".
* gnu/build/shepherd.scm (default-mounts)[nscd-socket]: Remove.
* gnu/system/linux-container.scm (container-script)[nscd-run-directory]
[nscd-mapping, nscd-os, nscd-specs]: Remove.
[script]: Filter out from SPECS bind-mounts where the device does not
exist.
* guix/scripts/environment.scm (launch-environment/container)
[optional-mapping->fs]: New procedure.
[mappings]: Remove %NETWORK-FILE-MAPPINGS.
[file-systems]: Add %NETWORK-FILE-MAPPINGS here, filtered through
'optional-mapping->fs'.
2019-09-12 23:07:42 +02:00
Ludovic Courtès
78d6d5e8d9
shepherd: Include /etc/localtime in service containers.
Fixes a bug whereby Tor (for example) would emit syslog messages with a
UTC timestamp instead of local time.

* gnu/build/shepherd.scm (default-mounts): Add /etc/localtime to
MAPPINGS.
2019-05-03 17:47:29 +02:00
Ludovic Courtès
9ceeca0880
system: Remove uses of the 'title' field of <file-system>.
* gnu/system/install.scm (installation-os): Remove uses of the 'title'
field of 'file-system'; use 'file-system-label' as appropriate.
* gnu/system/vm.scm (system-disk-image, system-qemu-image): Likewise.
* gnu/tests.scm (%simple-os): Likewise.
* gnu/tests/install.scm (%minimal-os, %minimal-extlinux-os)
(%minimal-os-on-vda, %separate-home-os, %separate-store-os)
(%raid-root-os, %encrypted-root-os, %btrfs-root-os): Likewise.
* gnu/build/shepherd.scm (default-mounts)[tmpfs]: Likewise.
* tests/guix-system.sh: Likewise.
* tests/system.scm (%root-fs): Likewise.
("operating-system-boot-mapped-devices, implicit dependency"): Likewise.
2018-05-28 13:24:19 +02:00
Ludovic Courtès
0cb9c9d170
shepherd: Include /etc/group in service containers.
* gnu/build/shepherd.scm (default-mounts)[passwd]: Rename to...
[accounts]: ... this.  Add /etc/group.
2017-11-22 23:02:35 +01:00
Ludovic Courtès
63302a4e55
Add (gnu build shepherd).
* gnu/build/shepherd.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
2017-02-07 00:08:11 +01:00