From unknown Fri Jun 20 07:12:43 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#41785 <41785@debbugs.gnu.org> To: bug#41785 <41785@debbugs.gnu.org> Subject: Status: [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. Reply-To: bug#41785 <41785@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:12:43 +0000 retitle 41785 [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. reassign 41785 guix-patches submitter 41785 "Jan (janneke) Nieuwenhuizen" severity 41785 normal tag 41785 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 10 04:55:00 2020 Received: (at submit) by debbugs.gnu.org; 10 Jun 2020 08:55:01 +0000 Received: from localhost ([127.0.0.1]:33401 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jiwVc-0005kR-1r for submit@debbugs.gnu.org; Wed, 10 Jun 2020 04:55:00 -0400 Received: from lists.gnu.org ([209.51.188.17]:42948) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jiwVa-0005kK-2p for submit@debbugs.gnu.org; Wed, 10 Jun 2020 04:54:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiwVZ-0005vB-QI for guix-patches@gnu.org; Wed, 10 Jun 2020 04:54:53 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36913) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiwVY-0000Tk-OA; Wed, 10 Jun 2020 04:54:52 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=39350 helo=dundal.fritz.box) by fencepost.gnu.org with esmtpa (Exim 4.82) (envelope-from ) id 1jiwVY-0005Kp-F8; Wed, 10 Jun 2020 04:54:52 -0400 From: "Jan (janneke) Nieuwenhuizen" To: guix-patches@gnu.org Subject: [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. Date: Wed, 10 Jun 2020 10:54:41 +0200 Message-Id: <20200610085441.890-1-janneke@gnu.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) TODO: Figure-out how to run this hurd VM inside a VM. Using --8<---------------cut here---------------start------------->8--- diff --git a/gnu/system/examples/bare-bones.tmpl b/gnu/system/examples/bare-bones.tmpl index 1035ab1d60..40fb354ea4 100644 --- a/gnu/system/examples/bare-bones.tmpl +++ b/gnu/system/examples/bare-bones.tmpl @@ -5,6 +5,8 @@ (use-service-modules networking ssh) (use-package-modules screen ssh) +(use-service-modules hurd virtualization) + (operating-system (host-name "komputilo") (timezone "Europe/Berlin") @@ -44,8 +46,12 @@ ;; Add services to the baseline: a DHCP client and ;; an SSH server. (services (append (list (service dhcp-client-service-type) + (service hurd-in-vm-service-type) (service openssh-service-type (openssh-configuration (openssh openssh-sans-x) - (port-number 2222)))) + (port-number 2222) + (permit-root-login #t) + (allow-empty-passwords? #t) + (password-authentication? #t)))) %base-services))) diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm index 441b1eb7e0..e3560b80b7 100644 --- a/gnu/services/virtualization.scm +++ b/gnu/services/virtualization.scm @@ -878,7 +878,7 @@ functionality of the kernel Linux."))) (define vm-command #~(list (string-append #$qemu "/bin/qemu-system-i386") - #$@(if (file-exists? "/dev/kvm") '("-enable-kvm") '()) + ;;huh? breaks hurd in bare-bones VM #$@(if (file-exists? "/dev/kvm") '("-enable-kvm") '()) "-m" (number->string #$memory-size) #$@options #+image)) --8<---------------cut here---------------end--------------->8--- and doing something like ./pre-inst-env guix system vm gnu/system/examples/bare-bones.tmpl --no-offload /gnu/store/96wh3jwsla4p6d4s547mmqxsi4qbbc0r-run-vm.sh -m 2G \ --device rtl8139,netdev=net0 \ --netdev user,id=net0,hostfwd=tcp:127.0.0.1:10022-:2222,hostfwd=tcp:127.0.0.1:5900-:5900 nicely starts a bare-bones VM with the the hurd-in-vm service inside, but I cannot seem to connect to the Hurd VM it in any way. Appending ",hostfwd=tcp:127.0.0.1:20022-:20022" (to directly ssh into the Hurd) even blocks me from ssh'ing into the GNU/linux host VM. hurd-in-vm works beautifully when added to my system configuration and reconfiguring. * gnu/services/virtualization.scm (disk-image, hurd-in-vm-shepherd-service, hurd-vm-disk-image): New procedures. (%hurd-in-vm-operating-system, hurd-in-vm-service-type): New variable. (): New record type. * doc/guix.texi (Virtualization Services): Document it. --- doc/guix.texi | 61 ++++++++++++++ gnu/services/virtualization.scm | 140 ++++++++++++++++++++++++++++++-- 2 files changed, 194 insertions(+), 7 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 15e077a41c..cae77288f4 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -24583,6 +24583,67 @@ Return true if @var{obj} is a platform object. Return the name of @var{platform}---a string such as @code{"arm"}. @end deffn + +@subsubheading The Hurd in a Virtual Machine + +@cindex @code{hurd} +@cindex the Hurd + +Service @code{hurd-in-vm} provides support for running a Virtual Machine +with the GNU@tie{}Hurd. + +@defvr {Scheme Variable} hurd-in-vm-service-type +This is the type of the Hurd in a Virtual Machine service. Its value +must be a @code{hurd-in-vm-configuration} object, which specifies the +operating system (@pxref{operating-system Reference}) and the disk size +for the Hurd Virtual Machine, the QEMU package to use as well as the +options for running it. + +For example: + +@lisp +(service hurd-in-vm-service-type + (hurd-in-vm-configuration + (disk-size (* 5000 (expt 2 20))) ;5G + (memory-size 1024))) ;1024MiB +@end lisp + +would create a disk image big enough to build GNU@tie{}Hello, with some +extra memory. +@end defvr + +@deftp {Data Type} hurd-in-vm-configuration +The data type representing the configuration for +@code{hurd-in-vm-service-type}. + +@table @asis +@item @code{os} (default: @var{%hurd-in-vm-operating-system}) +The operating system to instantiate. This default is bare-bones with a +permissive OpenSSH secure shell daemon listening on port 2222 +(@pxref{Networking Services, @code{openssh-service-type}}). + +@item @code{qemu} (default: @code{qemu-minimal}) +The QEMU package to use. + +@item @code{image} (default: @var{hurd-vm-disk-image}) +The procedure used to build the disk-image built from this +configuration. + +@item @code{disk-size} (default: @code{'guess}) +The size of the disk image. + +@item @code{memory-size} (default: @code{512}) +The memory size of the Virtual Machine in mebibytes. + +@item @code{options} (default: @code{'("--device"} @code{"rtl8139,netdev=net0"} @ + @code{"--netdev"} @ + @code{"user,id=net0,hostfwd=tcp:127.0.0.1:20022-:2222,hostfwd=tcp:127.0.0.1:25900-:5900"} @ + @code{"--snapshot"} @ + @code{"--hda")}) +The extra options for running QEMU. +@end table +@end deftp + @node Version Control Services @subsection Version Control Services diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm index 989e439d5d..441b1eb7e0 100644 --- a/gnu/services/virtualization.scm +++ b/gnu/services/virtualization.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Ryan Moe ;;; Copyright © 2018 Ludovic Courtès +;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,24 +19,41 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu services virtualization) - #:use-module (gnu services) - #:use-module (gnu services configuration) + #:use-module (gnu bootloader) + #:use-module (gnu bootloader grub) + #:use-module (gnu image) + #:use-module (gnu packages admin) + #:use-module (gnu packages ssh) + #:use-module (gnu packages virtualization) #:use-module (gnu services base) + #:use-module (gnu services configuration) #:use-module (gnu services dbus) #:use-module (gnu services shepherd) - #:use-module (gnu system shadow) + #:use-module (gnu services ssh) + #:use-module (gnu services) #:use-module (gnu system file-systems) - #:use-module (gnu packages admin) - #:use-module (gnu packages virtualization) - #:use-module (guix records) + #:use-module (gnu system hurd) + #:use-module (gnu system image) + #:use-module (gnu system shadow) + #:use-module (gnu system) + #:use-module (guix derivations) #:use-module (guix gexp) + #:use-module (guix monads) #:use-module (guix packages) + #:use-module (guix records) + #:use-module (guix store) + #:use-module (guix utils) + #:use-module (srfi srfi-9) #:use-module (srfi srfi-26) #:use-module (rnrs bytevectors) #:use-module (ice-9 match) - #:export (libvirt-configuration + #:export (%hurd-in-vm-operating-system + hurd-in-vm-configuration + hurd-in-vm-service-type + + libvirt-configuration libvirt-service-type virtlog-configuration virtlog-service-type @@ -773,3 +791,111 @@ given QEMU package." "This service supports transparent emulation of binaries compiled for other architectures using QEMU and the @code{binfmt_misc} functionality of the kernel Linux."))) + + +;;; +;;; The Hurd in VM service. +;;; + +(define* (disk-image os #:key (image-size 'guess) target) + "Return a disk-image for OS with size IMAGE-SIZE, built for TARGET." + (with-store store + (run-with-store store + (let ((file-system-type "ext2")) + (mlet* %store-monad + ((base-image (find-image file-system-type)) + (sys (lower-object + (system-image + (image + (inherit base-image) + (size image-size) + (operating-system os))))) + (drvs (mapm/accumulate-builds lower-object (list sys))) + (% (built-derivations drvs))) + (let ((output (derivation->output-path sys))) + (return output)))) + #:target target))) + +(define %hurd-in-vm-operating-system + (operating-system + (inherit %hurd-default-operating-system) + (host-name "guixydevel") + (timezone "Europe/Amsterdam") + (bootloader (bootloader-configuration + (bootloader grub-minimal-bootloader) + (target "/dev/vda") + (timeout 0))) + (services (cons* + (service openssh-service-type + (openssh-configuration + (openssh openssh-sans-x) + (use-pam? #f) + (port-number 2222) + (permit-root-login #t) + (allow-empty-passwords? #t) + (password-authentication? #t))) + %base-services/hurd)))) + +(define-record-type* + hurd-in-vm-configuration make-hurd-in-vm-configuration + hurd-in-vm-configuration? + (os hurd-in-vm-configuration-os ; + (default %hurd-in-vm-operating-system)) + (qemu hurd-in-vm-configuration-qemu ; + (default qemu-minimal)) + (image hurd-in-vm-configuration-image ;string + (thunked) + (default (hurd-vm-disk-image this-record))) + (disk-size hurd-in-vm-configuration-disk-size ;number or 'guess + (default 'guess)) + (memory-size hurd-in-vm-configuration-memory-size ;number + (default 512)) + (options hurd-in-vm-configuration-options ;list of string + (default + `("--device" "rtl8139,netdev=net0" + "--netdev" (string-append + "user,id=net0" + ",hostfwd=tcp:127.0.0.1:20022-:2222" + ",hostfwd=tcp:127.0.0.1:25900-:5900") + "--snapshot" + "--hda")))) + +(define (hurd-vm-disk-image config) + "Return a disk-image for the Hurd according to CONFIG." + (let ((os (hurd-in-vm-configuration-os config)) + (disk-size (hurd-in-vm-configuration-disk-size config)) + (target (and (not (%current-target-system)) "i586-pc-gnu"))) + (disk-image os #:target target #:image-size disk-size))) + +(define (hurd-in-vm-shepherd-service config) + "Return a for a Hurd in a Virtual Machine with CONFIG." + + (let ((image (hurd-in-vm-configuration-image config)) + (qemu (hurd-in-vm-configuration-qemu config)) + (memory-size (hurd-in-vm-configuration-memory-size config)) + (options (hurd-in-vm-configuration-options config))) + + (define vm-command + #~(list + (string-append #$qemu "/bin/qemu-system-i386") + #$@(if (file-exists? "/dev/kvm") '("-enable-kvm") '()) + "-m" (number->string #$memory-size) + #$@options + #+image)) + + (list + (shepherd-service + (documentation "Run the Hurd in a Virtual Machine.") + (provision '(hurd-in-vm)) + (requirement '(networking)) + (start #~(make-forkexec-constructor #$vm-command)) + (stop #~(make-kill-destructor)))))) + +(define hurd-in-vm-service-type + (service-type + (name 'hurd-in-vm) + (extensions (list (service-extension shepherd-root-service-type + hurd-in-vm-shepherd-service))) + (default-value (hurd-in-vm-configuration)) + (description + "Provide a Virtual Machine running the GNU Hurd."))) -- Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 10 07:34:15 2020 Received: (at 41785) by debbugs.gnu.org; 10 Jun 2020 11:34:15 +0000 Received: from localhost ([127.0.0.1]:33515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jiyzn-0003SI-8m for submit@debbugs.gnu.org; Wed, 10 Jun 2020 07:34:15 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60098) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jiyzk-0003S4-TU for 41785@debbugs.gnu.org; Wed, 10 Jun 2020 07:34:13 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:38539) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiyze-00067F-SA; Wed, 10 Jun 2020 07:34:06 -0400 Received: from lfbn-ann-1-136-86.w86-200.abo.wanadoo.fr ([86.200.104.86]:46146 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jiyzd-0002I0-9J; Wed, 10 Jun 2020 07:34:05 -0400 From: Mathieu Othacehe To: "Jan \(janneke\) Nieuwenhuizen" Subject: Re: [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. References: <20200610085441.890-1-janneke@gnu.org> Date: Wed, 10 Jun 2020 13:34:01 +0200 In-Reply-To: <20200610085441.890-1-janneke@gnu.org> (Jan Nieuwenhuizen's message of "Wed, 10 Jun 2020 10:54:41 +0200") Message-ID: <87r1unm9xy.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: 41785@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello Jan, > TODO: Figure-out how to run this hurd VM inside a VM. Just to clarify things here, we now have the "disk-image" command that produces a Hurd bootable disk-image. The "vm-image" command is almost working, and should produce a very similar result. The "vm" command that produces a vm-image and spawns a VM isn't working yet with the Hurd. This command is for now passing directly "kernel" and "initrd" arguments to QEMU, so a few adaptations will be needed. Now the goad of hurd-in-vm-service-type is to provide a service that does almost the same thing as the "vm" command, but as a service, right? So, I don't get why would we need to run a Hurd VM inside a VM. I've been struggling a lot with running nested layers of virtualization (for system generation before the recent patches), and the result is often too slow to be really usable. Thanks, Mathieu From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 11 15:43:39 2020 Received: (at 41785) by debbugs.gnu.org; 11 Jun 2020 19:43:40 +0000 Received: from localhost ([127.0.0.1]:38156 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjT6x-00064O-O7 for submit@debbugs.gnu.org; Thu, 11 Jun 2020 15:43:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45064) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjT6w-00064B-Bi for 41785@debbugs.gnu.org; Thu, 11 Jun 2020 15:43:38 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40157) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjT6q-0000Od-9i; Thu, 11 Jun 2020 15:43:32 -0400 Received: from [2a01:e0a:1d:7270:6a6c:dc17:fc02:cfda] (port=52102 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jjT6o-0001zL-V8; Thu, 11 Jun 2020 15:43:31 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Mathieu Othacehe Subject: Re: [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. References: <20200610085441.890-1-janneke@gnu.org> <87r1unm9xy.fsf@gnu.org> Date: Thu, 11 Jun 2020 21:43:28 +0200 In-Reply-To: <87r1unm9xy.fsf@gnu.org> (Mathieu Othacehe's message of "Wed, 10 Jun 2020 13:34:01 +0200") Message-ID: <87tuzh9yn3.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: 41785@debbugs.gnu.org, "Jan \(janneke\) Nieuwenhuizen" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Mathieu Othacehe skribis: > Just to clarify things here, we now have the "disk-image" command that > produces a Hurd bootable disk-image. The "vm-image" command is almost > working, and should produce a very similar result. > > The "vm" command that produces a vm-image and spawns a VM isn't working > yet with the Hurd. This command is for now passing directly "kernel" and > "initrd" arguments to QEMU, so a few adaptations will be needed. > > Now the goad of hurd-in-vm-service-type is to provide a service that > does almost the same thing as the "vm" command, but as a service, right? That=E2=80=99s my understanding. > So, I don't get why would we need to run a Hurd VM inside a VM. I've > been struggling a lot with running nested layers of virtualization (for > system generation before the recent patches), and the result is often > too slow to be really usable. I guess it=E2=80=99s useful if you want to test a GNU/Linux system that use= s the VM service, as in: guix system vm my-gnu+linux.scm where =E2=80=98my-gnu+linux.scm=E2=80=99 contains: (services (cons (service hurd-vm-service-type) =E2=80=A6)) I suppose it should just work, though probably without =E2=80=98-enable-kvm= =E2=80=99; janneke? Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 11 16:00:05 2020 Received: (at 41785) by debbugs.gnu.org; 11 Jun 2020 20:00:05 +0000 Received: from localhost ([127.0.0.1]:38160 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjTMr-0006Rt-4q for submit@debbugs.gnu.org; Thu, 11 Jun 2020 16:00:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53726) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjTMp-0006Qq-DG for 41785@debbugs.gnu.org; Thu, 11 Jun 2020 16:00:03 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40280) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjTMk-0003wh-0M; Thu, 11 Jun 2020 15:59:58 -0400 Received: from [2a01:e0a:1d:7270:6a6c:dc17:fc02:cfda] (port=52152 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jjTMe-0004TH-MR; Thu, 11 Jun 2020 15:59:56 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: "Jan \(janneke\) Nieuwenhuizen" Subject: Re: [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. References: <20200610085441.890-1-janneke@gnu.org> Date: Thu, 11 Jun 2020 21:59:50 +0200 In-Reply-To: <20200610085441.890-1-janneke@gnu.org> (Jan Nieuwenhuizen's message of "Wed, 10 Jun 2020 10:54:41 +0200") Message-ID: <87eeql9xvt.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: Mathieu Othacehe , 41785@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hey! That was fast! :-) "Jan (janneke) Nieuwenhuizen" skribis: > and doing something like > > ./pre-inst-env guix system vm gnu/system/examples/bare-bones.tmpl --n= o-offload > /gnu/store/96wh3jwsla4p6d4s547mmqxsi4qbbc0r-run-vm.sh -m 2G \ > --device rtl8139,netdev=3Dnet0 \ > --netdev user,id=3Dnet0,hostfwd=3Dtcp:127.0.0.1:10022-:2222,hostfwd= =3Dtcp:127.0.0.1:5900-:5900 > > nicely starts a bare-bones VM with the the hurd-in-vm service inside, but= I > cannot seem to connect to the Hurd VM it in any way. Appending > ",hostfwd=3Dtcp:127.0.0.1:20022-:20022" (to directly ssh into the Hurd) e= ven > blocks me from ssh'ing into the GNU/linux host VM. Weird. > hurd-in-vm works beautifully when added to my system configuration and > reconfiguring. > > * gnu/services/virtualization.scm (disk-image, hurd-in-vm-shepherd-servic= e, > hurd-vm-disk-image): New procedures. > (%hurd-in-vm-operating-system, hurd-in-vm-service-type): New variable. > (): New record type. > * doc/guix.texi (Virtualization Services): Document it. [=E2=80=A6] > +@subsubheading The Hurd in a Virtual Machine > + > +@cindex @code{hurd} > +@cindex the Hurd > + > +Service @code{hurd-in-vm} provides support for running a Virtual Machine > +with the GNU@tie{}Hurd. =E2=80=9C=E2=80=A6 support for running GNU/Hurd in a virtual machine (VM). = The virtual machine is a Shepherd service that can be controlled with commands such as: @example herd stop hurd-vm @end example The given GNU/Hurd operating system configuration is cross-compiled.=E2=80= =9D Nitpick: I=E2=80=99d call it =E2=80=9Churd-vm=E2=80=9D, because it runs a H= urd VM. :-) It=E2=80=99s a volatile VM, due to the use of =E2=80=98-snapshot=E2=80=99, = right? (The Hurd actually has =E2=80=9Csub-Hurds=E2=80=9D=C2=B9 and =E2=80=9Cneigh= borhurds=E2=80=9D=C2=B2. I wonder if it=E2=80=99s our duty to coin another term=E2=80=A6 a guesthurd? a visithur= d?) =C2=B9 https://www.gnu.org/software/hurd/hurd/subhurd.html =C2=B2 https://www.gnu.org/software/hurd/hurd/neighborhurd.html > +(define* (disk-image os #:key (image-size 'guess) target) > + "Return a disk-image for OS with size IMAGE-SIZE, built for TARGET." > + (with-store store ^ In general, procedures should talk to the user-provided store and never open a new connection. They should also never call =E2=80=98build-derivati= ons=E2=80=99 explicitly, the only exception so far being the graft implementation. So you can drop =E2=80=98with-store=E2=80=99 here, and then: > + (run-with-store store > + (let ((file-system-type "ext2")) > + (mlet* %store-monad > + ((base-image (find-image file-system-type)) > + (sys (lower-object > + (system-image > + (image > + (inherit base-image) > + (size image-size) > + (operating-system os))))) > + (drvs (mapm/accumulate-builds lower-object (list sys)= )) > + (% (built-derivations drvs))) > + (let ((output (derivation->output-path sys))) > + (return output)))) Mathieu, can we make =E2=80=98find-image=E2=80=99 non-monadic? It really s= houldn=E2=80=99t be because it doesn=E2=80=99t interact with the store. It can take an optional =E2=80=98system=E2=80=99 parameter if we want. So, assuming =E2=80=98find-image=E2=80=99 is non-monadic, the code above be= comes something like: (system-image (image (inherit base-image) (size image-size) (operating-system (with-parameters ((%current-target-system "i586-pc-gnu")) os)))) > +(define %hurd-in-vm-operating-system > + (operating-system > + (inherit %hurd-default-operating-system) > + (host-name "guixydevel") > + (timezone "Europe/Amsterdam") > + (bootloader (bootloader-configuration > + (bootloader grub-minimal-bootloader) > + (target "/dev/vda") > + (timeout 0))) > + (services (cons* > + (service openssh-service-type > + (openssh-configuration > + (openssh openssh-sans-x) > + (use-pam? #f) > + (port-number 2222) > + (permit-root-login #t) > + (allow-empty-passwords? #t) > + (password-authentication? #t))) > + %base-services/hurd)))) I understand the need to factorize useful configs, but IMO it doesn=E2=80= =99t belong here. So I=E2=80=99d just leave it out. There=E2=80=99s already =E2=80=98%hurd-default-operating-system=E2=80=99 that does the heavy liftin= g anyway. > +(define hurd-in-vm-service-type > + (service-type > + (name 'hurd-in-vm) > + (extensions (list (service-extension shepherd-root-service-type > + hurd-in-vm-shepherd-service))) > + (default-value (hurd-in-vm-configuration)) > + (description > + "Provide a Virtual Machine running the GNU Hurd."))) Being pedantic: s|the GNU Hurd|GNU/Hurd|. :-) Otherwise looks great to me, thank you! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 11 16:00:13 2020 Received: (at 41785) by debbugs.gnu.org; 11 Jun 2020 20:00:14 +0000 Received: from localhost ([127.0.0.1]:38163 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjTMz-0006TE-LG for submit@debbugs.gnu.org; Thu, 11 Jun 2020 16:00:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53844) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjTMx-0006S3-TN for 41785@debbugs.gnu.org; Thu, 11 Jun 2020 16:00:12 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40290) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjTMr-0003zC-Oo; Thu, 11 Jun 2020 16:00:05 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=58896 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jjTMn-0004yq-MS; Thu, 11 Jun 2020 16:00:03 -0400 From: Jan Nieuwenhuizen To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. Organization: AvatarAcademy.nl References: <20200610085441.890-1-janneke@gnu.org> <87r1unm9xy.fsf@gnu.org> <87tuzh9yn3.fsf@gnu.org> X-Url: http://AvatarAcademy.nl Date: Thu, 11 Jun 2020 21:59:59 +0200 In-Reply-To: <87tuzh9yn3.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Thu, 11 Jun 2020 21:43:28 +0200") Message-ID: <87ftb15q68.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: Mathieu Othacehe , 41785@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ludovic Court=C3=A8s writes: Hello, > Mathieu Othacehe skribis: > >> Just to clarify things here, we now have the "disk-image" command that >> produces a Hurd bootable disk-image. The "vm-image" command is almost >> working, and should produce a very similar result. (yes) >> The "vm" command that produces a vm-image and spawns a VM isn't working >> yet with the Hurd. This command is for now passing directly "kernel" and >> "initrd" arguments to QEMU, so a few adaptations will be needed. >> >> Now the goad of hurd-in-vm-service-type is to provide a service that >> does almost the same thing as the "vm" command, but as a service, right? > > That=E2=80=99s my understanding. Indeed, mine too. >> So, I don't get why would we need to run a Hurd VM inside a VM. I've >> been struggling a lot with running nested layers of virtualization (for >> system generation before the recent patches), and the result is often >> too slow to be really usable. > > I guess it=E2=80=99s useful if you want to test a GNU/Linux system that u= ses the > VM service, as in: > > guix system vm my-gnu+linux.scm > > where =E2=80=98my-gnu+linux.scm=E2=80=99 contains: > > (services (cons (service hurd-vm-service-type) > =E2=80=A6)) > > I suppose it should just work, though probably without =E2=80=98-enable-k= vm=E2=80=99; > janneke? Well -- yes. That was my thinking. We would not normally use such a VM-in-VM thing; when you want a Hurd VM using the "vm" command would be great (or as now, create a disk image and start QEMU). However, for writing and debugging (testing?) this Hurd-in-VM service, I thought adding it to a linux bare-bones.tmpl and using guix vm on that was a nice and "trivial" way to test it. That proved so troublesome that I added it to my system. As I understand it the intended use for this service is to have a real simple way to add a Hurd VM to some build machines, so that we can easily create a herd of Hurd-VMs to aid the Hurd work. Ludo? Greetings, Janneke --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 11 16:01:43 2020 Received: (at 41785) by debbugs.gnu.org; 11 Jun 2020 20:01:43 +0000 Received: from localhost ([127.0.0.1]:38168 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjTOR-0006WN-2M for submit@debbugs.gnu.org; Thu, 11 Jun 2020 16:01:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjTOI-0006Vw-Vx for 41785@debbugs.gnu.org; Thu, 11 Jun 2020 16:01:42 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40347) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjTOD-0004NI-Jy; Thu, 11 Jun 2020 16:01:29 -0400 Received: from ti0006q161-2604.bb.online.no ([84.202.68.75]:50122 helo=localhost) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jjTOC-0000dE-L8; Thu, 11 Jun 2020 16:01:29 -0400 From: Marius Bakke To: Mathieu Othacehe , "Jan \(janneke\) Nieuwenhuizen" Subject: Re: [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. In-Reply-To: <87r1unm9xy.fsf@gnu.org> References: <20200610085441.890-1-janneke@gnu.org> <87r1unm9xy.fsf@gnu.org> Date: Thu, 11 Jun 2020 22:01:25 +0200 Message-ID: <87h7vhfk2y.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: 41785@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Mathieu Othacehe writes: > So, I don't get why would we need to run a Hurd VM inside a VM. I've > been struggling a lot with running nested layers of virtualization (for > system generation before the recent patches), and the result is often > too slow to be really usable. Note that recent processors support nested layers of virtualization natively with little overhead, but it's disabled by default. For an Intel processor, it can be enabled by adding this to your system configuration: (kernel-arguments (cons "kvm_intel.nested=1" %default-kernel-arguments)) The corresponding AMD kernel module is called "kvm_amd". --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl7ijZUACgkQoqBt8qM6 VPrZKggAw5jBvmJSnZkR+RCnKW/mSWf3bxteaO5RBGcXQuYHyZBRd0WviINXeGUr mVoPrZ5yXLZdSQgaLj6Cfcgr78k9DLau0FYOwODc28rz8wsGj62IJB3XJe16Svps TBsQHGluncnyBp5g0trO9acG2zKhaxF9tFX8e5ZT+hleNk0WcpXV7jY+ubrOjINQ yleXOQpGcUnSD2LzJCwkj9cTjwGPIXSg1MH+G2rXsBnHoVuvLM/Xo2W4Kf2Hl+gl +iMITdLfGDfHjbVOFtcJ7T7C7FerYA4sWcrIYwpOwfDXwnnVjf5zNrpbyjJpvelL UHBNlFxVoKJlmnq6g5rTl39Ly109lQ== =2aVn -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 11 17:57:33 2020 Received: (at 41785) by debbugs.gnu.org; 11 Jun 2020 21:57:33 +0000 Received: from localhost ([127.0.0.1]:38309 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjVCQ-00037c-0j for submit@debbugs.gnu.org; Thu, 11 Jun 2020 17:57:33 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34298) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjVCI-00036q-Dw for 41785@debbugs.gnu.org; Thu, 11 Jun 2020 17:57:24 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:41898) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjVCC-0005Kh-9R; Thu, 11 Jun 2020 17:57:12 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=59488 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jjVC9-0002Jn-9e; Thu, 11 Jun 2020 17:57:10 -0400 From: Jan Nieuwenhuizen To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. Organization: AvatarAcademy.nl References: <20200610085441.890-1-janneke@gnu.org> <87eeql9xvt.fsf@gnu.org> X-Url: http://AvatarAcademy.nl Date: Thu, 11 Jun 2020 23:57:06 +0200 In-Reply-To: <87eeql9xvt.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Thu, 11 Jun 2020 21:59:50 +0200") Message-ID: <87wo4d2rm5.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: Mathieu Othacehe , 41785@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: Hello, > That was fast! :-) Yeah...we need this, right ;) > "Jan (janneke) Nieuwenhuizen" skribis: > >> and doing something like >> >> ./pre-inst-env guix system vm gnu/system/examples/bare-bones.tmpl --= no-offload >> /gnu/store/96wh3jwsla4p6d4s547mmqxsi4qbbc0r-run-vm.sh -m 2G \ >> --device rtl8139,netdev=3Dnet0 \ >> --netdev user,id=3Dnet0,hostfwd=3Dtcp:127.0.0.1:10022-:2222,hostfw= d=3Dtcp:127.0.0.1:5900-:5900 >> >> nicely starts a bare-bones VM with the the hurd-in-vm service inside, bu= t I >> cannot seem to connect to the Hurd VM it in any way. Appending >> ",hostfwd=3Dtcp:127.0.0.1:20022-:20022" (to directly ssh into the Hurd) = even >> blocks me from ssh'ing into the GNU/linux host VM. > > Weird. > >> hurd-in-vm works beautifully when added to my system configuration and >> reconfiguring. >> >> * gnu/services/virtualization.scm (disk-image, hurd-in-vm-shepherd-servi= ce, >> hurd-vm-disk-image): New procedures. >> (%hurd-in-vm-operating-system, hurd-in-vm-service-type): New variable. >> (): New record type. >> * doc/guix.texi (Virtualization Services): Document it. > > [=E2=80=A6] > >> +@subsubheading The Hurd in a Virtual Machine >> + >> +@cindex @code{hurd} >> +@cindex the Hurd >> + >> +Service @code{hurd-in-vm} provides support for running a Virtual Machine >> +with the GNU@tie{}Hurd. > > =E2=80=9C=E2=80=A6 support for running GNU/Hurd in a virtual machine (VM)= . The virtual > machine is a Shepherd service that can be controlled with commands such > as: > > @example > herd stop hurd-vm > @end example > > The given GNU/Hurd operating system configuration is cross-compiled.=E2= =80=9D Nice, thanks! > Nitpick: I=E2=80=99d call it =E2=80=9Churd-vm=E2=80=9D, because it runs a= Hurd VM. :-) Done! > It=E2=80=99s a volatile VM, due to the use of =E2=80=98-snapshot=E2=80=99= , right? By default: Yes. That seemed more ready-to-use. A stateful VM image would need to an out-of-store, writable copy. You can actually do that and modify the hurd-vm-configuration. > (The Hurd actually has =E2=80=9Csub-Hurds=E2=80=9D=C2=B9 and =E2=80=9Cnei= ghborhurds=E2=80=9D=C2=B2. I wonder if > it=E2=80=99s our duty to coin another term=E2=80=A6 a guesthurd? a visith= urd?) > > =C2=B9 https://www.gnu.org/software/hurd/hurd/subhurd.html > =C2=B2 https://www.gnu.org/software/hurd/hurd/neighborhurd.html Oh, that's cool! Associating along from the neighborhurd pun, what about a "childhurd" (as a pun on childhood -- only needed while the Hurd is growing up)? "herd start childhurd" -- hmm? In the updated patch, I still have hurd-vm. If we do our duty and coin "childhurd", should I just s/hurd-vm/childhurd/g ? >> +(define* (disk-image os #:key (image-size 'guess) target) >> + "Return a disk-image for OS with size IMAGE-SIZE, built for TARGET." >> + (with-store store > ^ > In general, procedures should talk to the user-provided store and never > open a new connection. They should also never call =E2=80=98build-deriva= tions=E2=80=99 > explicitly, the only exception so far being the graft implementation. > > So you can drop =E2=80=98with-store=E2=80=99 here, and then: > >> + (run-with-store store >> + (let ((file-system-type "ext2")) >> + (mlet* %store-monad >> + ((base-image (find-image file-system-type)) >> + (sys (lower-object >> + (system-image >> + (image >> + (inherit base-image) >> + (size image-size) >> + (operating-system os))))) >> + (drvs (mapm/accumulate-builds lower-object (list sys= ))) >> + (% (built-derivations drvs))) >> + (let ((output (derivation->output-path sys))) >> + (return output)))) > > Mathieu, can we make =E2=80=98find-image=E2=80=99 non-monadic? It really= shouldn=E2=80=99t be > because it doesn=E2=80=99t interact with the store. It can take an optio= nal > =E2=80=98system=E2=80=99 parameter if we want. It seems that "just works". I've made that change in a separate patch (attached). > So, assuming =E2=80=98find-image=E2=80=99 is non-monadic, the code above = becomes > something like: > > (system-image > (image (inherit base-image) > (size image-size) > (operating-system > (with-parameters ((%current-target-system "i586-pc-gnu")) > os)))) Hmm...I don't think that I understand. This --8<---------------cut here---------------start------------->8--- (define* (disk-image os #:key (image-size 'guess) target) "Return a disk-image for OS with size IMAGE-SIZE, built for TARGET." (let ((base-image (find-image "ext2"))) (system-image (image (inherit base-image) (size image-size) (operating-system (with-parameters ((%current-target-system target)) os)))))) --8<---------------cut here---------------end--------------->8--- gives --8<---------------cut here---------------start------------->8--- $ ~/src/guix/master/pre-inst-env guix system build dundal.scm %default-substitute-urls:("https://ci.guix.gnu.org") Backtrace: In ice-9/boot-9.scm: 1736:10 4 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _) In unknown file: 3 (apply-smob/0 #) In ice-9/boot-9.scm: 718:2 2 (call-with-prompt _ _ #) In ice-9/eval.scm: 619:8 1 (_ #(#(#))) In guix/ui.scm: 1945:12 0 (run-guix-command _ . _) guix/ui.scm:1945:12: In procedure run-guix-command: In procedure operating-system-file-systems: Wrong type argument: #< bindings: ((#< 7f4ce7c23740 proc: #> #)) thunk: #> --8<---------------cut here---------------end--------------->8--- ...I could do with some help here. >> +(define %hurd-in-vm-operating-system [..] >> + (operating-system >> + (service openssh-service-type >> + (openssh-configuration >> + (openssh openssh-sans-x) [..] >> + %base-services/hurd)))) > > I understand the need to factorize useful configs, but IMO it doesn=E2=80= =99t > belong here. So I=E2=80=99d just leave it out. There=E2=80=99s already > =E2=80=98%hurd-default-operating-system=E2=80=99 that does the heavy lift= ing anyway. Sure, removed! Users will most probably want to add an openssh server using openssh-sans-x; but I guess that's something for a blog post or cookbook then. >> +(define hurd-in-vm-service-type >> + (service-type >> + (name 'hurd-in-vm) >> + (extensions (list (service-extension shepherd-root-service-type >> + hurd-in-vm-shepherd-service))) >> + (default-value (hurd-in-vm-configuration)) >> + (description >> + "Provide a Virtual Machine running the GNU Hurd."))) > > Being pedantic: s|the GNU Hurd|GNU/Hurd|. :-) > > Otherwise looks great to me, thank you! Great; thanks...find two new patches attached. Janneke --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=v2-0001-image-Make-find-image-non-monadic.patch Content-Transfer-Encoding: quoted-printable >From b01b8d2a46a6a04cb8f09d74c06cbbc82878f070 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Thu, 11 Jun 2020 22:52:12 +0200 Subject: [PATCH v2 1/2] image: Make 'find-image' non-monadic. * gnu/system/image.scm (find-image): Make non-monadic. * gnu/tests/install.scm (run-install): Update caller. * guix/scripts/system.scm (perform-action): Likewise. --- gnu/system/image.scm | 21 ++++++++++----------- gnu/tests/install.scm | 5 +++-- guix/scripts/system.scm | 3 ++- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/gnu/system/image.scm b/gnu/system/image.scm index a0e6bf31f1..66a9f6b335 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2020 Mathieu Othacehe +;;; Copyright =C2=A9 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -551,16 +552,14 @@ image, depending on IMAGE format." "Find and return an image that could match the given FILE-SYSTEM-TYPE. = This is useful to adapt to interfaces written before the addition of the record." - (mlet %store-monad ((target (current-target-system))) - (mbegin %store-monad - (return - (match file-system-type - ("iso9660" iso9660-image) - (_ (cond - ((and target - (hurd-triplet? target)) - hurd-disk-image) - (else - efi-disk-image)))))))) + (let ((target (%current-target-system))) + (match file-system-type + ("iso9660" iso9660-image) + (_ (cond + ((and target + (hurd-triplet? target)) + hurd-disk-image) + (else + efi-disk-image)))))) =20 ;;; image.scm ends here diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm index 6bd8c7d3d2..d18e33179f 100644 --- a/gnu/tests/install.scm +++ b/gnu/tests/install.scm @@ -3,6 +3,7 @@ ;;; Copyright =C2=A9 2017, 2019 Tobias Geerinckx-Rice ;;; Copyright =C2=A9 2020 Mathieu Othacehe ;;; Copyright =C2=A9 2020 Danny Milosavljevic +;;; Copyright =C2=A9 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -228,8 +229,8 @@ packages defined in installation-os." (mlet* %store-monad ((_ (set-grafting #f)) (system (current-system)) (target (operating-system-derivation target-os)) - (base-image (find-image - installation-disk-image-file-system-ty= pe)) + (base-image -> (find-image + installation-disk-image-file-system= -type)) =20 ;; Since the installation system has no network acc= ess, ;; we cheat a little bit by adding TARGET to its GC diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 3d7aa77cb7..fc92b9f07b 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -5,6 +5,7 @@ ;;; Copyright =C2=A9 2017, 2019 Mathieu Othacehe ;;; Copyright =C2=A9 2018 Ricardo Wurmus ;;; Copyright =C2=A9 2019 Christopher Baines +;;; Copyright =C2=A9 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -801,7 +802,7 @@ static checks." (check-initrd-modules os))) =20 (mlet* %store-monad - ((image (find-image file-system-type)) + ((image -> (find-image file-system-type)) (sys (system-derivation-for-action os image action #:file-system-type file-sy= stem-type #:image-size image-size --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=v2-0002-services-Add-hurd-vm-service-type.patch Content-Transfer-Encoding: quoted-printable >From e5bdf050f628cc7ea1b6bc4ccdcfeb757429820f Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Wed, 10 Jun 2020 00:10:28 +0200 Subject: [PATCH v2 2/2] services: Add 'hurd-vm service-type'. * gnu/services/virtualization.scm (disk-image, hurd-in-vm-shepherd-service, hurd-vm-disk-image): New procedures. (hurd-in-vm-service-type): New variable. (): New record type. * doc/guix.texi (Virtualization Services): Document it. --- doc/guix.texi | 66 +++++++++++++++++ gnu/services/virtualization.scm | 110 ++++++++++++++++++++++++++-- gnu/system/examples/bare-bones.tmpl | 8 +- 3 files changed, 176 insertions(+), 8 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 15e077a41c..2c924e5313 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -24583,6 +24583,72 @@ Return true if @var{obj} is a platform object. Return the name of @var{platform}---a string such as @code{"arm"}. @end deffn =20 + +@subsubheading The Hurd in a Virtual Machine + +@cindex @code{hurd} +@cindex the Hurd + +Service @code{hurd-vm} provides support for running GNU/Hurd in a +virtual machine (VM). The virtual machine is a Shepherd service that +can be controlled with commands such as: + +@example +herd stop hurd-vm +@end example + +The given GNU/Hurd operating system configuration is cross-compiled. + +@defvr {Scheme Variable} hurd-vm-service-type +This is the type of the Hurd in a Virtual Machine service. Its value +must be a @code{hurd-vm-configuration} object, which specifies the +operating system (@pxref{operating-system Reference}) and the disk size +for the Hurd Virtual Machine, the QEMU package to use as well as the +options for running it. + +For example: + +@lisp +(service hurd-vm-service-type + (hurd-vm-configuration + (disk-size (* 5000 (expt 2 20))) ;5G + (memory-size 1024))) ;1024MiB +@end lisp + +would create a disk image big enough to build GNU@tie{}Hello, with some +extra memory. +@end defvr + +@deftp {Data Type} hurd-vm-configuration +The data type representing the configuration for +@code{hurd-vm-service-type}. + +@table @asis +@item @code{os} (default: @var{%hurd-default-operating-system}) +The operating system to instantiate. + +@item @code{qemu} (default: @code{qemu-minimal}) +The QEMU package to use. + +@item @code{image} (default: @var{hurd-vm-disk-image}) +The procedure used to build the disk-image built from this +configuration. + +@item @code{disk-size} (default: @code{'guess}) +The size of the disk image. + +@item @code{memory-size} (default: @code{512}) +The memory size of the Virtual Machine in mebibytes. + +@item @code{options} (default: @code{'("--device"} @code{"rtl8139,netdev= =3Dnet0"} @ + @code{"--netdev"} @ + @code{"user,id=3Dnet0,hostfwd=3Dtcp:127.0.0.1:20022-:2222,hostfwd=3D= tcp:127.0.0.1:25900-:5900"} @ + @code{"--snapshot"} @ + @code{"--hda")}) +The extra options for running QEMU. +@end table +@end deftp + @node Version Control Services @subsection Version Control Services =20 diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.= scm index 989e439d5d..f2a5e7200e 100644 --- a/gnu/services/virtualization.scm +++ b/gnu/services/virtualization.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2017 Ryan Moe ;;; Copyright =C2=A9 2018 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,24 +19,40 @@ ;;; along with GNU Guix. If not, see . =20 (define-module (gnu services virtualization) - #:use-module (gnu services) - #:use-module (gnu services configuration) + #:use-module (gnu bootloader) + #:use-module (gnu bootloader grub) + #:use-module (gnu image) + #:use-module (gnu packages admin) + #:use-module (gnu packages ssh) + #:use-module (gnu packages virtualization) #:use-module (gnu services base) + #:use-module (gnu services configuration) #:use-module (gnu services dbus) #:use-module (gnu services shepherd) - #:use-module (gnu system shadow) + #:use-module (gnu services ssh) + #:use-module (gnu services) #:use-module (gnu system file-systems) - #:use-module (gnu packages admin) - #:use-module (gnu packages virtualization) - #:use-module (guix records) + #:use-module (gnu system hurd) + #:use-module (gnu system image) + #:use-module (gnu system shadow) + #:use-module (gnu system) + #:use-module (guix derivations) #:use-module (guix gexp) + #:use-module (guix monads) #:use-module (guix packages) + #:use-module (guix records) + #:use-module (guix store) + #:use-module (guix utils) + #:use-module (srfi srfi-9) #:use-module (srfi srfi-26) #:use-module (rnrs bytevectors) #:use-module (ice-9 match) =20 - #:export (libvirt-configuration + #:export (hurd-vm-configuration + hurd-vm-service-type + + libvirt-configuration libvirt-service-type virtlog-configuration virtlog-service-type @@ -773,3 +790,82 @@ given QEMU package." "This service supports transparent emulation of binaries compiled for other architectures using QEMU and the @code{binfmt_misc} functionality of the kernel Linux."))) + + +;;; +;;; The Hurd in VM service. +;;; + +(define* (disk-image os #:key (image-size 'guess) target) + "Return a disk-image for OS with size IMAGE-SIZE, built for TARGET." + (let ((base-image (find-image "ext2"))) + (system-image + (image (inherit base-image) + (size image-size) + (operating-system + (with-parameters ((%current-target-system target)) + os)))))) + +(define-record-type* + hurd-vm-configuration make-hurd-vm-configuration + hurd-vm-configuration? + (os hurd-vm-configuration-os ; + (default %hurd-default-operating-system)) + (qemu hurd-vm-configuration-qemu ; + (default qemu-minimal)) + (image hurd-vm-configuration-image ;string + (thunked) + (default (hurd-vm-disk-image this-record))) + (disk-size hurd-vm-configuration-disk-size ;number or 'guess + (default 'guess)) + (memory-size hurd-vm-configuration-memory-size ;number + (default 512)) + (options hurd-vm-configuration-options ;list of string + (default + `("--device" "rtl8139,netdev=3Dnet0" + "--netdev" (string-append + "user,id=3Dnet0" + ",hostfwd=3Dtcp:127.0.0.1:20022-:2222" + ",hostfwd=3Dtcp:127.0.0.1:25900-:5900") + "--snapshot" + "--hda")))) + +(define (hurd-vm-disk-image config) + "Return a disk-image for the Hurd according to CONFIG." + (let ((os (hurd-vm-configuration-os config)) + (disk-size (hurd-vm-configuration-disk-size config)) + (target (and (not (%current-target-system)) "i586-pc-gnu"))) + (disk-image os #:target target #:image-size disk-size))) + +(define (hurd-vm-shepherd-service config) + "Return a for a Hurd in a Virtual Machine with CONFIG= ." + + (let ((image (hurd-vm-configuration-image config)) + (qemu (hurd-vm-configuration-qemu config)) + (memory-size (hurd-vm-configuration-memory-size config)) + (options (hurd-vm-configuration-options config))) + + (define vm-command + #~(list + (string-append #$qemu "/bin/qemu-system-i386") + #$@(if (file-exists? "/dev/kvm") '("-enable-kvm") '()) + "-m" (number->string #$memory-size) + #$@options + #+image)) + + (list + (shepherd-service + (documentation "Run the Hurd in a Virtual Machine.") + (provision '(hurd-vm)) + (requirement '(networking)) + (start #~(make-forkexec-constructor #$vm-command)) + (stop #~(make-kill-destructor)))))) + +(define hurd-vm-service-type + (service-type + (name 'hurd-vm) + (extensions (list (service-extension shepherd-root-service-type + hurd-vm-shepherd-service))) + (default-value (hurd-vm-configuration)) + (description + "Provide a Virtual Machine running the GNU/Hurd."))) diff --git a/gnu/system/examples/bare-bones.tmpl b/gnu/system/examples/bare= -bones.tmpl index 1035ab1d60..1d4f7743ab 100644 --- a/gnu/system/examples/bare-bones.tmpl +++ b/gnu/system/examples/bare-bones.tmpl @@ -5,6 +5,8 @@ (use-service-modules networking ssh) (use-package-modules screen ssh) =20 +(use-service-modules hurd virtualization) + (operating-system (host-name "komputilo") (timezone "Europe/Berlin") @@ -44,8 +46,12 @@ ;; Add services to the baseline: a DHCP client and ;; an SSH server. (services (append (list (service dhcp-client-service-type) + (service hurd-vm-service-type) (service openssh-service-type (openssh-configuration (openssh openssh-sans-x) - (port-number 2222)))) + (port-number 2222) + (permit-root-login #t) + (allow-empty-passwords? #t) + (password-authentication? #t)))) %base-services))) --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 12 02:40:04 2020 Received: (at 41785) by debbugs.gnu.org; 12 Jun 2020 06:40:04 +0000 Received: from localhost ([127.0.0.1]:38763 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjdMB-0007nq-Np for submit@debbugs.gnu.org; Fri, 12 Jun 2020 02:40:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54894) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjdM5-0007n8-30 for 41785@debbugs.gnu.org; Fri, 12 Jun 2020 02:40:02 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48073) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjdLz-0006oJ-7i; Fri, 12 Jun 2020 02:39:51 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=59934 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jjdLs-0007xj-HY; Fri, 12 Jun 2020 02:39:45 -0400 From: Jan Nieuwenhuizen To: Marius Bakke Subject: Re: [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. Organization: AvatarAcademy.nl References: <20200610085441.890-1-janneke@gnu.org> <87r1unm9xy.fsf@gnu.org> <87h7vhfk2y.fsf@gnu.org> X-Url: http://AvatarAcademy.nl Date: Fri, 12 Jun 2020 08:39:41 +0200 In-Reply-To: <87h7vhfk2y.fsf@gnu.org> (Marius Bakke's message of "Thu, 11 Jun 2020 22:01:25 +0200") Message-ID: <87tuzgyehe.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.8 (-) X-Debbugs-Envelope-To: 41785 Cc: Mathieu Othacehe , 41785@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) Marius Bakke writes: Hello, > Mathieu Othacehe writes: > >> So, I don't get why would we need to run a Hurd VM inside a VM. I've >> been struggling a lot with running nested layers of virtualization (for >> system generation before the recent patches), and the result is often >> too slow to be really usable. > > Note that recent processors support nested layers of virtualization > natively with little overhead, but it's disabled by default. Ah! > For an Intel processor, it can be enabled by adding this to your system > configuration: > > (kernel-arguments (cons "kvm_intel.nested=3D1" %default-kernel-argument= s)) Is there an obvious downside to enabling this? Great...So on the host I did --8<---------------cut here---------------start------------->8--- root@dundal ~# rmmod kvm_intel root@dundal ~# modprobe kvm_intel kvm_intel.nested=3D1 root@dundal ~# cat /sys/module/kvm_intel/parameters/nested Y --8<---------------cut here---------------end--------------->8--- and the interwebs told me that to start the VM, you have to add "-cpu host"; so I started it using --8<---------------cut here---------------start------------->8--- /gnu/store/k2b7nx34cwyi6yk49wgy4hg9mrwcmll5-run-vm.sh -cpu host -m 2G -devi= ce rtl8139,netdev=3Dnet0 -netdev user,id=3Dnet0,hostfwd=3Dtcp:127.0.0.1:100= 22-:2222,hostfwd=3Dtcp:127.0.0.1:25900-:25900 --8<---------------cut here---------------end--------------->8--- and trying to "ssh -p 20022 localhost" from inside the bare-bones VM now prints --8<---------------cut here---------------start------------->8--- qemu-system-i386: Slirp: Failed to send package, ret: -1 qemu-system-i386: Slirp: Failed to send package, ret: -1 qemu-system-i386: Slirp: Failed to send package, ret: -1 qemu-system-i386: Slirp: Failed to send package, ret: -1 qemu-system-i386: Slirp: Failed to send package, ret: -1 qemu-system-i386: Slirp: Failed to send package, ret: -1 key_exchange_identification: read: Connection reset by peer Connection reset by 127.0.0.1 port 20022 --8<---------------cut here---------------end--------------->8--- ...something networky with QEMU. Ideas? Janneke --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 12 02:47:08 2020 Received: (at 41785) by debbugs.gnu.org; 12 Jun 2020 06:47:09 +0000 Received: from localhost ([127.0.0.1]:38767 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjdT2-0007yw-Ly for submit@debbugs.gnu.org; Fri, 12 Jun 2020 02:47:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56884) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjdT0-0007yZ-IN for 41785@debbugs.gnu.org; Fri, 12 Jun 2020 02:47:07 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48111) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjdSv-0008EN-9K; Fri, 12 Jun 2020 02:47:01 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=59950 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jjdSu-0008VF-Ha; Fri, 12 Jun 2020 02:47:00 -0400 From: Jan Nieuwenhuizen To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. References: <20200610085441.890-1-janneke@gnu.org> <87eeql9xvt.fsf@gnu.org> <87wo4d2rm5.fsf@gnu.org> Date: Fri, 12 Jun 2020 08:46:58 +0200 In-Reply-To: <87wo4d2rm5.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Thu, 11 Jun 2020 23:57:06 +0200") Message-ID: <87a718ye59.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: Mathieu Othacehe , 41785@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Jan Nieuwenhuizen writes: > Ludovic Court=C3=A8s writes: > > Hello, > >> That was fast! :-) > > Yeah...we need this, right ;) Sometimes...too fast :-( So...there's still the run-with-store/with-parameters puzzle; but just wanted to say that >>>From e5bdf050f628cc7ea1b6bc4ccdcfeb757429820f Mon Sep 17 00:00:00 2001 > From: "Jan (janneke) Nieuwenhuizen" > Date: Wed, 10 Jun 2020 00:10:28 +0200 > Subject: [PATCH v2 2/2] services: Add 'hurd-vm service-type'. [...] > gnu/system/examples/bare-bones.tmpl | 8 +- Oops... > diff --git a/gnu/system/examples/bare-bones.tmpl b/gnu/system/examples/ba= re-bones.tmpl > index 1035ab1d60..1d4f7743ab 100644 > --- a/gnu/system/examples/bare-bones.tmpl > +++ b/gnu/system/examples/bare-bones.tmpl ...without this bits, of course!! Janneke --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 12 06:51:39 2020 Received: (at 41785) by debbugs.gnu.org; 12 Jun 2020 10:51:39 +0000 Received: from localhost ([127.0.0.1]:38914 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjhHf-0007Wc-06 for submit@debbugs.gnu.org; Fri, 12 Jun 2020 06:51:39 -0400 Received: from mout02.posteo.de ([185.67.36.66]:53637) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjhHd-0007WP-8V for 41785@debbugs.gnu.org; Fri, 12 Jun 2020 06:51:38 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 25B5F2400FD for <41785@debbugs.gnu.org>; Fri, 12 Jun 2020 12:51:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1591959091; bh=JxKWssJTs0cwn8H1FyMOFXxM6AtJfA/v07HP8XYU+rc=; h=From:To:Cc:Subject:Date:From; b=JMetGJnIherjrMF5QtiWEjzpC+vbW1HjhzerNrmz0hUePgZHShAqy2CUM0CvkJhVv UMrtpVnjayO14edrZRDPly9YNT7NhKvzQmzhnx4FU/sqNkdqrJKbFM8vGzxEHwiJGA BHd6gXXCjIQzeNntVFl7BwxevKhjmYTBddIhnONfckCFkrZPzYi1VktNMU0hDLPgyf 65cmpgqAlmlyo/qvY0dDMRvzUW9oDGClgWnSRqB1UPWDgVzqELLpryK6FsF2JePAr7 bB5Ej1JZMq+3qpc5MTD2SSooDEe+R6P6A03wL9Ch44TrSFA6QlFPGV7j9sIdFUr1sM Nqqw5s3zKI3tA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 49jyFt06mXz9rxH; Fri, 12 Jun 2020 12:51:29 +0200 (CEST) From: Diego Nicola Barbato To: Jan Nieuwenhuizen Subject: Re: [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. References: <20200610085441.890-1-janneke@gnu.org> <87r1unm9xy.fsf@gnu.org> <87h7vhfk2y.fsf@gnu.org> <87tuzgyehe.fsf@gnu.org> Date: Fri, 12 Jun 2020 12:51:29 +0200 In-Reply-To: <87tuzgyehe.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Fri, 12 Jun 2020 08:39:41 +0200") Message-ID: <87v9jw8slq.fsf@GlaDOS.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.8 (-) X-Debbugs-Envelope-To: 41785 Cc: Mathieu Othacehe , 41785@debbugs.gnu.org, Marius Bakke X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) Hey, Jan Nieuwenhuizen writes: [...] > and the interwebs told me that to start the VM, you have to add "-cpu > host"; so I started it using > > /gnu/store/k2b7nx34cwyi6yk49wgy4hg9mrwcmll5-run-vm.sh -cpu host -m 2G -device rtl8139,netdev=net0 -netdev user,id=net0,hostfwd=tcp:127.0.0.1:10022-:2222,hostfwd=tcp:127.0.0.1:25900-:25900 > > > and trying to "ssh -p 20022 localhost" from inside the bare-bones VM now > prints > > qemu-system-i386: Slirp: Failed to send package, ret: -1 > qemu-system-i386: Slirp: Failed to send package, ret: -1 > qemu-system-i386: Slirp: Failed to send package, ret: -1 > qemu-system-i386: Slirp: Failed to send package, ret: -1 > qemu-system-i386: Slirp: Failed to send package, ret: -1 > qemu-system-i386: Slirp: Failed to send package, ret: -1 > key_exchange_identification: read: Connection reset by peer > Connection reset by 127.0.0.1 port 20022 > > ...something networky with QEMU. Ideas? I've recently had intermittent issues with 'guix system vm' and hostfwd. Does it help if you remove the '-nic user,model=virtio-net-pci' option from (a copy of) the run-vm.sh script so that there's only one netdev? Regards, Diego From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 12 10:43:06 2020 Received: (at 41785) by debbugs.gnu.org; 12 Jun 2020 14:43:06 +0000 Received: from localhost ([127.0.0.1]:40411 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjktd-0005DJ-RP for submit@debbugs.gnu.org; Fri, 12 Jun 2020 10:43:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38502) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjktc-0005Cp-Hm for 41785@debbugs.gnu.org; Fri, 12 Jun 2020 10:43:04 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36987) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjktX-0008Mq-60; Fri, 12 Jun 2020 10:42:59 -0400 Received: from [2a01:e0a:fa:a50:94c:bf7f:8c59:d38d] (port=33224 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jjktW-00073N-Mx; Fri, 12 Jun 2020 10:42:58 -0400 From: Mathieu Othacehe To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. References: <20200610085441.890-1-janneke@gnu.org> <87eeql9xvt.fsf@gnu.org> Date: Fri, 12 Jun 2020 16:42:55 +0200 In-Reply-To: <87eeql9xvt.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Thu, 11 Jun 2020 21:59:50 +0200") Message-ID: <87a718l500.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: 41785@debbugs.gnu.org, "Jan \(janneke\) Nieuwenhuizen" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello Ludo & janneke, > Mathieu, can we make =E2=80=98find-image=E2=80=99 non-monadic? It really= shouldn=E2=80=99t be > because it doesn=E2=80=99t interact with the store. It can take an optio= nal > =E2=80=98system=E2=80=99 parameter if we want. Yes, you're right, passing 'target' to 'find-image' should be enough to make it non-monadic. > So, assuming =E2=80=98find-image=E2=80=99 is non-monadic, the code above = becomes > something like: > > (system-image > (image (inherit base-image) > (size image-size) > (operating-system > (with-parameters ((%current-target-system "i586-pc-gnu")) > os)))) I would prefer 'target' to be part of the image itself, as I proposed here: https://lists.gnu.org/archive/html/guix-devel/2020-05/msg00417.html. There's no way for now, that the image is built without cross-compiling for "i586-pc-gnu", so I think it could be part of the "image" record itself. WDYT? >> +(define hurd-in-vm-service-type >> + (service-type >> + (name 'hurd-in-vm) >> + (extensions (list (service-extension shepherd-root-service-type >> + hurd-in-vm-shepherd-service))) >> + (default-value (hurd-in-vm-configuration)) >> + (description >> + "Provide a Virtual Machine running the GNU Hurd."))) > > Being pedantic: s|the GNU Hurd|GNU/Hurd|. :-) > > Otherwise looks great to me, thank you! Looks really nice to me too :) Thanks, Mathieu From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 12 10:45:17 2020 Received: (at 41785) by debbugs.gnu.org; 12 Jun 2020 14:45:17 +0000 Received: from localhost ([127.0.0.1]:40415 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjkvl-0005Gs-7c for submit@debbugs.gnu.org; Fri, 12 Jun 2020 10:45:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjkvj-0005Gf-88 for 41785@debbugs.gnu.org; Fri, 12 Jun 2020 10:45:16 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37015) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjkvd-0000I6-6W; Fri, 12 Jun 2020 10:45:09 -0400 Received: from [2a01:e0a:1d:7270:6a6c:dc17:fc02:cfda] (port=54488 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jjkva-00079i-1q; Fri, 12 Jun 2020 10:45:08 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Jan Nieuwenhuizen Subject: Re: [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. References: <20200610085441.890-1-janneke@gnu.org> <87eeql9xvt.fsf@gnu.org> <87wo4d2rm5.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 25 Prairial an 228 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 12 Jun 2020 16:45:04 +0200 In-Reply-To: <87wo4d2rm5.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Thu, 11 Jun 2020 23:57:06 +0200") Message-ID: <87imfw737z.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: Mathieu Othacehe , 41785@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi! Jan Nieuwenhuizen skribis: >> It=E2=80=99s a volatile VM, due to the use of =E2=80=98-snapshot=E2=80= =99, right? > > By default: Yes. That seemed more ready-to-use. A stateful VM image > would need to an out-of-store, writable copy. You can actually do that > and modify the hurd-vm-configuration. It=E2=80=99s maybe worth mentioning in the manual. >> (The Hurd actually has =E2=80=9Csub-Hurds=E2=80=9D=C2=B9 and =E2=80=9Cne= ighborhurds=E2=80=9D=C2=B2. I wonder if >> it=E2=80=99s our duty to coin another term=E2=80=A6 a guesthurd? a visit= hurd?) >> >> =C2=B9 https://www.gnu.org/software/hurd/hurd/subhurd.html >> =C2=B2 https://www.gnu.org/software/hurd/hurd/neighborhurd.html > > Oh, that's cool! Associating along from the neighborhurd pun, what > about a "childhurd" (as a pun on childhood -- only needed while the Hurd > is growing up)? =E2=80=9CChildhurd=E2=80=9D, LOVE IT! > "herd start childhurd" -- hmm? In the updated patch, I still have > hurd-vm. If we do our duty and coin "childhurd", should I just > s/hurd-vm/childhurd/g ? Shepherd services can have more than one name, so I propose to have both! >> So, assuming =E2=80=98find-image=E2=80=99 is non-monadic, the code above= becomes >> something like: >> >> (system-image >> (image (inherit base-image) >> (size image-size) >> (operating-system >> (with-parameters ((%current-target-system "i586-pc-gnu")) >> os)))) > > Hmm...I don't think that I understand. This > > (define* (disk-image os #:key (image-size 'guess) target) > "Return a disk-image for OS with size IMAGE-SIZE, built for TARGET." > (let ((base-image (find-image "ext2"))) > (system-image > (image (inherit base-image) > (size image-size) > (operating-system > (with-parameters ((%current-target-system target)) > os)))))) > > > gives > > $ ~/src/guix/master/pre-inst-env guix system build dundal.scm > %default-substitute-urls:("https://ci.guix.gnu.org") > Backtrace: > In ice-9/boot-9.scm: > 1736:10 4 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _) > In unknown file: > 3 (apply-smob/0 #) > In ice-9/boot-9.scm: > 718:2 2 (call-with-prompt _ _ #) > In ice-9/eval.scm: > 619:8 1 (_ #(#(#))) > In guix/ui.scm: > 1945:12 0 (run-guix-command _ . _) > > guix/ui.scm:1945:12: In procedure run-guix-command: > In procedure operating-system-file-systems: Wrong type argument: #< bindings: ((#< 7f4ce7c23740 proc: #> #)) thunk: #> > > ...I could do with some help here. Ooh, sadness. We can=E2=80=99t do that because the image machinery really expects an . What if you move =E2=80=98with-parameters=E2=80=99 around (system-image =E2= =80=A6) instead? >>> +(define %hurd-in-vm-operating-system > [..] >>> + (operating-system >>> + (service openssh-service-type >>> + (openssh-configuration >>> + (openssh openssh-sans-x) > [..] >>> + %base-services/hurd)))) >> >> I understand the need to factorize useful configs, but IMO it doesn=E2= =80=99t >> belong here. So I=E2=80=99d just leave it out. There=E2=80=99s already >> =E2=80=98%hurd-default-operating-system=E2=80=99 that does the heavy lif= ting anyway. > > Sure, removed! Users will most probably want to add an openssh server > using openssh-sans-x; but I guess that's something for a blog post or > cookbook then. Yeah. Hmm, come to think about it, we need a default value here anyway, so after all, we have a good reason to have it here. (Says the guy who changes his mind.) > From b01b8d2a46a6a04cb8f09d74c06cbbc82878f070 Mon Sep 17 00:00:00 2001 > From: "Jan (janneke) Nieuwenhuizen" > Date: Thu, 11 Jun 2020 22:52:12 +0200 > Subject: [PATCH v2 1/2] image: Make 'find-image' non-monadic. > > * gnu/system/image.scm (find-image): Make non-monadic. > * gnu/tests/install.scm (run-install): Update caller. > * guix/scripts/system.scm (perform-action): Likewise. [...] > "Find and return an image that could match the given FILE-SYSTEM-TYPE.= This > is useful to adapt to interfaces written before the addition of the > record." > - (mlet %store-monad ((target (current-target-system))) > - (mbegin %store-monad > - (return > - (match file-system-type > - ("iso9660" iso9660-image) > - (_ (cond > - ((and target > - (hurd-triplet? target)) > - hurd-disk-image) > - (else > - efi-disk-image)))))))) > + (let ((target (%current-target-system))) > + (match file-system-type > + ("iso9660" iso9660-image) > + (_ (cond > + ((and target > + (hurd-triplet? target)) > + hurd-disk-image) > + (else > + efi-disk-image)))))) I=E2=80=99d prefer: (define* (find-image #:optional (system (%current-system))) =E2=80=A6) In your case, you=E2=80=99d need to make this call: (find-image "i586-gnu") (Beware of the triplet/system type distinction!) Perhaps the other call sites need to be adjusted. > From e5bdf050f628cc7ea1b6bc4ccdcfeb757429820f Mon Sep 17 00:00:00 2001 > From: "Jan (janneke) Nieuwenhuizen" > Date: Wed, 10 Jun 2020 00:10:28 +0200 > Subject: [PATCH v2 2/2] services: Add 'hurd-vm service-type'. > > * gnu/services/virtualization.scm (disk-image, hurd-in-vm-shepherd-servic= e, > hurd-vm-disk-image): New procedures. > (hurd-in-vm-service-type): New variable. > (): New record type. > * doc/guix.texi (Virtualization Services): Document it. s/hurd-in-vm/hurd-vm/ in the commit log. Otherwise LGTM, thank you! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 12 11:05:10 2020 Received: (at 41785) by debbugs.gnu.org; 12 Jun 2020 15:05:10 +0000 Received: from localhost ([127.0.0.1]:40440 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjlF0-0005lg-Dd for submit@debbugs.gnu.org; Fri, 12 Jun 2020 11:05:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjlEz-0005lN-4J for 41785@debbugs.gnu.org; Fri, 12 Jun 2020 11:05:09 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37314) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlEr-0003y9-KE; Fri, 12 Jun 2020 11:05:01 -0400 Received: from [2a01:e0a:fa:a50:94c:bf7f:8c59:d38d] (port=33316 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jjlEq-0002eE-Ut; Fri, 12 Jun 2020 11:05:01 -0400 From: Mathieu Othacehe To: Jan Nieuwenhuizen Subject: Re: [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. References: <20200610085441.890-1-janneke@gnu.org> <87eeql9xvt.fsf@gnu.org> <87wo4d2rm5.fsf@gnu.org> Date: Fri, 12 Jun 2020 17:04:58 +0200 In-Reply-To: <87wo4d2rm5.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Thu, 11 Jun 2020 23:57:06 +0200") Message-ID: <873670l3z9.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , 41785@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hey janneke, > + (let ((target (%current-target-system))) > + (match file-system-type > + ("iso9660" iso9660-image) > + (_ (cond > + ((and target > + (hurd-triplet? target)) > + hurd-disk-image) > + (else > + efi-disk-image)))))) I think it would be safe to pass a "target" argument. Then the two actual callers could pass (current-target-system) as target argument. This is guaranteed to return a correct value, whereas %current-target-system is not here. > +@lisp > +(service hurd-vm-service-type > + (hurd-vm-configuration > + (disk-size (* 5000 (expt 2 20))) ;5G > + (memory-size 1024))) ;1024MiB That's really nice! We could really use a (guix units) module or so where we would put those definitions: "(define MiB (expt 2 20))". Then we could use: --8<---------------cut here---------------start------------->8--- (service hurd-vm-service-type (hurd-vm-configuration (disk-size (* 5 GiB) (memory-size (* 1024 MiB))) --8<---------------cut here---------------end--------------->8--- Well, this is really not a blocking thing. > +(define* (disk-image os #:key (image-size 'guess) target) > + "Return a disk-image for OS with size IMAGE-SIZE, built for TARGET." > + (let ((base-image (find-image "ext2"))) > + (system-image > + (image (inherit base-image) > + (size image-size) > + (operating-system > + (with-parameters ((%current-target-system target)) > + os)))))) Yeah then again, I think it would be nice to use something like the "hurd-disk-image" as I proposed here: https://lists.gnu.org/archive/html/guix-devel/2020-05/msg00417.html. This way, no need to call "find-image". You could just write: --8<---------------cut here---------------start------------->8--- (define (image os #:key (image-size 'guess)) (image (inherit hurd-disk-image) (size image-size) (operating-system os))) --8<---------------cut here---------------end--------------->8--- > + (image hurd-vm-configuration-image ;string > + (thunked) Then the thunked field wouldn't be required. Mostly comments related to the fact that (gnu image) needs some polishing, your patches are really nice here :) Thanks, Mathieu From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 12 11:39:30 2020 Received: (at 41785) by debbugs.gnu.org; 12 Jun 2020 15:39:30 +0000 Received: from localhost ([127.0.0.1]:40466 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjlmE-0006aF-3J for submit@debbugs.gnu.org; Fri, 12 Jun 2020 11:39:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39212) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjlmC-0006Zw-FA for 41785@debbugs.gnu.org; Fri, 12 Jun 2020 11:39:29 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37836) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlm7-0003P1-6h; Fri, 12 Jun 2020 11:39:23 -0400 Received: from [2a01:e0a:1d:7270:6a6c:dc17:fc02:cfda] (port=55044 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jjlm6-0008DZ-9p; Fri, 12 Jun 2020 11:39:22 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Mathieu Othacehe Subject: Re: [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. References: <20200610085441.890-1-janneke@gnu.org> <87eeql9xvt.fsf@gnu.org> <87a718l500.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 25 Prairial an 228 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 12 Jun 2020 17:39:20 +0200 In-Reply-To: <87a718l500.fsf@gnu.org> (Mathieu Othacehe's message of "Fri, 12 Jun 2020 16:42:55 +0200") Message-ID: <87sgf05m53.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: 41785@debbugs.gnu.org, "Jan \(janneke\) Nieuwenhuizen" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Mathieu! Mathieu Othacehe skribis: >> So, assuming =E2=80=98find-image=E2=80=99 is non-monadic, the code above= becomes >> something like: >> >> (system-image >> (image (inherit base-image) >> (size image-size) >> (operating-system >> (with-parameters ((%current-target-system "i586-pc-gnu")) >> os)))) > > I would prefer 'target' to be part of the image itself, as I proposed > here: https://lists.gnu.org/archive/html/guix-devel/2020-05/msg00417.html. > > There's no way for now, that the image is built without cross-compiling > for "i586-pc-gnu", so I think it could be part of the "image" record > itself. > > WDYT? Yes, why not, a =E2=80=98target=E2=80=99 field in sounds fine. In general, I think lowerable objects should not be parameterized by target/system. However, is an exception because it needs to access the operating system record, and still use the desired target, if any. Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 12 17:33:50 2020 Received: (at 41785) by debbugs.gnu.org; 12 Jun 2020 21:33:50 +0000 Received: from localhost ([127.0.0.1]:40633 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjrJ7-0000Va-SB for submit@debbugs.gnu.org; Fri, 12 Jun 2020 17:33:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48184) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjrJ6-0000VN-1U for 41785@debbugs.gnu.org; Fri, 12 Jun 2020 17:33:48 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45530) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjrIz-0006La-AU; Fri, 12 Jun 2020 17:33:41 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=33450 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jjrIy-0003Sr-Ik; Fri, 12 Jun 2020 17:33:40 -0400 From: Jan Nieuwenhuizen To: Mathieu Othacehe Subject: Re: [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. Organization: AvatarAcademy.nl References: <20200610085441.890-1-janneke@gnu.org> <87eeql9xvt.fsf@gnu.org> <87wo4d2rm5.fsf@gnu.org> <873670l3z9.fsf@gnu.org> X-Url: http://AvatarAcademy.nl Date: Fri, 12 Jun 2020 23:33:38 +0200 In-Reply-To: <873670l3z9.fsf@gnu.org> (Mathieu Othacehe's message of "Fri, 12 Jun 2020 17:04:58 +0200") Message-ID: <87eeqknf4d.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , 41785@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Mathieu Othacehe writes: Hello Mathieu, >> + (let ((target (%current-target-system))) >> + (match file-system-type >> + ("iso9660" iso9660-image) >> + (_ (cond >> + ((and target >> + (hurd-triplet? target)) >> + hurd-disk-image) >> + (else >> + efi-disk-image)))))) > > I think it would be safe to pass a "target" argument. Then the two > actual callers could pass (current-target-system) as target > argument. This is guaranteed to return a correct value, whereas > %current-target-system is not here. Okay, sure. I've made that change for now. >> +@lisp >> +(service hurd-vm-service-type >> + (hurd-vm-configuration >> + (disk-size (* 5000 (expt 2 20))) ;5G >> + (memory-size 1024))) ;1024MiB > > That's really nice! We could really use a (guix units) module or so > where we would put those definitions: "(define MiB (expt 2 20))". Then > we could use: > > (service hurd-vm-service-type > (hurd-vm-configuration > (disk-size (* 5 GiB) > (memory-size (* 1024 MiB))) I like it! > Well, this is really not a blocking thing. >> +(define* (disk-image os #:key (image-size 'guess) target) >> + "Return a disk-image for OS with size IMAGE-SIZE, built for TARGET." >> + (let ((base-image (find-image "ext2"))) >> + (system-image >> + (image (inherit base-image) >> + (size image-size) >> + (operating-system >> + (with-parameters ((%current-target-system target)) >> + os)))))) > > Yeah then again, I think it would be nice to use something like the > "hurd-disk-image" as I proposed here: > https://lists.gnu.org/archive/html/guix-devel/2020-05/msg00417.html. > > This way, no need to call "find-image". You could just write: > > (define (image os #:key (image-size 'guess)) > (image > (inherit hurd-disk-image) > (size image-size) > (operating-system os))) Oh yes...that's great. It seems that until we have that, as Ludo suggested with this: --8<---------------cut here---------------start------------->8--- (with-parameters ((%current-target-system target)) (system-image (image (inherit base-image) (size disk-size) (operating-system os)))))) --8<---------------cut here---------------end--------------->8--- we have now something "that works" for the Hurd. >> + (image hurd-vm-configuration-image ;string >> + (thunked) > > Then the thunked field wouldn't be required. > > Mostly comments related to the fact that (gnu image) needs some > polishing, your patches are really nice here :) Thank you. I'll be working to prepare a v3 series that works on master right now; then we can see how to proceed. Thanks! Janneke --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 12 17:34:00 2020 Received: (at 41785) by debbugs.gnu.org; 12 Jun 2020 21:34:00 +0000 Received: from localhost ([127.0.0.1]:40636 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjrJI-0000W0-7h for submit@debbugs.gnu.org; Fri, 12 Jun 2020 17:34:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48194) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjrJH-0000Vn-4j for 41785@debbugs.gnu.org; Fri, 12 Jun 2020 17:33:59 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45531) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjrJB-0006M1-SZ; Fri, 12 Jun 2020 17:33:53 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=33452 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jjrJB-0003Sy-0q; Fri, 12 Jun 2020 17:33:53 -0400 From: Jan Nieuwenhuizen To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. Organization: AvatarAcademy.nl References: <20200610085441.890-1-janneke@gnu.org> <87eeql9xvt.fsf@gnu.org> <87wo4d2rm5.fsf@gnu.org> <87imfw737z.fsf@gnu.org> X-Url: http://AvatarAcademy.nl Date: Fri, 12 Jun 2020 23:33:51 +0200 In-Reply-To: <87imfw737z.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Fri, 12 Jun 2020 16:45:04 +0200") Message-ID: <87d064nf40.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: Mathieu Othacehe , 41785@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ludovic Court=C3=A8s writes: Hello, > Jan Nieuwenhuizen skribis: > >>> It=E2=80=99s a volatile VM, due to the use of =E2=80=98-snapshot=E2=80= =99, right? >> >> By default: Yes. That seemed more ready-to-use. A stateful VM image >> would need to an out-of-store, writable copy. You can actually do that >> and modify the hurd-vm-configuration. > > It=E2=80=99s maybe worth mentioning in the manual. Ah right, I wanted to do that after your remark...but forgot. Could be an unpleasant surprise to lose everything. I've now added --8<---------------cut here---------------start------------->8--- Note that by default the VM image is volatile, i.e., once stopped the contents are lost. If you want a stateful image instead, override the configuration's @code{image} and @code{options} without the @code{--snapshot} flag using something along these lines: @lisp (service hurd-vm-service-type (hurd-vm-configuration (image (const "/out/of/store/writable/hurd.img")) (options '("--device" "rtl8139,netdev=3Dnet0" "--netdev" "user,id=3Dnet0,hostfwd=3Dtcp:127.0.0.1:20022-:2222"))= )) @end lisp --8<---------------cut here---------------end--------------->8--- to the patch. >>> (The Hurd actually has =E2=80=9Csub-Hurds=E2=80=9D=C2=B9 and =E2=80=9Cn= eighborhurds=E2=80=9D=C2=B2. I wonder if >>> it=E2=80=99s our duty to coin another term=E2=80=A6 a guesthurd? a visi= thurd?) >>> >>> =C2=B9 https://www.gnu.org/software/hurd/hurd/subhurd.html >>> =C2=B2 https://www.gnu.org/software/hurd/hurd/neighborhurd.html >> >> Oh, that's cool! Associating along from the neighborhurd pun, what >> about a "childhurd" (as a pun on childhood -- only needed while the Hurd >> is growing up)? > > =E2=80=9CChildhurd=E2=80=9D, LOVE IT! Heh; ... >> "herd start childhurd" -- hmm? In the updated patch, I still have >> hurd-vm. If we do our duty and coin "childhurd", should I just >> s/hurd-vm/childhurd/g ? > > Shepherd services can have more than one name, so I propose to have both! ... great, now lemme see where to mention this. I just put in in the code --8<---------------cut here---------------start------------->8--- (list (shepherd-service (documentation "Run the Hurd in a Virtual Machine: a Childhurd.") (provision '(hurd-vm childhurd)) --8<---------------cut here---------------end--------------->8--- and docs here --8<---------------cut here---------------start------------->8--- @example herd start hurd-vm herd stop childhurd @end example --8<---------------cut here---------------end--------------->8--- > Ooh, sadness. We can=E2=80=99t do that because the image machinery really > expects an . > > What if you move =E2=80=98with-parameters=E2=80=99 around (system-image = =E2=80=A6) instead? =3D> \o/ that works! You're genius ;-) >>>> +(define %hurd-in-vm-operating-system >> [..] >>>> + (operating-system >>>> + (service openssh-service-type >>>> + (openssh-configuration >>>> + (openssh openssh-sans-x) >> [..] >>>> + %base-services/hurd)))) >>> >>> I understand the need to factorize useful configs, but IMO it doesn=E2= =80=99t >>> belong here. So I=E2=80=99d just leave it out. There=E2=80=99s already >>> =E2=80=98%hurd-default-operating-system=E2=80=99 that does the heavy li= fting anyway. >> >> Sure, removed! Users will most probably want to add an openssh server >> using openssh-sans-x; but I guess that's something for a blog post or >> cookbook then. > > Yeah. > > Hmm, come to think about it, we need a default value here anyway, so > after all, we have a good reason to have it here. (Says the guy who > changes his mind.) Heh, it's such a pleasure working with you. I've put it back again, without the -in- bit. (says the guy who was easily convinced we didn't need it.) >> From b01b8d2a46a6a04cb8f09d74c06cbbc82878f070 Mon Sep 17 00:00:00 2001 >> From: "Jan (janneke) Nieuwenhuizen" >> Date: Thu, 11 Jun 2020 22:52:12 +0200 >> Subject: [PATCH v2 1/2] image: Make 'find-image' non-monadic. >> >> * gnu/system/image.scm (find-image): Make non-monadic. >> * gnu/tests/install.scm (run-install): Update caller. >> * guix/scripts/system.scm (perform-action): Likewise. > > [...] > >> "Find and return an image that could match the given FILE-SYSTEM-TYPE= . This >> is useful to adapt to interfaces written before the addition of the >> record." >> - (mlet %store-monad ((target (current-target-system))) >> - (mbegin %store-monad >> - (return >> - (match file-system-type >> - ("iso9660" iso9660-image) >> - (_ (cond >> - ((and target >> - (hurd-triplet? target)) >> - hurd-disk-image) >> - (else >> - efi-disk-image)))))))) >> + (let ((target (%current-target-system))) >> + (match file-system-type >> + ("iso9660" iso9660-image) >> + (_ (cond >> + ((and target >> + (hurd-triplet? target)) >> + hurd-disk-image) >> + (else >> + efi-disk-image)))))) > > I=E2=80=99d prefer: > > (define* (find-image #:optional (system (%current-system))) > =E2=80=A6) > > In your case, you=E2=80=99d need to make this call: > > (find-image "i586-gnu") > > (Beware of the triplet/system type distinction!) > > Perhaps the other call sites need to be adjusted. Then Mathieu writes > > I would prefer 'target' to be part of the image itself, as I proposed > > here: https://lists.gnu.org/archive/html/guix-devel/2020-05/msg00417.ht= ml. > > > > There's no way for now, that the image is built without cross-compiling > > for "i586-pc-gnu", so I think it could be part of the "image" record > > itself. > > > > WDYT? and Ludo writes > Yes, why not, a =E2=80=98target=E2=80=99 field in sounds fine. So...I'm sticking with a the 'target' parameter for now; as that was Mathieu's suggestion and a closer match to the final solution of moving TARGET into image. >> From e5bdf050f628cc7ea1b6bc4ccdcfeb757429820f Mon Sep 17 00:00:00 2001 >> From: "Jan (janneke) Nieuwenhuizen" >> Date: Wed, 10 Jun 2020 00:10:28 +0200 >> Subject: [PATCH v2 2/2] services: Add 'hurd-vm service-type'. >> >> * gnu/services/virtualization.scm (disk-image, hurd-in-vm-shepherd-servi= ce, >> hurd-vm-disk-image): New procedures. >> (hurd-in-vm-service-type): New variable. >> (): New record type. >> * doc/guix.texi (Virtualization Services): Document it. > > s/hurd-in-vm/hurd-vm/ in the commit log. > > Otherwise LGTM, thank you! Thanks! I'll be sending a v3 series that should be OK (apart from the image work that's not finished yet), and we can decide what to do. Greetings, Janneke --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 12 17:42:34 2020 Received: (at 41785) by debbugs.gnu.org; 12 Jun 2020 21:42:34 +0000 Received: from localhost ([127.0.0.1]:40646 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjrRS-0000iy-Py for submit@debbugs.gnu.org; Fri, 12 Jun 2020 17:42:33 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50710) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjrRR-0000ic-85 for 41785@debbugs.gnu.org; Fri, 12 Jun 2020 17:42:25 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45597) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjrRJ-0007ap-H5; Fri, 12 Jun 2020 17:42:17 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=33506 helo=dundal.fritz.box) by fencepost.gnu.org with esmtpa (Exim 4.82) (envelope-from ) id 1jjrRH-00040W-QZ; Fri, 12 Jun 2020 17:42:16 -0400 From: "Jan (janneke) Nieuwenhuizen" To: 41785@debbugs.gnu.org, =?UTF-8?q?Ludovic=20Court=C3=A8s?= , Mathieu Othacehe Subject: [PATCH v3 1/2] image: Make 'find-image' non-monadic. Date: Fri, 12 Jun 2020 23:42:13 +0200 Message-Id: <20200612214214.14112-1-janneke@gnu.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/system/image.scm (find-image): Make non-monadic. Add 'target' parameter. * gnu/tests/install.scm (run-install): Update caller, passing (%current-target-system). * guix/scripts/system.scm (perform-action): Likewise. --- gnu/system/image.scm | 22 ++++++++++------------ gnu/tests/install.scm | 6 ++++-- guix/scripts/system.scm | 3 ++- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/gnu/system/image.scm b/gnu/system/image.scm index a0e6bf31f1..ac55301a60 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2020 Mathieu Othacehe +;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -547,20 +548,17 @@ image, depending on IMAGE format." #:grub-mkrescue-environment '(("MKRESCUE_SED_MODE" . "mbr_hfs"))))))) -(define (find-image file-system-type) +(define (find-image file-system-type target) "Find and return an image that could match the given FILE-SYSTEM-TYPE. This is useful to adapt to interfaces written before the addition of the record." - (mlet %store-monad ((target (current-target-system))) - (mbegin %store-monad - (return - (match file-system-type - ("iso9660" iso9660-image) - (_ (cond - ((and target - (hurd-triplet? target)) - hurd-disk-image) - (else - efi-disk-image)))))))) + (match file-system-type + ("iso9660" iso9660-image) + (_ (cond + ((and target + (hurd-triplet? target)) + hurd-disk-image) + (else + efi-disk-image))))) ;;; image.scm ends here diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm index 6bd8c7d3d2..82098290f7 100644 --- a/gnu/tests/install.scm +++ b/gnu/tests/install.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice ;;; Copyright © 2020 Mathieu Othacehe ;;; Copyright © 2020 Danny Milosavljevic +;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -228,8 +229,9 @@ packages defined in installation-os." (mlet* %store-monad ((_ (set-grafting #f)) (system (current-system)) (target (operating-system-derivation target-os)) - (base-image (find-image - installation-disk-image-file-system-type)) + (base-image -> (find-image + installation-disk-image-file-system-type + (%current-target-system))) ;; Since the installation system has no network access, ;; we cheat a little bit by adding TARGET to its GC diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 3d7aa77cb7..6f3880cc34 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2017, 2019 Mathieu Othacehe ;;; Copyright © 2018 Ricardo Wurmus ;;; Copyright © 2019 Christopher Baines +;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -801,7 +802,7 @@ static checks." (check-initrd-modules os))) (mlet* %store-monad - ((image (find-image file-system-type)) + ((image -> (find-image file-system-type (%current-target-system))) (sys (system-derivation-for-action os image action #:file-system-type file-system-type #:image-size image-size -- Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 12 17:42:34 2020 Received: (at 41785) by debbugs.gnu.org; 12 Jun 2020 21:42:34 +0000 Received: from localhost ([127.0.0.1]:40648 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjrRa-0000j7-0L for submit@debbugs.gnu.org; Fri, 12 Jun 2020 17:42:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50716) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjrRR-0000id-H8 for 41785@debbugs.gnu.org; Fri, 12 Jun 2020 17:42:26 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45599) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjrRK-0007aw-JM; Fri, 12 Jun 2020 17:42:18 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=33506 helo=dundal.fritz.box) by fencepost.gnu.org with esmtpa (Exim 4.82) (envelope-from ) id 1jjrRJ-00040W-8j; Fri, 12 Jun 2020 17:42:17 -0400 From: "Jan (janneke) Nieuwenhuizen" To: 41785@debbugs.gnu.org, =?UTF-8?q?Ludovic=20Court=C3=A8s?= , Mathieu Othacehe Subject: [PATCH v3 2/2] services: Add 'hurd-vm service-type'. Date: Fri, 12 Jun 2020 23:42:14 +0200 Message-Id: <20200612214214.14112-2-janneke@gnu.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200612214214.14112-1-janneke@gnu.org> References: <20200612214214.14112-1-janneke@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/services/virtualization.scm (hurd-vm-shepherd-service, hurd-vm-disk-image): New procedures. (%hurd-vm-operating-system, hurd-vm-service-type): New variable. (): New record type. * doc/guix.texi (Virtualization Services): Document it. --- doc/guix.texi | 83 +++++++++++++++++++++ gnu/services/virtualization.scm | 126 ++++++++++++++++++++++++++++++-- 2 files changed, 202 insertions(+), 7 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 15e077a41c..ed36d5014b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -24583,6 +24583,89 @@ Return true if @var{obj} is a platform object. Return the name of @var{platform}---a string such as @code{"arm"}. @end deffn + +@subsubheading The Hurd in a Virtual Machine + +@cindex @code{hurd} +@cindex the Hurd + +Service @code{hurd-vm} provides support for running GNU/Hurd in a +virtual machine (VM), a so-called ``Childhurd''. The virtual machine is +a Shepherd service that can be controlled with commands such as: + +@example +herd start hurd-vm +herd stop childhurd +@end example + +The given GNU/Hurd operating system configuration is cross-compiled. + +@defvr {Scheme Variable} hurd-vm-service-type +This is the type of the Hurd in a Virtual Machine service. Its value +must be a @code{hurd-vm-configuration} object, which specifies the +operating system (@pxref{operating-system Reference}) and the disk size +for the Hurd Virtual Machine, the QEMU package to use as well as the +options for running it. + +For example: + +@lisp +(service hurd-vm-service-type + (hurd-vm-configuration + (disk-size (* 5000 (expt 2 20))) ;5G + (memory-size 1024))) ;1024MiB +@end lisp + +would create a disk image big enough to build GNU@tie{}Hello, with some +extra memory. +@end defvr + +@deftp {Data Type} hurd-vm-configuration +The data type representing the configuration for +@code{hurd-vm-service-type}. + +@table @asis +@item @code{os} (default: @var{%hurd-vm-operating-system}) +The operating system to instantiate. This default is bare-bones with a +permissive OpenSSH secure shell daemon listening on port 2222 +(@pxref{Networking Services, @code{openssh-service-type}}). + +@item @code{qemu} (default: @code{qemu-minimal}) +The QEMU package to use. + +@item @code{image} (default: @var{hurd-vm-disk-image}) +The procedure used to build the disk-image built from this +configuration. + +@item @code{disk-size} (default: @code{'guess}) +The size of the disk image. + +@item @code{memory-size} (default: @code{512}) +The memory size of the Virtual Machine in mebibytes. + +@item @code{options} (default: @code{'("--device"} @code{"rtl8139,netdev=net0"} @ + @code{"--netdev"} @ + @code{"user,id=net0,hostfwd=tcp:127.0.0.1:20022-:2222,hostfwd=tcp:127.0.0.1:25900-:5900"} @ + @code{"--snapshot"} @ + @code{"--hda")}) +The extra options for running QEMU. +@end table +@end deftp + +Note that by default the VM image is volatile, i.e., once stopped the +contents are lost. If you want a stateful image instead, override the +configuration's @code{image} and @code{options} without +the @code{--snapshot} flag using something along these lines: + +@lisp +(service hurd-vm-service-type + (hurd-vm-configuration + (image (const "/out/of/store/writable/hurd.img")) + (options '("--device" "rtl8139,netdev=net0" + "--netdev" + "user,id=net0,hostfwd=tcp:127.0.0.1:20022-:2222")))) +@end lisp + @node Version Control Services @subsection Version Control Services diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm index 989e439d5d..dc1e91b0bd 100644 --- a/gnu/services/virtualization.scm +++ b/gnu/services/virtualization.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Ryan Moe ;;; Copyright © 2018 Ludovic Courtès +;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,24 +19,41 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu services virtualization) - #:use-module (gnu services) - #:use-module (gnu services configuration) + #:use-module (gnu bootloader) + #:use-module (gnu bootloader grub) + #:use-module (gnu image) + #:use-module (gnu packages admin) + #:use-module (gnu packages ssh) + #:use-module (gnu packages virtualization) #:use-module (gnu services base) + #:use-module (gnu services configuration) #:use-module (gnu services dbus) #:use-module (gnu services shepherd) - #:use-module (gnu system shadow) + #:use-module (gnu services ssh) + #:use-module (gnu services) #:use-module (gnu system file-systems) - #:use-module (gnu packages admin) - #:use-module (gnu packages virtualization) - #:use-module (guix records) + #:use-module (gnu system hurd) + #:use-module (gnu system image) + #:use-module (gnu system shadow) + #:use-module (gnu system) + #:use-module (guix derivations) #:use-module (guix gexp) + #:use-module (guix monads) #:use-module (guix packages) + #:use-module (guix records) + #:use-module (guix store) + #:use-module (guix utils) + #:use-module (srfi srfi-9) #:use-module (srfi srfi-26) #:use-module (rnrs bytevectors) #:use-module (ice-9 match) - #:export (libvirt-configuration + #:export (%hurd-vm-operating-system + hurd-vm-configuration + hurd-vm-service-type + + libvirt-configuration libvirt-service-type virtlog-configuration virtlog-service-type @@ -773,3 +791,97 @@ given QEMU package." "This service supports transparent emulation of binaries compiled for other architectures using QEMU and the @code{binfmt_misc} functionality of the kernel Linux."))) + + +;;; +;;; The Hurd in VM service. +;;; + +(define %hurd-vm-operating-system + (operating-system + (inherit %hurd-default-operating-system) + (host-name "guixydevel") + (timezone "Europe/Amsterdam") + (bootloader (bootloader-configuration + (bootloader grub-minimal-bootloader) + (target "/dev/vda") + (timeout 0))) + (services (cons* + (service openssh-service-type + (openssh-configuration + (openssh openssh-sans-x) + (use-pam? #f) + (port-number 2222) + (permit-root-login #t) + (allow-empty-passwords? #t) + (password-authentication? #t))) + %base-services/hurd)))) + +(define-record-type* + hurd-vm-configuration make-hurd-vm-configuration + hurd-vm-configuration? + (os hurd-vm-configuration-os ; + (default %hurd-vm-operating-system)) + (qemu hurd-vm-configuration-qemu ; + (default qemu-minimal)) + (image hurd-vm-configuration-image ;string + (thunked) + (default (hurd-vm-disk-image this-record))) + (disk-size hurd-vm-configuration-disk-size ;number or 'guess + (default 'guess)) + (memory-size hurd-vm-configuration-memory-size ;number + (default 512)) + (options hurd-vm-configuration-options ;list of string + (default + `("--device" "rtl8139,netdev=net0" + "--netdev" ,(string-append + "user,id=net0" + ",hostfwd=tcp:127.0.0.1:20022-:2222" + ",hostfwd=tcp:127.0.0.1:25900-:5900") + "--snapshot" + "--hda")))) + +(define (hurd-vm-disk-image config) + "Return a disk-image for the Hurd according to CONFIG." + (let ((os (hurd-vm-configuration-os config)) + (disk-size (hurd-vm-configuration-disk-size config)) + (target (and (not (%current-target-system)) "i586-pc-gnu")) + (base-image (find-image "ext2" (%current-target-system)))) + (with-parameters ((%current-target-system target)) + (system-image + (image (inherit base-image) + (size disk-size) + (operating-system os)))))) + +(define (hurd-vm-shepherd-service config) + "Return a for a Hurd in a Virtual Machine with CONFIG." + + (let ((image (hurd-vm-configuration-image config)) + (qemu (hurd-vm-configuration-qemu config)) + (memory-size (hurd-vm-configuration-memory-size config)) + (options (hurd-vm-configuration-options config))) + + (define vm-command + #~(list + (string-append #$qemu "/bin/qemu-system-i386") + #$@(if (file-exists? "/dev/kvm") '("-enable-kvm") '()) + "-m" (number->string #$memory-size) + #$@options + #+image)) + + (list + (shepherd-service + (documentation "Run the Hurd in a Virtual Machine: a Childhurd.") + (provision '(hurd-vm childhurd)) + (requirement '(networking)) + (start #~(make-forkexec-constructor #$vm-command)) + (stop #~(make-kill-destructor)))))) + +(define hurd-vm-service-type + (service-type + (name 'hurd-vm) + (extensions (list (service-extension shepherd-root-service-type + hurd-vm-shepherd-service))) + (default-value (hurd-vm-configuration)) + (description + "Provide a Virtual Machine running the GNU/Hurd."))) -- Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 13 03:31:00 2020 Received: (at 41785) by debbugs.gnu.org; 13 Jun 2020 07:31:00 +0000 Received: from localhost ([127.0.0.1]:40777 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk0cw-0006Uu-Ji for submit@debbugs.gnu.org; Sat, 13 Jun 2020 03:30:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40468) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk0cu-0006Uh-RD for 41785@debbugs.gnu.org; Sat, 13 Jun 2020 03:30:53 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54146) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jk0cp-0002as-IA; Sat, 13 Jun 2020 03:30:47 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=33732 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jk0cj-0003xx-Nh; Sat, 13 Jun 2020 03:30:44 -0400 From: Jan Nieuwenhuizen To: Diego Nicola Barbato Subject: Re: [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type'. Organization: AvatarAcademy.nl References: <20200610085441.890-1-janneke@gnu.org> <87r1unm9xy.fsf@gnu.org> <87h7vhfk2y.fsf@gnu.org> <87tuzgyehe.fsf@gnu.org> <87v9jw8slq.fsf@GlaDOS.home> X-Url: http://AvatarAcademy.nl Date: Sat, 13 Jun 2020 09:30:39 +0200 In-Reply-To: <87v9jw8slq.fsf@GlaDOS.home> (Diego Nicola Barbato's message of "Fri, 12 Jun 2020 12:51:29 +0200") Message-ID: <87d063h17k.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.8 (-) X-Debbugs-Envelope-To: 41785 Cc: Mathieu Othacehe , 41785@debbugs.gnu.org, Marius Bakke X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) Diego Nicola Barbato writes: Hi, > Jan Nieuwenhuizen writes: > > [...] > >> and the interwebs told me that to start the VM, you have to add "-cpu >> host"; so I started it using >> >> /gnu/store/k2b7nx34cwyi6yk49wgy4hg9mrwcmll5-run-vm.sh -cpu host -m >> 2G -device rtl8139,netdev=3Dnet0 -netdev >> user,id=3Dnet0,hostfwd=3Dtcp:127.0.0.1:10022-:2222,hostfwd=3Dtcp:127.0.0= .1:25900-:25900 >> >> >> and trying to "ssh -p 20022 localhost" from inside the bare-bones VM now >> prints >> >> qemu-system-i386: Slirp: Failed to send package, ret: -1 >> qemu-system-i386: Slirp: Failed to send package, ret: -1 >> qemu-system-i386: Slirp: Failed to send package, ret: -1 >> qemu-system-i386: Slirp: Failed to send package, ret: -1 >> qemu-system-i386: Slirp: Failed to send package, ret: -1 >> qemu-system-i386: Slirp: Failed to send package, ret: -1 >> key_exchange_identification: read: Connection reset by peer >> Connection reset by 127.0.0.1 port 20022 >> >> ...something networky with QEMU. Ideas? > > I've recently had intermittent issues with 'guix system vm' and hostfwd. > Does it help if you remove the '-nic user,model=3Dvirtio-net-pci' option > from (a copy of) the run-vm.sh script so that there's only one netdev? That's helpful! I now noticed that the QEMU command above I used was the one I have been using to start the Hurd, networking wise. After running --8<---------------cut here---------------start------------->8--- ./run-vm.sh -cpu host -m 2G -net nic -net user,id=3Dnet0,hostfwd=3Dtcp:127.= 0.0.1:10022-:2222,hostfwd=3Dtcp:127.0.0.1:5900-:25900,hostfwd=3Dtcp:127.0.0= .1:20022-:20022 --8<---------------cut here---------------end--------------->8--- I noticed that instead of two network interfaces, there is now just one, as expected; much better. No luck ssh'ing into the second VM, directly or indirectly. I'm not exploring this further as we don't have an actually need for this vm-in-vm thing. Greetings, Janneke --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 13 06:57:07 2020 Received: (at 41785) by debbugs.gnu.org; 13 Jun 2020 10:57:07 +0000 Received: from localhost ([127.0.0.1]:40928 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk3qV-0003KP-9i for submit@debbugs.gnu.org; Sat, 13 Jun 2020 06:57:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36126) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk3qS-0003Js-VP for 41785@debbugs.gnu.org; Sat, 13 Jun 2020 06:57:05 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55408) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jk3qK-00015P-DQ; Sat, 13 Jun 2020 06:56:59 -0400 Received: from [2a01:e0a:fa:a50:b56f:8293:ef76:2983] (port=47704 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jk3qH-00012O-Pj; Sat, 13 Jun 2020 06:56:54 -0400 From: Mathieu Othacehe To: "Jan \(janneke\) Nieuwenhuizen" Subject: Re: [bug#41785] [PATCH v3 1/2] image: Make 'find-image' non-monadic. References: <20200610085441.890-1-janneke@gnu.org> <20200612214214.14112-1-janneke@gnu.org> Date: Sat, 13 Jun 2020 12:56:50 +0200 In-Reply-To: <20200612214214.14112-1-janneke@gnu.org> (Jan Nieuwenhuizen's message of "Fri, 12 Jun 2020 23:42:13 +0200") Message-ID: <87r1ujjkst.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: 41785@debbugs.gnu.org, Ludovic =?utf-8?Q?Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hey Jan, > (system (current-system)) > (target (operating-system-derivation target-os)) > - (base-image (find-image > - installation-disk-image-file-system-type)) > + (base-image -> (find-image > + installation-disk-image-file-system-type > + (%current-target-system))) This should be: --8<---------------cut here---------------start------------->8--- (target (current-target-system)) ... (base-image -> (find-image installation-disk-image-file-system-type target)) --8<---------------cut here---------------end--------------->8--- > + ((image -> (find-image file-system-type (%current-target-system))) > (sys (system-derivation-for-action os image action > #:file-system-type file-system-type > #:image-size image-size Same here, otherwise this look good to me. Thanks, Mathieu From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 13 08:49:34 2020 Received: (at 41785) by debbugs.gnu.org; 13 Jun 2020 12:49:34 +0000 Received: from localhost ([127.0.0.1]:41037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk5bJ-0008T8-Vz for submit@debbugs.gnu.org; Sat, 13 Jun 2020 08:49:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33124) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk5bH-0008Su-O0 for 41785@debbugs.gnu.org; Sat, 13 Jun 2020 08:49:32 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:56353) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jk5bC-00026A-Dj; Sat, 13 Jun 2020 08:49:26 -0400 Received: from [2a01:e0a:fa:a50:b56f:8293:ef76:2983] (port=49194 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jk5bB-0000iU-Oe; Sat, 13 Jun 2020 08:49:26 -0400 From: Mathieu Othacehe To: "Jan \(janneke\) Nieuwenhuizen" Subject: Re: [bug#41785] [PATCH v3 2/2] services: Add 'hurd-vm service-type'. References: <20200612214214.14112-1-janneke@gnu.org> <20200612214214.14112-2-janneke@gnu.org> Date: Sat, 13 Jun 2020 14:49:23 +0200 In-Reply-To: <20200612214214.14112-2-janneke@gnu.org> (Jan Nieuwenhuizen's message of "Fri, 12 Jun 2020 23:42:14 +0200") Message-ID: <87imfvjfl8.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: 41785@debbugs.gnu.org, Ludovic =?utf-8?Q?Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Hey! > +(define (hurd-vm-disk-image config) > + "Return a disk-image for the Hurd according to CONFIG." > + (let ((os (hurd-vm-configuration-os config)) > + (disk-size (hurd-vm-configuration-disk-size config)) > + (target (and (not (%current-target-system)) "i586-pc-gnu")) > + (base-image (find-image "ext2" (%current-target-system)))) > + (with-parameters ((%current-target-system target)) > + (system-image > + (image (inherit base-image) > + (size disk-size) > + (operating-system os)))))) With the attached patch, you could write: --8<---------------cut here---------------start------------->8--- (define (hurd-vm-disk-image config) "Return a disk-image for the Hurd according to CONFIG." (let ((os (hurd-vm-configuration-os config)) (disk-size (hurd-vm-configuration-disk-size config))) (system-image (image (inherit hurd-disk-image) (size disk-size) (operating-system os))))) --8<---------------cut here---------------end--------------->8--- WDYT? Mathieu --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-image-Add-target-support.patch >From dbcfd86a74903cb0fe77843518625436d749ed09 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Sat, 13 Jun 2020 14:01:18 +0200 Subject: [PATCH] image: Add 'target' support. * gnu/image.scm ()[target]: New field, (image-target): new public method. * gnu/system/image.scm (hurd-disk-image): Set "i586-pc-gnu" as image 'target' field, (maybe-with-target): new procedure, (system-image): honor image 'target' field using the above procedure. --- gnu/image.scm | 3 ++ gnu/system/image.scm | 66 +++++++++++++++++++++++++++----------------- 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/gnu/image.scm b/gnu/image.scm index 0a92d168e9..19b466527b 100644 --- a/gnu/image.scm +++ b/gnu/image.scm @@ -33,6 +33,7 @@ image image-name image-format + image-target image-size image-operating-system image-partitions @@ -67,6 +68,8 @@ image make-image image? (format image-format) ;symbol + (target image-target + (default #f)) (size image-size ;size in bytes as integer (default 'guess)) (operating-system image-operating-system ; diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 6c4573509d..7b45fdfea7 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -103,6 +103,7 @@ (define hurd-disk-image (image (format 'disk-image) + (target "i586-pc-gnu") (partitions (list (partition (size 'guess) @@ -518,6 +519,14 @@ it can be used for bootloading." (type root-file-system-type)) file-systems-to-keep))))) +(define-syntax-rule (maybe-with-target image exp ...) + (let ((target (image-target image))) + (if target + (with-parameters ((%current-target-system target)) + exp ...) + (begin + exp ...)))) + (define* (system-image image) "Return the derivation of IMAGE. It can be a raw disk-image or an ISO9660 image, depending on IMAGE format." @@ -529,32 +538,33 @@ image, depending on IMAGE format." (bootcfg (operating-system-bootcfg os)) (bootloader (bootloader-configuration-bootloader (operating-system-bootloader os)))) - (case (image-format image) - ((disk-image) - (system-disk-image image* - #:bootcfg bootcfg - #:bootloader bootloader - #:register-closures? register-closures? - #:inputs `(("system" ,os) - ("bootcfg" ,bootcfg)))) - ((iso9660) - (system-iso9660-image - image* - #:bootcfg bootcfg - #:bootloader bootloader - #:register-closures? register-closures? - #:inputs `(("system" ,os) - ("bootcfg" ,bootcfg)) - ;; Make sure to use a mode that does no imply - ;; HFS+ tree creation that may fail with: - ;; - ;; "libisofs: FAILURE : Too much files to mangle, - ;; cannot guarantee unique file names" - ;; - ;; This happens if some limits are exceeded, see: - ;; https://lists.gnu.org/archive/html/grub-devel/2020-06/msg00048.html - #:grub-mkrescue-environment - '(("MKRESCUE_SED_MODE" . "mbr_only"))))))) + (maybe-with-target image + (case (image-format image) + ((disk-image) + (system-disk-image image* + #:bootcfg bootcfg + #:bootloader bootloader + #:register-closures? register-closures? + #:inputs `(("system" ,os) + ("bootcfg" ,bootcfg)))) + ((iso9660) + (system-iso9660-image + image* + #:bootcfg bootcfg + #:bootloader bootloader + #:register-closures? register-closures? + #:inputs `(("system" ,os) + ("bootcfg" ,bootcfg)) + ;; Make sure to use a mode that does no imply + ;; HFS+ tree creation that may fail with: + ;; + ;; "libisofs: FAILURE : Too much files to mangle, + ;; cannot guarantee unique file names" + ;; + ;; This happens if some limits are exceeded, see: + ;; https://lists.gnu.org/archive/html/grub-devel/2020-06/msg00048.html + #:grub-mkrescue-environment + '(("MKRESCUE_SED_MODE" . "mbr_only")))))))) (define (find-image file-system-type) "Find and return an image that could match the given FILE-SYSTEM-TYPE. This @@ -572,4 +582,8 @@ record." (else efi-disk-image)))))))) +;;; Local Variables: +;;; eval: (put 'maybe-with-target 'scheme-indent-function 1) +;;; End: + ;;; image.scm ends here -- 2.24.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 13 09:05:34 2020 Received: (at 41785) by debbugs.gnu.org; 13 Jun 2020 13:05:34 +0000 Received: from localhost ([127.0.0.1]:41060 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk5qn-0000Pr-Sy for submit@debbugs.gnu.org; Sat, 13 Jun 2020 09:05:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38448) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk5qn-0000Pg-7L for 41785@debbugs.gnu.org; Sat, 13 Jun 2020 09:05:33 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:56563) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jk5qg-0004pt-Nv; Sat, 13 Jun 2020 09:05:26 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=34702 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jk5qT-0006Zj-7b; Sat, 13 Jun 2020 09:05:26 -0400 From: Jan Nieuwenhuizen To: Mathieu Othacehe Subject: Re: [bug#41785] [PATCH v3 1/2] image: Make 'find-image' non-monadic. Organization: AvatarAcademy.nl References: <20200610085441.890-1-janneke@gnu.org> <20200612214214.14112-1-janneke@gnu.org> <87r1ujjkst.fsf@gnu.org> X-Url: http://AvatarAcademy.nl Date: Sat, 13 Jun 2020 15:05:11 +0200 In-Reply-To: <87r1ujjkst.fsf@gnu.org> (Mathieu Othacehe's message of "Sat, 13 Jun 2020 12:56:50 +0200") Message-ID: <878sgrazg8.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: 41785@debbugs.gnu.org, Ludovic =?utf-8?Q?Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Mathieu Othacehe writes: Hey Mathieu, >> (system (current-system)) >> (target (operating-system-derivation target-os)) >> - (base-image (find-image >> - installation-disk-image-file-system= -type)) >> + (base-image -> (find-image >> + installation-disk-image-file-sys= tem-type >> + (%current-target-system))) > > This should be: > > (target (current-target-system)) > ... > (base-image -> (find-image > installation-disk-image-file-system-type > target)) Ah, right. Done and moved this >> (target (operating-system-derivation target-os)) down. >> + ((image -> (find-image file-system-type (%current-target-system)= )) >> (sys (system-derivation-for-action os image action >> #:file-system-type file= -system-type >> #:image-size image-size > > Same here, otherwise this look good to me. Thanks! Pushed to master as 7ca533c7237622d70b423033c4506217d9ce4014 (probably/hopefully soon to be revisited by your image-catalog feature :-) Greetings, Janneke --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 13 09:10:29 2020 Received: (at 41785) by debbugs.gnu.org; 13 Jun 2020 13:10:29 +0000 Received: from localhost ([127.0.0.1]:41064 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk5vZ-0000Wn-GI for submit@debbugs.gnu.org; Sat, 13 Jun 2020 09:10:29 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39794) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk5vX-0000Wb-MC for 41785@debbugs.gnu.org; Sat, 13 Jun 2020 09:10:28 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:56652) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jk5vR-0005Py-MI; Sat, 13 Jun 2020 09:10:21 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=34708 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jk5vQ-0006wI-OS; Sat, 13 Jun 2020 09:10:21 -0400 From: Jan Nieuwenhuizen To: Mathieu Othacehe Subject: Re: [bug#41785] [PATCH v3 2/2] services: Add 'hurd-vm service-type'. Organization: AvatarAcademy.nl References: <20200612214214.14112-1-janneke@gnu.org> <20200612214214.14112-2-janneke@gnu.org> <87imfvjfl8.fsf@gnu.org> X-Url: http://AvatarAcademy.nl Date: Sat, 13 Jun 2020 15:10:18 +0200 In-Reply-To: <87imfvjfl8.fsf@gnu.org> (Mathieu Othacehe's message of "Sat, 13 Jun 2020 14:49:23 +0200") Message-ID: <875zbvaz7p.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: 41785@debbugs.gnu.org, Ludovic =?utf-8?Q?Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Mathieu Othacehe writes: Hey Mathieu! >> +(define (hurd-vm-disk-image config) >> + "Return a disk-image for the Hurd according to CONFIG." >> + (let ((os (hurd-vm-configuration-os config)) >> + (disk-size (hurd-vm-configuration-disk-size config)) >> + (target (and (not (%current-target-system)) "i586-pc-gnu")) >> + (base-image (find-image "ext2" (%current-target-system)))) >> + (with-parameters ((%current-target-system target)) >> + (system-image >> + (image (inherit base-image) >> + (size disk-size) >> + (operating-system os)))))) > > With the attached patch, you could write: > > (define (hurd-vm-disk-image config) > "Return a disk-image for the Hurd according to CONFIG." > (let ((os (hurd-vm-configuration-os config)) > (disk-size (hurd-vm-configuration-disk-size config))) > (system-image > (image > (inherit hurd-disk-image) > (size disk-size) > (operating-system os))))) > > WDYT? I like it a lot! Ludo already said adding target to image would be a good idea. Go for it! > From dbcfd86a74903cb0fe77843518625436d749ed09 Mon Sep 17 00:00:00 2001 > From: Mathieu Othacehe > Date: Sat, 13 Jun 2020 14:01:18 +0200 > Subject: [PATCH] image: Add 'target' support. This is already one step towards the image catalog, looks good to me! Note that I found https://bugs.gnu.org/41835 so I had to revert that patch in order to test...less than great; but I didn't want to push a revert without communicating about it first. Greetings, Janneke --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 13 10:35:18 2020 Received: (at 41785) by debbugs.gnu.org; 13 Jun 2020 14:35:18 +0000 Received: from localhost ([127.0.0.1]:42361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk7Fd-0002qG-U7 for submit@debbugs.gnu.org; Sat, 13 Jun 2020 10:35:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47080) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk7Fa-0002q2-QF for 41785@debbugs.gnu.org; Sat, 13 Jun 2020 10:35:15 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57654) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jk7FU-0001oc-NU; Sat, 13 Jun 2020 10:35:08 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=44078 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jk7FT-0006j1-T5; Sat, 13 Jun 2020 10:35:08 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Mathieu Othacehe Subject: Re: [bug#41785] [PATCH v3 2/2] services: Add 'hurd-vm service-type'. References: <20200612214214.14112-1-janneke@gnu.org> <20200612214214.14112-2-janneke@gnu.org> <87imfvjfl8.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 26 Prairial an 228 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sat, 13 Jun 2020 16:35:04 +0200 In-Reply-To: <87imfvjfl8.fsf@gnu.org> (Mathieu Othacehe's message of "Sat, 13 Jun 2020 14:49:23 +0200") Message-ID: <87pna311bb.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: 41785@debbugs.gnu.org, "Jan \(janneke\) Nieuwenhuizen" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Mathieu Othacehe skribis: > +(define-syntax-rule (maybe-with-target image exp ...) > + (let ((target (image-target image))) > + (if target > + (with-parameters ((%current-target-system target)) > + exp ...) > + (begin > + exp ...)))) I think you don=E2=80=99t need the =E2=80=98if=E2=80=99 here. But then may= be you don=E2=80=99t need the macro either since you can always write: (with-parameters ((%current-target-system (image-target image))) =E2=80=A6) Anyway, all this looks great to me! :-) Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 13 11:02:07 2020 Received: (at 41785) by debbugs.gnu.org; 13 Jun 2020 15:02:07 +0000 Received: from localhost ([127.0.0.1]:42389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk7fb-0003Vn-4V for submit@debbugs.gnu.org; Sat, 13 Jun 2020 11:02:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk7fY-0003VI-Sc for 41785@debbugs.gnu.org; Sat, 13 Jun 2020 11:02:05 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58177) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jk7fS-0005os-EA; Sat, 13 Jun 2020 11:01:58 -0400 Received: from [2a01:e0a:fa:a50:b56f:8293:ef76:2983] (port=56286 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jk7fI-0001Ah-Fm; Sat, 13 Jun 2020 11:01:56 -0400 From: Mathieu Othacehe To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#41785] [PATCH v3 2/2] services: Add 'hurd-vm service-type'. References: <20200612214214.14112-1-janneke@gnu.org> <20200612214214.14112-2-janneke@gnu.org> <87imfvjfl8.fsf@gnu.org> <87pna311bb.fsf@gnu.org> Date: Sat, 13 Jun 2020 17:01:46 +0200 In-Reply-To: <87pna311bb.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sat, 13 Jun 2020 16:35:04 +0200") Message-ID: <871rmjj9gl.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: 41785@debbugs.gnu.org, "Jan \(janneke\) Nieuwenhuizen" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hey Ludo, > I think you don=E2=80=99t need the =E2=80=98if=E2=80=99 here. But then m= aybe you don=E2=80=99t need the > macro either since you can always write: Thanks for the quick review :) You're right it's not needed, I just removed it. Mathieu From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 14 08:10:57 2020 Received: (at 41785) by debbugs.gnu.org; 14 Jun 2020 12:10:57 +0000 Received: from localhost ([127.0.0.1]:43026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkRTU-0002Dd-Qn for submit@debbugs.gnu.org; Sun, 14 Jun 2020 08:10:57 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59696) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkRTS-0002DP-N7 for 41785@debbugs.gnu.org; Sun, 14 Jun 2020 08:10:55 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:43938) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkRTM-0006ai-Mk; Sun, 14 Jun 2020 08:10:48 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=45692 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jkRTL-0003KT-Mm; Sun, 14 Jun 2020 08:10:48 -0400 From: Jan Nieuwenhuizen To: Mathieu Othacehe Subject: [PATCH v4] services: Add 'hurd-in-vm service-type'. Organization: AvatarAcademy.nl References: <20200610085441.890-1-janneke@gnu.org> <87eeql9xvt.fsf@gnu.org> <87wo4d2rm5.fsf@gnu.org> <873670l3z9.fsf@gnu.org> <87eeqknf4d.fsf@gnu.org> X-Url: http://AvatarAcademy.nl Date: Sun, 14 Jun 2020 14:10:45 +0200 In-Reply-To: <87eeqknf4d.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Fri, 12 Jun 2020 23:33:38 +0200") Message-ID: <878sgpg856.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , 41785@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Jan Nieuwenhuizen writes: Hello, > we have now something "that works" for the Hurd. Hmm...that was too fast; apparently I fooled myself last Friday. Anyway, I found it! Using this --8<---------------cut here---------------start------------->8--- (define (hurd-vm-disk-image config) "Return a disk-image for the Hurd according to CONFIG." (with-parameters ((%current-target-system "i586-pc-gnu")) (let ((os (hurd-vm-configuration-os config)) (disk-size (hurd-vm-configuration-disk-size config))) (system-image (image (inherit hurd-disk-image) (size disk-size) (operating-system os)))))) --8<---------------cut here---------------end--------------->8--- almost worked...but it goes wrong cross-building the services. In gnu/services/shepherd.scm's scm->go, we were bitten by --8<---------------cut here---------------start------------->8--- (define (scm->go file) ;; FIXME: %current-target-system may not be bound (let ((target (%current-target-system))) (with-extensions (list shepherd) --8<---------------cut here---------------end--------------->8--- ...but we now have let-system; so using --8<---------------cut here---------------start------------->8--- diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm index 77c4d0a8be..e14ceca231 100644 --- a/gnu/services/shepherd.scm +++ b/gnu/services/shepherd.scm @@ -266,8 +266,7 @@ stored." (define (scm->go file) "Compile FILE, which contains code to be loaded by shepherd's config file, and return the resulting '.go' file." - ;; FIXME: %current-target-system may not be bound - (let ((target (%current-target-system))) + (let-system (system target) (with-extensions (list shepherd) (computed-file (string-append (basename (scheme-file-name file) ".scm") ".go") --8<---------------cut here---------------end--------------->8--- produces a working hurd-vm service! New patch attached, I intend to push to master once rebased, all the tests pass, etc. ;-) Phew, thank you! Greetings, Janneke --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=v4-0001-services-Add-hurd-vm-service-type.patch Content-Transfer-Encoding: quoted-printable >From ef424afa4bc83a3e7fc7ff2ac831de02c2022c73 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Wed, 10 Jun 2020 00:10:28 +0200 Subject: [PATCH v4] services: Add 'hurd-vm service-type'. * gnu/services/virtualization.scm (hurd-vm-shepherd-service, hurd-vm-disk-image): New procedures. (%hurd-vm-operating-system, hurd-vm-service-type): New variables. (): 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. --- doc/guix.texi | 83 +++++++++++++++++++++ gnu/services/shepherd.scm | 3 +- gnu/services/virtualization.scm | 125 ++++++++++++++++++++++++++++++-- 3 files changed, 202 insertions(+), 9 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 15e077a41c..ed36d5014b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -24583,6 +24583,89 @@ Return true if @var{obj} is a platform object. Return the name of @var{platform}---a string such as @code{"arm"}. @end deffn =20 + +@subsubheading The Hurd in a Virtual Machine + +@cindex @code{hurd} +@cindex the Hurd + +Service @code{hurd-vm} provides support for running GNU/Hurd in a +virtual machine (VM), a so-called ``Childhurd''. The virtual machine is +a Shepherd service that can be controlled with commands such as: + +@example +herd start hurd-vm +herd stop childhurd +@end example + +The given GNU/Hurd operating system configuration is cross-compiled. + +@defvr {Scheme Variable} hurd-vm-service-type +This is the type of the Hurd in a Virtual Machine service. Its value +must be a @code{hurd-vm-configuration} object, which specifies the +operating system (@pxref{operating-system Reference}) and the disk size +for the Hurd Virtual Machine, the QEMU package to use as well as the +options for running it. + +For example: + +@lisp +(service hurd-vm-service-type + (hurd-vm-configuration + (disk-size (* 5000 (expt 2 20))) ;5G + (memory-size 1024))) ;1024MiB +@end lisp + +would create a disk image big enough to build GNU@tie{}Hello, with some +extra memory. +@end defvr + +@deftp {Data Type} hurd-vm-configuration +The data type representing the configuration for +@code{hurd-vm-service-type}. + +@table @asis +@item @code{os} (default: @var{%hurd-vm-operating-system}) +The operating system to instantiate. This default is bare-bones with a +permissive OpenSSH secure shell daemon listening on port 2222 +(@pxref{Networking Services, @code{openssh-service-type}}). + +@item @code{qemu} (default: @code{qemu-minimal}) +The QEMU package to use. + +@item @code{image} (default: @var{hurd-vm-disk-image}) +The procedure used to build the disk-image built from this +configuration. + +@item @code{disk-size} (default: @code{'guess}) +The size of the disk image. + +@item @code{memory-size} (default: @code{512}) +The memory size of the Virtual Machine in mebibytes. + +@item @code{options} (default: @code{'("--device"} @code{"rtl8139,netdev= =3Dnet0"} @ + @code{"--netdev"} @ + @code{"user,id=3Dnet0,hostfwd=3Dtcp:127.0.0.1:20022-:2222,hostfwd=3D= tcp:127.0.0.1:25900-:5900"} @ + @code{"--snapshot"} @ + @code{"--hda")}) +The extra options for running QEMU. +@end table +@end deftp + +Note that by default the VM image is volatile, i.e., once stopped the +contents are lost. If you want a stateful image instead, override the +configuration's @code{image} and @code{options} without +the @code{--snapshot} flag using something along these lines: + +@lisp +(service hurd-vm-service-type + (hurd-vm-configuration + (image (const "/out/of/store/writable/hurd.img")) + (options '("--device" "rtl8139,netdev=3Dnet0" + "--netdev" + "user,id=3Dnet0,hostfwd=3Dtcp:127.0.0.1:20022-:2222")= ))) +@end lisp + @node Version Control Services @subsection Version Control Services =20 diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm index 77c4d0a8be..e14ceca231 100644 --- a/gnu/services/shepherd.scm +++ b/gnu/services/shepherd.scm @@ -266,8 +266,7 @@ stored." (define (scm->go file) "Compile FILE, which contains code to be loaded by shepherd's config fil= e, and return the resulting '.go' file." - ;; FIXME: %current-target-system may not be bound - (let ((target (%current-target-system))) + (let-system (system target) (with-extensions (list shepherd) (computed-file (string-append (basename (scheme-file-name file) ".sc= m") ".go") diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.= scm index 989e439d5d..98b94f7464 100644 --- a/gnu/services/virtualization.scm +++ b/gnu/services/virtualization.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2017 Ryan Moe ;;; Copyright =C2=A9 2018 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,24 +19,41 @@ ;;; along with GNU Guix. If not, see . =20 (define-module (gnu services virtualization) - #:use-module (gnu services) - #:use-module (gnu services configuration) + #:use-module (gnu bootloader) + #:use-module (gnu bootloader grub) + #:use-module (gnu image) + #:use-module (gnu packages admin) + #:use-module (gnu packages ssh) + #:use-module (gnu packages virtualization) #:use-module (gnu services base) + #:use-module (gnu services configuration) #:use-module (gnu services dbus) #:use-module (gnu services shepherd) - #:use-module (gnu system shadow) + #:use-module (gnu services ssh) + #:use-module (gnu services) #:use-module (gnu system file-systems) - #:use-module (gnu packages admin) - #:use-module (gnu packages virtualization) - #:use-module (guix records) + #:use-module (gnu system hurd) + #:use-module (gnu system image) + #:use-module (gnu system shadow) + #:use-module (gnu system) + #:use-module (guix derivations) #:use-module (guix gexp) + #:use-module (guix monads) #:use-module (guix packages) + #:use-module (guix records) + #:use-module (guix store) + #:use-module (guix utils) + #:use-module (srfi srfi-9) #:use-module (srfi srfi-26) #:use-module (rnrs bytevectors) #:use-module (ice-9 match) =20 - #:export (libvirt-configuration + #:export (%hurd-vm-operating-system + hurd-vm-configuration + hurd-vm-service-type + + libvirt-configuration libvirt-service-type virtlog-configuration virtlog-service-type @@ -773,3 +791,96 @@ given QEMU package." "This service supports transparent emulation of binaries compiled for other architectures using QEMU and the @code{binfmt_misc} functionality of the kernel Linux."))) + + +;;; +;;; The Hurd in VM service: a Childhurd. +;;; + +(define %hurd-vm-operating-system + (operating-system + (inherit %hurd-default-operating-system) + (host-name "childhurd") + (timezone "Europe/Amsterdam") + (bootloader (bootloader-configuration + (bootloader grub-minimal-bootloader) + (target "/dev/vda") + (timeout 0))) + (services (cons* + (service openssh-service-type + (openssh-configuration + (openssh openssh-sans-x) + (use-pam? #f) + (port-number 2222) + (permit-root-login #t) + (allow-empty-passwords? #t) + (password-authentication? #t))) + %base-services/hurd)))) + +(define-record-type* + hurd-vm-configuration make-hurd-vm-configuration + hurd-vm-configuration? + (os hurd-vm-configuration-os ; + (default %hurd-vm-operating-system)) + (qemu hurd-vm-configuration-qemu ; + (default qemu-minimal)) + (image hurd-vm-configuration-image ;string + (thunked) + (default (hurd-vm-disk-image this-record))) + (disk-size hurd-vm-configuration-disk-size ;number or 'guess + (default 'guess)) + (memory-size hurd-vm-configuration-memory-size ;number + (default 512)) + (options hurd-vm-configuration-options ;list of string + (default + `("--device" "rtl8139,netdev=3Dnet0" + "--netdev" ,(string-append + "user,id=3Dnet0" + ",hostfwd=3Dtcp:127.0.0.1:20022-:2222" + ",hostfwd=3Dtcp:127.0.0.1:25900-:5900") + "--snapshot" + "--hda")))) + +(define (hurd-vm-disk-image config) + "Return a disk-image for the Hurd according to CONFIG." + (with-parameters ((%current-target-system "i586-pc-gnu")) + (let ((os (hurd-vm-configuration-os config)) + (disk-size (hurd-vm-configuration-disk-size config))) + (system-image + (image + (inherit hurd-disk-image) + (size disk-size) + (operating-system os)))))) + +(define (hurd-vm-shepherd-service config) + "Return a for a Hurd in a Virtual Machine with CONFIG= ." + + (let ((image (hurd-vm-configuration-image config)) + (qemu (hurd-vm-configuration-qemu config)) + (memory-size (hurd-vm-configuration-memory-size config)) + (options (hurd-vm-configuration-options config))) + + (define vm-command + #~(list + (string-append #$qemu "/bin/qemu-system-i386") + #$@(if (file-exists? "/dev/kvm") '("--enable-kvm") '()) + "-m" (number->string #$memory-size) + #$@options + #+image)) + + (list + (shepherd-service + (documentation "Run the Hurd in a Virtual Machine: a Childhurd.") + (provision '(hurd-vm childhurd)) + (requirement '(networking)) + (start #~(make-forkexec-constructor #$vm-command)) + (stop #~(make-kill-destructor)))))) + +(define hurd-vm-service-type + (service-type + (name 'hurd-vm) + (extensions (list (service-extension shepherd-root-service-type + hurd-vm-shepherd-service))) + (default-value (hurd-vm-configuration)) + (description + "Provide a Virtual Machine running the GNU/Hurd."))) --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 14 08:38:08 2020 Received: (at 41785) by debbugs.gnu.org; 14 Jun 2020 12:38:08 +0000 Received: from localhost ([127.0.0.1]:43093 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkRtn-0002uL-SK for submit@debbugs.gnu.org; Sun, 14 Jun 2020 08:38:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41090) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkRtl-0002tr-Sw for 41785@debbugs.gnu.org; Sun, 14 Jun 2020 08:38:06 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44250) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkRtg-0002YP-Jg; Sun, 14 Jun 2020 08:38:00 -0400 Received: from [2a01:e0a:fa:a50:d869:cbcf:2456:40cc] (port=38842 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jkRtg-0000qt-46; Sun, 14 Jun 2020 08:38:00 -0400 From: Mathieu Othacehe To: Jan Nieuwenhuizen Subject: Re: [bug#41785] [PATCH v3 1/2] image: Make 'find-image' non-monadic. References: <20200610085441.890-1-janneke@gnu.org> <20200612214214.14112-1-janneke@gnu.org> <87r1ujjkst.fsf@gnu.org> <878sgrazg8.fsf@gnu.org> Date: Sun, 14 Jun 2020 14:37:58 +0200 In-Reply-To: <878sgrazg8.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Sat, 13 Jun 2020 15:05:11 +0200") Message-ID: <87imftkel5.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: 41785@debbugs.gnu.org, Ludovic =?utf-8?Q?Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Hey! >>> + ((image -> (find-image file-system-type (%current-target-system))) >>> (sys (system-derivation-for-action os image action >>> #:file-system-type file-system-type >>> #:image-size image-size >> >> Same here, otherwise this look good to me. I missed something, "target" variable is shadowing the "target" argument. The attached patch should fix the issue, I'm testing it. Thanks, Mathieu --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-scripts-system-Fix-init-command.patch >From 760e46d2ff57fab2b67656b85d800572bbc56f4b Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Sun, 14 Jun 2020 14:16:37 +0200 Subject: [PATCH] scripts: system: Fix "init" command. This is a follow-up of 7ca533c7237622d70b423033c4506217d9ce4014. The introduced "target" variable is shadowing the target argument. * guix/scripts/system.scm (perform-action): Rename "target" variable to "target*". --- guix/scripts/system.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 6769a602b1..212b49f008 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -802,8 +802,8 @@ static checks." (check-initrd-modules os))) (mlet* %store-monad - ((target (current-target-system)) - (image -> (find-image file-system-type target)) + ((target* (current-target-system)) + (image -> (find-image file-system-type target*)) (sys (system-derivation-for-action os image action #:file-system-type file-system-type #:image-size image-size -- 2.26.2 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 14 08:44:50 2020 Received: (at 41785) by debbugs.gnu.org; 14 Jun 2020 12:44:50 +0000 Received: from localhost ([127.0.0.1]:43097 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkS0H-00033g-Kz for submit@debbugs.gnu.org; Sun, 14 Jun 2020 08:44:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44576) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkS0F-00033S-Sy for 41785@debbugs.gnu.org; Sun, 14 Jun 2020 08:44:48 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44264) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkS0A-0003bS-1j; Sun, 14 Jun 2020 08:44:42 -0400 Received: from [2a01:e0a:fa:a50:d869:cbcf:2456:40cc] (port=38880 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jkS09-0001BR-Gz; Sun, 14 Jun 2020 08:44:41 -0400 From: Mathieu Othacehe To: Jan Nieuwenhuizen Subject: Re: [bug#41785] [PATCH v4] services: Add 'hurd-in-vm service-type'. References: <20200610085441.890-1-janneke@gnu.org> <87eeql9xvt.fsf@gnu.org> <87wo4d2rm5.fsf@gnu.org> <873670l3z9.fsf@gnu.org> <87eeqknf4d.fsf@gnu.org> <878sgpg856.fsf_-_@gnu.org> Date: Sun, 14 Jun 2020 14:44:38 +0200 In-Reply-To: <878sgpg856.fsf_-_@gnu.org> (Jan Nieuwenhuizen's message of "Sun, 14 Jun 2020 14:10:45 +0200") Message-ID: <87eeqhkea1.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , 41785@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hey janneke! > (define (hurd-vm-disk-image config) > "Return a disk-image for the Hurd according to CONFIG." > (with-parameters ((%current-target-system "i586-pc-gnu")) > (let ((os (hurd-vm-configuration-os config)) > (disk-size (hurd-vm-configuration-disk-size config))) > (system-image > (image > (inherit hurd-disk-image) > (size disk-size) > (operating-system os)))))) Nice! I'm not sure why we still need the "with-parameters" call because, it's done first thing in "system-image". I'd like to understand this before proceeding, do you have a branch where I could test it? > - ;; FIXME: %current-target-system may not be bound > - (let ((target (%current-target-system))) > + (let-system (system target) > (with-extensions (list shepherd) > (computed-file (string-append (basename (scheme-file-name file) ".scm") > ".go") > > produces a working hurd-vm service! Good catch! Thanks, Mathieu From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 14 09:12:22 2020 Received: (at 41785) by debbugs.gnu.org; 14 Jun 2020 13:12:22 +0000 Received: from localhost ([127.0.0.1]:43109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkSQw-0003hQ-6b for submit@debbugs.gnu.org; Sun, 14 Jun 2020 09:12:22 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34520) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkSQu-0003hB-KW for 41785@debbugs.gnu.org; Sun, 14 Jun 2020 09:12:21 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44617) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkSQp-00009Y-EG; Sun, 14 Jun 2020 09:12:15 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=47524 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jkSQo-0003hz-GF; Sun, 14 Jun 2020 09:12:14 -0400 From: Jan Nieuwenhuizen To: Mathieu Othacehe Subject: Re: [bug#41785] [PATCH v3 1/2] image: Make 'find-image' non-monadic. Organization: AvatarAcademy.nl References: <20200610085441.890-1-janneke@gnu.org> <20200612214214.14112-1-janneke@gnu.org> <87r1ujjkst.fsf@gnu.org> <878sgrazg8.fsf@gnu.org> <87imftkel5.fsf@gnu.org> X-Url: http://AvatarAcademy.nl Date: Sun, 14 Jun 2020 15:12:11 +0200 In-Reply-To: <87imftkel5.fsf@gnu.org> (Mathieu Othacehe's message of "Sun, 14 Jun 2020 14:37:58 +0200") Message-ID: <87tuzdeqqc.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: 41785@debbugs.gnu.org, Ludovic =?utf-8?Q?Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Mathieu Othacehe writes: Hi Mathieu, >>>> + ((image -> (find-image file-system-type (%current-target-syste= m))) >>>> (sys (system-derivation-for-action os image action >>>> #:file-system-type fi= le-system-type >>>> #:image-size image-si= ze >>> >>> Same here, otherwise this look good to me. > > I missed something, "target" variable is shadowing the "target" > argument. The attached patch should fix the issue, I'm testing it. Oops! > From 760e46d2ff57fab2b67656b85d800572bbc56f4b Mon Sep 17 00:00:00 2001 > From: Mathieu Othacehe > Date: Sun, 14 Jun 2020 14:16:37 +0200 > Subject: [PATCH] scripts: system: Fix "init" command. > > This is a follow-up of 7ca533c7237622d70b423033c4506217d9ce4014. The > introduced "target" variable is shadowing the target argument. > > * guix/scripts/system.scm (perform-action): Rename "target" variable to > "target*". > --- > guix/scripts/system.scm | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm > index 6769a602b1..212b49f008 100644 > --- a/guix/scripts/system.scm > +++ b/guix/scripts/system.scm > @@ -802,8 +802,8 @@ static checks." > (check-initrd-modules os))) >=20=20 > (mlet* %store-monad > - ((target (current-target-system)) > - (image -> (find-image file-system-type target)) > + ((target* (current-target-system)) > + (image -> (find-image file-system-type target*)) > (sys (system-derivation-for-action os image action > #:file-system-type file-= system-type > #:image-size image-size Yeah, that looks right! I didn't notice either. I could have been more careful/suspicious, as in the other, similar case in gnu/tests/install.scm I moved (target (operating-system-derivation target-os)) down to have mlet* do the shadowing properly. Janneke --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 14 09:18:29 2020 Received: (at 41785) by debbugs.gnu.org; 14 Jun 2020 13:18:29 +0000 Received: from localhost ([127.0.0.1]:43113 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkSWq-0003qf-V7 for submit@debbugs.gnu.org; Sun, 14 Jun 2020 09:18:29 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36746) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkSWp-0003qS-1J for 41785@debbugs.gnu.org; Sun, 14 Jun 2020 09:18:28 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44702) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkSWi-000163-VC; Sun, 14 Jun 2020 09:18:20 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=47530 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jkSWi-000474-2X; Sun, 14 Jun 2020 09:18:20 -0400 From: Jan Nieuwenhuizen To: Mathieu Othacehe Subject: Re: [bug#41785] [PATCH v4] services: Add 'hurd-in-vm service-type'. Organization: AvatarAcademy.nl References: <20200610085441.890-1-janneke@gnu.org> <87eeql9xvt.fsf@gnu.org> <87wo4d2rm5.fsf@gnu.org> <873670l3z9.fsf@gnu.org> <87eeqknf4d.fsf@gnu.org> <878sgpg856.fsf_-_@gnu.org> <87eeqhkea1.fsf@gnu.org> X-Url: http://AvatarAcademy.nl Date: Sun, 14 Jun 2020 15:18:18 +0200 In-Reply-To: <87eeqhkea1.fsf@gnu.org> (Mathieu Othacehe's message of "Sun, 14 Jun 2020 14:44:38 +0200") Message-ID: <87o8pleqg5.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , 41785@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Mathieu Othacehe writes: Hey Mathieu, >> (define (hurd-vm-disk-image config) >> "Return a disk-image for the Hurd according to CONFIG." >> (with-parameters ((%current-target-system "i586-pc-gnu")) >> (let ((os (hurd-vm-configuration-os config)) >> (disk-size (hurd-vm-configuration-disk-size config))) >> (system-image >> (image >> (inherit hurd-disk-image) >> (size disk-size) >> (operating-system os)))))) > > Nice! I'm not sure why we still need the "with-parameters" call because, > it's done first thing in "system-image". I'd like to understand this > before proceeding, do you have a branch where I could test it? It's on my gitlab master...almost ready to push ;-) Initially I did not have this "with-parameters", but then in gnu/system.scm: --8<---------------cut here---------------start------------->8--- (define (hurd-multiboot-modules os) ... (libc (if target (with-parameters ((%current-target-system #f)) ;; TODO: cross-libc has extra patches for the Hurd; ;; remove in next rebuild cycle (cross-libc target)) glibc)) --8<---------------cut here---------------end--------------->8--- we take the ELSE branch here -- and that does not work. AIUI, this is really a temporary kludge until the next rebuild cycle we can move some hurd-specific glibc patches from cross-libc to glibc-proper. ...but it's tricky to see how this all plays together, not entirely clear to me anyway... >> - ;; FIXME: %current-target-system may not be bound >> - (let ((target (%current-target-system))) >> + (let-system (system target) >> (with-extensions (list shepherd) >> (computed-file (string-append (basename (scheme-file-name file) "= .scm") >> ".go") >> >> produces a working hurd-vm service! > > Good catch! :-) Almost there... Janneke --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 14 09:32:20 2020 Received: (at 41785) by debbugs.gnu.org; 14 Jun 2020 13:32:20 +0000 Received: from localhost ([127.0.0.1]:43139 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkSkF-0004D9-Vl for submit@debbugs.gnu.org; Sun, 14 Jun 2020 09:32:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41474) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkSkE-0004Cv-HQ for 41785@debbugs.gnu.org; Sun, 14 Jun 2020 09:32:19 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45091) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkSk9-0003TP-1T; Sun, 14 Jun 2020 09:32:13 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=47558 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jkSk8-0002kt-7i; Sun, 14 Jun 2020 09:32:12 -0400 From: Jan Nieuwenhuizen To: Mathieu Othacehe Subject: Re: [bug#41785] [PATCH v3 1/2] image: Make 'find-image' non-monadic. Organization: AvatarAcademy.nl References: <20200610085441.890-1-janneke@gnu.org> <20200612214214.14112-1-janneke@gnu.org> <87r1ujjkst.fsf@gnu.org> <878sgrazg8.fsf@gnu.org> <87imftkel5.fsf@gnu.org> <87tuzdeqqc.fsf@gnu.org> X-Url: http://AvatarAcademy.nl Date: Sun, 14 Jun 2020 15:32:09 +0200 In-Reply-To: <87tuzdeqqc.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Sun, 14 Jun 2020 15:12:11 +0200") Message-ID: <87k109ept2.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: 41785@debbugs.gnu.org, Ludovic =?utf-8?Q?Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Jan Nieuwenhuizen writes: Hello again, >>>>> + ((image -> (find-image file-system-type (%current-target-syst= em))) >>>>> (sys (system-derivation-for-action os image action >>>>> #:file-system-type f= ile-system-type >>>>> #:image-size image-s= ize >>>> >>>> Same here, otherwise this look good to me. >> >> I missed something, "target" variable is shadowing the "target" >> argument. The attached patch should fix the issue, I'm testing it. > > Oops! > >> From 760e46d2ff57fab2b67656b85d800572bbc56f4b Mon Sep 17 00:00:00 2001 >> From: Mathieu Othacehe >> Date: Sun, 14 Jun 2020 14:16:37 +0200 >> Subject: [PATCH] scripts: system: Fix "init" command. Just to confirm that this fixes make check-system TESTS=3D"installed-extlinux-os" failing early, where it now possibly fails for lack of disk space...retrying... Janneke --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 14 11:44:17 2020 Received: (at 41785) by debbugs.gnu.org; 14 Jun 2020 15:44:17 +0000 Received: from localhost ([127.0.0.1]:44320 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkUnx-0001N9-8g for submit@debbugs.gnu.org; Sun, 14 Jun 2020 11:44:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44844) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkUnv-0001Mw-Im for 41785@debbugs.gnu.org; Sun, 14 Jun 2020 11:44:15 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47542) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkUnp-0006TJ-Iq; Sun, 14 Jun 2020 11:44:09 -0400 Received: from [2a01:e0a:fa:a50:915b:bab1:f4c6:afb3] (port=57710 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jkUnp-0002lq-5Z; Sun, 14 Jun 2020 11:44:09 -0400 From: Mathieu Othacehe To: Jan Nieuwenhuizen Subject: Re: [bug#41785] [PATCH v3 1/2] image: Make 'find-image' non-monadic. References: <20200610085441.890-1-janneke@gnu.org> <20200612214214.14112-1-janneke@gnu.org> <87r1ujjkst.fsf@gnu.org> <878sgrazg8.fsf@gnu.org> <87imftkel5.fsf@gnu.org> <87tuzdeqqc.fsf@gnu.org> <87k109ept2.fsf@gnu.org> Date: Sun, 14 Jun 2020 17:44:06 +0200 In-Reply-To: <87k109ept2.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Sun, 14 Jun 2020 15:32:09 +0200") Message-ID: <87a715k5yx.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: 41785@debbugs.gnu.org, Ludovic =?utf-8?Q?Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Just to confirm that this fixes > > make check-system TESTS="installed-extlinux-os" Ok, thanks for checking. I pushed this one. > failing early, where it now possibly fails for lack of disk > space...retrying... Yup, that's another issue I'm working on! Thanks, Mathieu From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 14 11:52:30 2020 Received: (at 41785) by debbugs.gnu.org; 14 Jun 2020 15:52:30 +0000 Received: from localhost ([127.0.0.1]:44337 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkUvt-0001bF-Vp for submit@debbugs.gnu.org; Sun, 14 Jun 2020 11:52:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47944) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkUvt-0001b2-1t for 41785@debbugs.gnu.org; Sun, 14 Jun 2020 11:52:29 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47656) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkUvn-0007hi-CD; Sun, 14 Jun 2020 11:52:23 -0400 Received: from [2a01:e0a:fa:a50:915b:bab1:f4c6:afb3] (port=57792 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jkUvm-0003G3-8c; Sun, 14 Jun 2020 11:52:23 -0400 From: Mathieu Othacehe To: Jan Nieuwenhuizen Subject: Re: [bug#41785] [PATCH v4] services: Add 'hurd-in-vm service-type'. References: <20200610085441.890-1-janneke@gnu.org> <87eeql9xvt.fsf@gnu.org> <87wo4d2rm5.fsf@gnu.org> <873670l3z9.fsf@gnu.org> <87eeqknf4d.fsf@gnu.org> <878sgpg856.fsf_-_@gnu.org> <87eeqhkea1.fsf@gnu.org> <87o8pleqg5.fsf@gnu.org> Date: Sun, 14 Jun 2020 17:52:19 +0200 In-Reply-To: <87o8pleqg5.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Sun, 14 Jun 2020 15:18:18 +0200") Message-ID: <875zbtk5l8.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , 41785@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > (define (hurd-multiboot-modules os) > ... > (libc (if target > (with-parameters ((%current-target-system #f)) > ;; TODO: cross-libc has extra patches for the Hurd; > ;; remove in next rebuild cycle > (cross-libc target)) > glibc)) > > we take the ELSE branch here -- and that does not work. AIUI, this is > really a temporary kludge until the next rebuild cycle we can move some > hurd-specific glibc patches from cross-libc to glibc-proper. Oh, I know why! In "system-image", there are a few calls, in the first let, that are outside the "with-parameters", in particular "bootcfg" which triggers the problem you are describing above. Maybe something as naive as: --8<---------------cut here---------------start------------->8--- diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 1bda25fd7f..8a3c4e22d9 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -525,14 +525,14 @@ it can be used for bootloading." image, depending on IMAGE format." (define substitutable? (image-substitutable? image)) - (let* ((os (operating-system-for-image image)) - (image* (image-with-os image os)) - (target (image-target image)) - (register-closures? (has-guix-service-type? os)) - (bootcfg (operating-system-bootcfg os)) - (bootloader (bootloader-configuration-bootloader - (operating-system-bootloader os)))) - (with-parameters ((%current-target-system target)) + (with-parameters ((%current-target-system target)) + (let* ((os (operating-system-for-image image)) + (image* (image-with-os image os)) + (target (image-target image)) + (register-closures? (has-guix-service-type? os)) + (bootcfg (operating-system-bootcfg os)) + (bootloader (bootloader-configuration-bootloader + (operating-system-bootloader os)))) --8<---------------cut here---------------end--------------->8--- would do the trick. Thanks, Mathieu From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 14 12:23:05 2020 Received: (at 41785) by debbugs.gnu.org; 14 Jun 2020 16:23:05 +0000 Received: from localhost ([127.0.0.1]:44375 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkVPU-0002MR-Pn for submit@debbugs.gnu.org; Sun, 14 Jun 2020 12:23:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35496) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkVPT-0002Ll-E2 for 41785@debbugs.gnu.org; Sun, 14 Jun 2020 12:23:03 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48217) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkVPO-00057p-5m; Sun, 14 Jun 2020 12:22:58 -0400 Received: from [2a01:e0a:fa:a50:915b:bab1:f4c6:afb3] (port=58094 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jkVPN-00062f-3a; Sun, 14 Jun 2020 12:22:57 -0400 From: Mathieu Othacehe To: Jan Nieuwenhuizen Subject: Re: [bug#41785] [PATCH v4] services: Add 'hurd-in-vm service-type'. References: <20200610085441.890-1-janneke@gnu.org> <87eeql9xvt.fsf@gnu.org> <87wo4d2rm5.fsf@gnu.org> <873670l3z9.fsf@gnu.org> <87eeqknf4d.fsf@gnu.org> <878sgpg856.fsf_-_@gnu.org> <87eeqhkea1.fsf@gnu.org> <87o8pleqg5.fsf@gnu.org> <875zbtk5l8.fsf@gnu.org> Date: Sun, 14 Jun 2020 18:22:52 +0200 In-Reply-To: <875zbtk5l8.fsf@gnu.org> (Mathieu Othacehe's message of "Sun, 14 Jun 2020 17:52:19 +0200") Message-ID: <87sgexiplv.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785 Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , 41785@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > + (with-parameters ((%current-target-system target)) > + (let* ((os (operating-system-for-image image)) > + (image* (image-with-os image os)) > + (target (image-target image)) > + (register-closures? (has-guix-service-type? os)) > + (bootcfg (operating-system-bootcfg os)) > + (bootloader (bootloader-configuration-bootloader > + (operating-system-bootloader os)))) > > would do the trick. I went ahead and pushed a variant of this as c9f6e2e5bdff186583bdc360832b57f4c56e3427. Thanks, Mathieu From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 14 12:42:29 2020 Received: (at 41785-done) by debbugs.gnu.org; 14 Jun 2020 16:42:29 +0000 Received: from localhost ([127.0.0.1]:44396 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkViG-0002q8-Qf for submit@debbugs.gnu.org; Sun, 14 Jun 2020 12:42:29 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47746) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkViF-0002pv-F9 for 41785-done@debbugs.gnu.org; Sun, 14 Jun 2020 12:42:27 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48509) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkVi9-000091-Rr; Sun, 14 Jun 2020 12:42:21 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=48132 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jkVi1-00081Q-Q8; Sun, 14 Jun 2020 12:42:20 -0400 From: Jan Nieuwenhuizen To: Mathieu Othacehe Subject: Re: [bug#41785] [PATCH v4] services: Add 'hurd-in-vm service-type'. Organization: AvatarAcademy.nl References: <20200610085441.890-1-janneke@gnu.org> <87eeql9xvt.fsf@gnu.org> <87wo4d2rm5.fsf@gnu.org> <873670l3z9.fsf@gnu.org> <87eeqknf4d.fsf@gnu.org> <878sgpg856.fsf_-_@gnu.org> <87eeqhkea1.fsf@gnu.org> <87o8pleqg5.fsf@gnu.org> <875zbtk5l8.fsf@gnu.org> X-Url: http://AvatarAcademy.nl Date: Sun, 14 Jun 2020 18:42:10 +0200 In-Reply-To: <875zbtk5l8.fsf@gnu.org> (Mathieu Othacehe's message of "Sun, 14 Jun 2020 17:52:19 +0200") Message-ID: <87mu558uql.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41785-done Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , 41785-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Mathieu Othacehe writes: >> (define (hurd-multiboot-modules os) >> ... >> (libc (if target >> (with-parameters ((%current-target-system #f)) >> ;; TODO: cross-libc has extra patches for the Hurd; >> ;; remove in next rebuild cycle >> (cross-libc target)) >> glibc)) >> >> we take the ELSE branch here -- and that does not work. AIUI, this is >> really a temporary kludge until the next rebuild cycle we can move some >> hurd-specific glibc patches from cross-libc to glibc-proper. > > Oh, I know why! In "system-image", there are a few calls, in the first > let, that are outside the "with-parameters", in particular "bootcfg" > which triggers the problem you are describing above. Ah, yes that makes sense. > Maybe something as naive as: > > diff --git a/gnu/system/image.scm b/gnu/system/image.scm [..] > - (let* ((os (operating-system-for-image image)) [..] > - (with-parameters ((%current-target-system target)) > + (with-parameters ((%current-target-system target)) > + (let* ((os (operating-system-for-image image)) > > would do the trick. It does! > I went ahead and pushed a variant of this as > c9f6e2e5bdff186583bdc360832b57f4c56e3427. Woohoo! I remove the with-parameters in hurd-vm-disk-image and pushed to master 5e9cf93364d87c70f8bfad915417cd75d21c0fed Greetings, Janneke --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com From unknown Fri Jun 20 07:12:43 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 13 Jul 2020 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator