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.