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