From mboxrd@z Thu Jan 1 00:00:00 1970 From: "David Braun" Subject: How to boot GuixSD in LXD Date: Sat, 17 Dec 2016 17:49:35 -0500 Message-ID: <10922-1482015184-113309@sneakemail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113eebc863ad5d0543e28146 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cINnn-0007EF-Jo for guix-devel@gnu.org; Sat, 17 Dec 2016 17:50:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cINni-0000WY-NK for guix-devel@gnu.org; Sat, 17 Dec 2016 17:50:03 -0500 Received: from sneak2.sneakemail.com ([64.46.156.55]:59630) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cINni-0000WM-Ev for guix-devel@gnu.org; Sat, 17 Dec 2016 17:49:58 -0500 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org --001a113eebc863ad5d0543e28146 Content-Type: text/plain; charset=UTF-8 Hi, I just discovered GuixSD; it's very exciting! I want to boot it as a virtual machine in LXD (https://www.ubuntu.com/cloud/lxd). So far I've created a LXD image by using the GuixSD installer to create a bare bones file system. Here's my etc/config.scm: ;; This is an operating system configuration template ;; for a "bare bones" setup, with no X11 display server. (use-modules (gnu)) (use-service-modules networking ssh) (use-package-modules admin) (operating-system (host-name "GuixSD") (timezone "Etc/UTC") (locale "en_US.UTF-8") ;; Assuming /dev/sdX is the target hard disk, and "my-root" is ;; the label of the target root file system. (bootloader (grub-configuration (device "/dev/sda"))) (file-systems (cons (file-system (device "my-root") (title 'label) (mount-point "/") (type "ext4")) %base-file-systems)) ;; Add services to the baseline: a DHCP client and ;; an SSH server. (services (cons* (dhcp-client-service) (lsh-service #:port-number 2222) %base-services))) and my LXD metadata.yaml: architecture: x86_64 creation_date: 1481846400 properties: description: GuixSD 0.11.0 bare bones x86_64 os: GuixSD release: 0.11.0 Now when I attempt to launch the image, LXD fails when it tries to start /sbin/init and can't find it. I understand that GuixSD uses Shepherd instead of init. What's the best way for me to configure the image so that LXD can start it? Perhaps I should create a symlink at /sbin/init that points to shepherd but I'm not sure if I should take the initrd into account as well. Thanks, David --001a113eebc863ad5d0543e28146 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

I just discovered GuixSD; it's = very exciting!=C2=A0 I want to boot it as a virtual machine in LXD (https://www.ubuntu.com/cloud/lxd)= .

So far I've created a LXD image by using the= GuixSD installer to create a bare bones file system.=C2=A0 Here's my e= tc/config.scm:

;; Th= is is an operating system configuration template
;; for a "bare bones" s= etup, with no= X11 display server.

(use-modules (gnu))
(use= -service-modules networking ssh)
(use-package-modules admin)

(operating-system
=C2=A0 (host-name "GuixSD")
= =C2=A0 (timezone "Etc/UTC")
=C2=A0 (locale "en_US.UTF-8")

=C2=A0 ;; Assuming /dev/sdX is the target hard = disk, and "my= -root" is
=C2=A0 ;; the label of the target root file= system.
=C2=A0 (bootloader (grub-configuration (device "/dev/sda"<= /span>)))
=C2=A0 (file-systems (cons (file-system
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (= device "= ;my-root")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (title 'label)
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (mount-point= "/")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (type "ext4"))
<= span class=3D"gmail-hljs-string" style=3D"color:rgb(136,0,0)">=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 %base-file-= systems))

=C2=A0 ;; Add services to the baseline: a DHC= P client and
=C2=A0 ;; an SSH server.
=C2=A0 (services (cons* (dh= cp-client-service)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(lsh-service #:port-number 2222)
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0%base-services)))

and my LXD metadata.yaml:

architecture: x86_64
creation_date: 1481846400
= properties:
=C2=A0 description: GuixSD 0.11.0 bare bones x86_64
=C2=A0 os: GuixSD
=C2=A0 release: 0.11.0

Now when I attempt to launch the image, LXD fai= ls when it tries to start /sbin/init and can't find it.=C2=A0 I underst= and that GuixSD uses Shepherd instead of init.=C2=A0 What's the best wa= y for me to configure the image so that LXD can start it?=C2=A0 Perhaps I s= hould create a symlink at /sbin/init that points to shepherd but I'm no= t sure if I should take the initrd into account as well.

Thanks,
David


--001a113eebc863ad5d0543e28146-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Craven Subject: Re: How to boot GuixSD in LXD Date: Sun, 18 Dec 2016 20:27:41 +0100 Message-ID: References: <10922-1482015184-113309@sneakemail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cIh7b-0004nD-DL for guix-devel@gnu.org; Sun, 18 Dec 2016 14:27:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cIh7X-0008SL-DU for guix-devel@gnu.org; Sun, 18 Dec 2016 14:27:47 -0500 Received: from mail-qt0-x233.google.com ([2607:f8b0:400d:c0d::233]:34499) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cIh7X-0008Rp-8w for guix-devel@gnu.org; Sun, 18 Dec 2016 14:27:43 -0500 Received: by mail-qt0-x233.google.com with SMTP id n6so130597707qtd.1 for ; Sun, 18 Dec 2016 11:27:42 -0800 (PST) In-Reply-To: <10922-1482015184-113309@sneakemail.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: David Braun Cc: guix-devel Hi David, I'm not familiar with LXD, so it might be helpful if you could share more details of how you created the LXD image. > Now when I attempt to launch the image, LXD fails when it tries to start > /sbin/init and can't find it. I understand that GuixSD uses Shepherd > instead of init. What's the best way for me to configure the image so that > LXD can start it? Perhaps I should create a symlink at /sbin/init that > points to shepherd That sounds like it could work. I believe what you are looking for is the boot script contained in a system derivation. If you used guix system init to create the LXD image, you can find it by running $(guix system build etc/config.scm)/boot. > but I'm not sure if I should take the initrd into account as well. LXD looks like it's based on containers, so the initrd shouldn't be needed. The initrd's main task is to load the root file system and then load the boot script that is passed through the --load argument to the initrd from grub. So you should be able to skip the kernel loading and the initrd and jump right into the boot script that starts shepherd. Part of grub.cfg: menuentry "GNU with Linux-Libre 4.8.12 (beta)" { search --label --set gnu-disk-image linux /gnu/store/90nmdrl491nyhsy7ar1zczvz5wgqlymh-linux-libre-4.8.12/bzImage --root=gnu-disk-image --system=/gnu/store/qd2zplli61dnjawzfanagh5sikwlbz9m-system --load=/gnu/store/qd2zplli61dnjawzfanagh5sikwlbz9m-system/boot console=ttyS0 initrd /gnu/store/70shm14ywkydvp5f5lbzhl4wshkamwz4-base-initrd/initrd } The boot script: (eval-when (expand load eval) (set! %load-path (cons "/gnu/store/gi2zry48hdsr87yvasc3nv7niixab8lw-module-import" %load-path)) (set! %load-compiled-path (cons "/gnu/store/dz6yx4q81zb3pxvysblfd68lgwrya9a2-module-import-compiled" %load-compiled-path)))(begin (begin (use-modules (guix build utils)) (letrec-syntax ((fail-safe (syntax-rules () ((_ exp rest ...) (begin (catch (quote system-error) (lambda () exp) (const #f)) (fail-safe rest ...))) ((_) #t)))) (fail-safe (delete-file-recursively "/tmp") (delete-file-recursively "/var/run") (mkdir "/tmp") (chmod "/tmp" 1023) (mkdir "/var/run") (chmod "/var/run" 493)))) (primitive-load "/gnu/store/xs63km6mqdkxdbwqkvbk2ryccaq80971-activate") (begin (false-if-exception (delete-file "/run/booted-system")) (symlink (readlink "/run/current-system") "/run/booted-system") (let loop ((fd 3)) (when (< fd 1024) (false-if-exception (close-fdes fd)) (loop (+ 1 fd)))) (execl (string-append "/gnu/store/qfax650mynyx9x8wm8lq8w7fp82kkfc6-shepherd-0.3.2" "/bin/shepherd") "shepherd" "--config" "/gnu/store/i5cqh5kx4mmz616aqp9g8qkcq9v7fszg-shepherd.conf"))) HTH From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: How to boot GuixSD in LXD Date: Mon, 19 Dec 2016 15:24:47 +0100 Message-ID: <877f6w3sk0.fsf@gnu.org> References: <10922-1482015184-113309@sneakemail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cIys3-0000Hr-Vm for guix-devel@gnu.org; Mon, 19 Dec 2016 09:24:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cIyrz-0002lX-9w for guix-devel@gnu.org; Mon, 19 Dec 2016 09:24:56 -0500 In-Reply-To: (David Craven's message of "Sun, 18 Dec 2016 20:27:41 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: David Craven Cc: guix-devel David Craven skribis: > The boot script: > (eval-when (expand load eval) (set! %load-path (cons > "/gnu/store/gi2zry48hdsr87yvasc3nv7niixab8lw-module-import" > %load-path)) (set! %load-compiled-path (cons > "/gnu/store/dz6yx4q81zb3pxvysblfd68lgwrya9a2-module-import-compiled" > %load-compiled-path)))(begin (begin (use-modules (guix build utils)) > (letrec-syntax ((fail-safe (syntax-rules () ((_ exp rest ...) (begin > (catch (quote system-error) (lambda () exp) (const #f)) (fail-safe > rest ...))) ((_) #t)))) (fail-safe (delete-file-recursively "/tmp") > (delete-file-recursively "/var/run") (mkdir "/tmp") (chmod "/tmp" > 1023) (mkdir "/var/run") (chmod "/var/run" 493)))) (primitive-load > "/gnu/store/xs63km6mqdkxdbwqkvbk2ryccaq80971-activate") (begin > (false-if-exception (delete-file "/run/booted-system")) (symlink > (readlink "/run/current-system") "/run/booted-system") (let loop ((fd > 3)) (when (< fd 1024) (false-if-exception (close-fdes fd)) (loop (+ 1 > fd)))) (execl (string-append > "/gnu/store/qfax650mynyx9x8wm8lq8w7fp82kkfc6-shepherd-0.3.2" > "/bin/shepherd") "shepherd" "--config" > "/gnu/store/i5cqh5kx4mmz616aqp9g8qkcq9v7fszg-shepherd.conf"))) Scary, no? :-) To understand where this code comes from, you can look at the output of =E2=80=98guix system extension-graph=E2=80=99, specifically arrows that flo= w in the =E2=80=9Cboot=E2=80=9D service. This =E2=80=9Cboot=E2=80=9D service corres= ponds to: http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/services.scm#n232 =E2=80=A6 and the main contribution to this boot script is: http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/services/shepherd.scm#= n67 HTH! Ludo=E2=80=99. From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Braun Subject: Re: How to boot GuixSD in LXD Date: Thu, 22 Dec 2016 17:37:08 -0500 Message-ID: References: <10922-1482015184-113309@sneakemail.com> <877f6w3sk0.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11406a1e14908f054446eadb Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cKBzQ-0003pl-RI for guix-devel@gnu.org; Thu, 22 Dec 2016 17:37:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cKBzN-0006XQ-OP for guix-devel@gnu.org; Thu, 22 Dec 2016 17:37:32 -0500 Received: from mail-qt0-x235.google.com ([2607:f8b0:400d:c0d::235]:34993) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cKBzN-0006X1-Ka for guix-devel@gnu.org; Thu, 22 Dec 2016 17:37:29 -0500 Received: by mail-qt0-x235.google.com with SMTP id c47so247660547qtc.2 for ; Thu, 22 Dec 2016 14:37:29 -0800 (PST) In-Reply-To: <877f6w3sk0.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: "ludo-at-gnu.org |Guix-box|" <2wkutzekpt@sneakemail.com> Cc: guix-devel --001a11406a1e14908f054446eadb Content-Type: text/plain; charset=UTF-8 On Mon, Dec 19, 2016 at 9:24 AM, ludo-at-gnu.org |Guix-box| < 2wkutzekpt@sneakemail.com> wrote: > > Scary, no? :-) > Haha, yes! > HTH! > Thank you, it did! Best, David --001a11406a1e14908f054446eadb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On M= on, Dec 19, 2016 at 9:24 AM, ludo-at-gnu= .org |Guix-box| <2wkutzekpt@sneakemail.com> wrot= e:
Scary, no?=C2=A0 :-)
=
Haha, yes!
=C2=A0
HTH!

Thank you, it did!
<= br>
Best,
David

--001a11406a1e14908f054446eadb-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Braun Subject: Re: How to boot GuixSD in LXD Date: Thu, 22 Dec 2016 17:36:19 -0500 Message-ID: References: <10922-1482015184-113309@sneakemail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1135875228861d054446e7e5 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cKBye-0003T7-76 for guix-devel@gnu.org; Thu, 22 Dec 2016 17:36:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cKByb-00060H-4j for guix-devel@gnu.org; Thu, 22 Dec 2016 17:36:44 -0500 Received: from mail-qt0-x235.google.com ([2607:f8b0:400d:c0d::235]:36728) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cKBya-0005zf-V4 for guix-devel@gnu.org; Thu, 22 Dec 2016 17:36:41 -0500 Received: by mail-qt0-x235.google.com with SMTP id k15so7934272qtg.3 for ; Thu, 22 Dec 2016 14:36:40 -0800 (PST) In-Reply-To: List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: "David Craven david-at-craven.ch |Guix-box|" <7br2j1e1rt@sneakemail.com> Cc: guix-devel --001a1135875228861d054446e7e5 Content-Type: text/plain; charset=UTF-8 On Sun, Dec 18, 2016 at 2:27 PM, David Craven david-at-craven.ch |Guix-box| <7br2j1e1rt@sneakemail.com> wrote: > That sounds like it could work. I believe what you are looking for is > the boot script contained in a system derivation. If you used guix > system init to create the LXD image, you can find it by running $(guix > system build etc/config.scm)/boot. > Thank you for the tips; they were helpful. I moved on from LXD to Docker and I got it working. David --001a1135875228861d054446e7e5 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable