[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to boot GuixSD in LXD

From: David Craven
Subject: Re: How to boot GuixSD in LXD
Date: Sun, 18 Dec 2016 20:27:41 +0100

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

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
  initrd /gnu/store/70shm14ywkydvp5f5lbzhl4wshkamwz4-base-initrd/initrd

The boot script:
(eval-when (expand load eval) (set! %load-path (cons
%load-path)) (set! %load-compiled-path (cons
%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
"/bin/shepherd") "shepherd" "--config"


reply via email to

[Prev in Thread] Current Thread [Next in Thread]