guix-devel
[Top][All Lists]
Advanced

[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
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



reply via email to

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