From: ludo@gnu.org (Ludovic Courtès)
To: "Thompson, David" <dthompson2@worcester.edu>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: [PATCH] system: container: Update to new service API.
Date: Tue, 27 Oct 2015 14:22:47 +0100 [thread overview]
Message-ID: <87k2q8v42g.fsf@gnu.org> (raw)
In-Reply-To: <CAJ=RwfYUjpkiYVT_Aou=c8scQCWBza_b+SwrY8w4ReZ7QYkxHw@mail.gmail.com> (David Thompson's message of "Mon, 26 Oct 2015 20:21:24 -0400")
[-- Attachment #1: Type: text/plain, Size: 417 bytes --]
Sorry, I meant to preserve #:container? behavior but I forgot this bit.
I believe the attached patch provides an Even Greater Way to address the
problem, namely by making the modprobe/firmware thing an optional
service.
Could you try and report back? I tried it in a VM and there’s no
regression.
Besides, we’ll have to make sure ‘guix system extension-graph’ honors
--container.
Ludo’.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 4781 bytes --]
diff --git a/gnu/services.scm b/gnu/services.scm
index d0fe0ad..a02d79e 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -62,6 +62,7 @@
boot-service-type
activation-service-type
activation-service->script
+ %linux-bare-metal-service
etc-service-type
etc-directory
setuid-program-service-type
@@ -202,20 +203,6 @@ file."
(union-build #$output '#$things))
#:modules '((guix build union))))))
-(define (modprobe-wrapper)
- "Return a wrapper for the 'modprobe' command that knows where modules live.
-
-This wrapper is typically invoked by the Linux kernel ('call_modprobe', in
-kernel/kmod.c), a situation where the 'LINUX_MODULE_DIRECTORY' environment
-variable is not set---hence the need for this wrapper."
- (let ((modprobe "/run/current-system/profile/bin/modprobe"))
- (gexp->script "modprobe"
- #~(begin
- (setenv "LINUX_MODULE_DIRECTORY"
- "/run/booted-system/kernel/lib/modules")
- (apply execl #$modprobe
- (cons #$modprobe (cdr (command-line))))))))
-
(define* (activation-service->script service)
"Return as a monadic value the activation script for SERVICE, a service of
ACTIVATION-SCRIPT-TYPE."
@@ -240,8 +227,7 @@ ACTIVATION-SCRIPT-TYPE."
(mlet* %store-monad ((actions (service-activations))
(modules (imported-modules %modules))
- (compiled (compiled-modules %modules))
- (modprobe (modprobe-wrapper)))
+ (compiled (compiled-modules %modules)))
(gexp->file "activate"
#~(begin
(eval-when (expand load eval)
@@ -256,12 +242,6 @@ ACTIVATION-SCRIPT-TYPE."
(activate-/bin/sh
(string-append #$(canonical-package bash) "/bin/sh"))
- ;; Tell the kernel to use our 'modprobe' command.
- (activate-modprobe #$modprobe)
-
- ;; Let users debug their own processes!
- (activate-ptrace-attach)
-
;; Run the services' activation snippets.
;; TODO: Use 'load-compiled'.
(for-each primitive-load '#$actions)
@@ -287,6 +267,41 @@ ACTIVATION-SCRIPT-TYPE."
;; receives.
(service activation-service-type #t))
+(define %modprobe-wrapper
+ ;; Wrapper for the 'modprobe' command that knows where modules live.
+ ;;
+ ;; This wrapper is typically invoked by the Linux kernel ('call_modprobe',
+ ;; in kernel/kmod.c), a situation where the 'LINUX_MODULE_DIRECTORY'
+ ;; environment variable is not set---hence the need for this wrapper.
+ (let ((modprobe "/run/current-system/profile/bin/modprobe"))
+ (program-file "modprobe"
+ #~(begin
+ (setenv "LINUX_MODULE_DIRECTORY"
+ "/run/booted-system/kernel/lib/modules")
+ (apply execl #$modprobe
+ (cons #$modprobe (cdr (command-line))))))))
+
+(define %linux-kernel-activation
+ ;; Activation of the Linux kernel running on the bare metal (as opposed to
+ ;; running in a container.)
+ #~(begin
+ ;; Tell the kernel to use our 'modprobe' command.
+ (activate-modprobe #$%modprobe-wrapper)
+
+ ;; Let users debug their own processes!
+ (activate-ptrace-attach)))
+
+(define linux-bare-metal-service-type
+ (service-type (name 'linux-bare-metal)
+ (extensions
+ (list (service-extension activation-service-type
+ (const %linux-kernel-activation))))))
+
+(define %linux-bare-metal-service
+ ;; The service that does things that are needed on the "bare metal", but not
+ ;; necessary or impossible in a container.
+ (service linux-bare-metal-service-type #f))
+
(define (etc-directory service)
"Return the directory for SERVICE, a service of type ETC-SERVICE-TYPE."
(files->etc-directory (service-parameters service)))
diff --git a/gnu/system.scm b/gnu/system.scm
index aa76882..de85156 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -290,7 +290,8 @@ a container or that of a \"bare metal\" system."
;; container.
(if container?
'()
- (list (service firmware-service-type
+ (list %linux-bare-metal-service
+ (service firmware-service-type
(operating-system-firmware os))))))))
(define* (operating-system-services os #:key container?)
next prev parent reply other threads:[~2015-10-27 13:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-27 0:19 [PATCH] system: container: Update to new service API David Thompson
2015-10-27 0:21 ` Thompson, David
2015-10-27 13:22 ` Ludovic Courtès [this message]
2015-10-29 4:19 ` Thompson, David
2015-10-29 22:00 ` Ludovic Courtès
2015-10-30 0:58 ` Thompson, David
2015-10-30 16:41 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k2q8v42g.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=dthompson2@worcester.edu \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.