Running complete guix system inside an Incus container

Hi,

I followed steps described at Guix in a Linux Container - Thedro Neely . However, when I tried to start sshd, I got error message from shepherd saying that ssh-daemon depends on loopback, and loopback service cannot be started. It’s odds to me that the lo interface is setup properly inside the container and I can ping internet without problems.

Here’s the output of ip addr show in this container:

and here’s the output of herd status loopback:

These two screeshots tell me two things:

  1. The lo interface has been setup already
  2. The loopback service seems trying to setup lo but it just keeps waiting for something I have no idea about.

What workaround can be used in this case?

Thank you!

The root filesystem is generated via

guix system init --no-bootloader --no-kexec config.scm ics-guix-3-rf/

Here’s the container’s config.scm:

(use-modules (gnu) (gnu system locale))
(use-service-modules networking ssh)
(use-package-modules ssh bash package-management linux vim emacs)

(operating-system
 (host-name "ics-guix-3")
 (timezone "America/Chicago")
 (locale "en_US.utf8")
 (firmware `())
 (initrd-modules `())
 (kernel hello)
 (packages (list guix coreutils iproute procps neovim emacs))

 (essential-services (modify-services
                      (operating-system-default-essential-services this-operating-system)
                      (delete firmware-service-type)
                      (delete (service-kind %linux-bare-metal-service))))

 (locale-definitions (list (locale-definition
                            (name "en_US.utf8")
                            (source "en_US")
                            (charset "UTF-8"))))

 (bootloader (bootloader-configuration
              (bootloader grub-bootloader)
              (targets '("/dev/null"))))

 (file-systems (list (file-system
                      (device "/dev/null")
                      (mount-point "/")
                      (type "dummy"))))

 (users (cons (user-account (name "lkg")
			    (comment "Liau, Kiong-Ge")
			    (group "users")
			    (supplementary-groups '("wheel" "audio" "video")))
	      %base-user-accounts))

 (services (list (service static-networking-service-type
                          (list %loopback-static-networking))
                 (service dhcpcd-service-type)
                 (service syslog-service-type)
                 (service guix-service-type)
                                  (service special-files-service-type
                          `(("/bin/sh" ,(file-append bash "/bin/sh"))
                            ("/usr/bin/env" ,(file-append coreutils "/bin/env"))))
                 (service udev-service-type
                          (udev-configuration
                           (rules '())))
                 (service openssh-service-type
                          (openssh-configuration
                           (openssh openssh-sans-x))))))

I just realized that I need a dummy service provide provision of loopback service:

(use-modules (gnu) 
	     (gnu system locale)
	     (gnu services)
	     (gnu services shepherd))
(use-service-modules networking ssh shepherd)
(use-package-modules ssh bash package-management linux vim emacs guile)

(define (dummy-loopback-service config)
  (list 
  (shepherd-service 
	  (documentation "Dummy lookback service for incus container")
          (provision '(loopback))
	  (requirement '())
	  (one-shot? #t)
	  (start #~(make-forkexec-constructor '("true")))
	  (stop #~(make-kill-destructor)))))

(define-public dummy-loopback-service-type 
  (service-type 
    (name 'dummy-loopback) 
    (description "dummy loopback service type")
    (extensions (list (service-extension 
		       shepherd-root-service-type 
		       dummy-loopback-service)))
    (default-value #f)))


(operating-system
 (host-name "ics-guix-3")
 (timezone "America/Chicago")
 (locale "en_US.utf8")
 (firmware `())
 (initrd-modules `())
 (kernel hello)
 (packages (list guix coreutils iproute procps neovim emacs (specification->package "guile@3.0.9")))

 (essential-services (modify-services
                      (operating-system-default-essential-services this-operating-system)
                      (delete firmware-service-type)
                      (delete (service-kind %linux-bare-metal-service))))

 (locale-definitions (list (locale-definition
                            (name "en_US.utf8")
                            (source "en_US")
                            (charset "UTF-8"))))

 (bootloader (bootloader-configuration
              (bootloader grub-bootloader)
              (targets '("/dev/null"))))

 (file-systems (list (file-system
                      (device "/dev/null")
                      (mount-point "/")
                      (type "dummy"))))

 (users (cons (user-account (name "lkg")
			    (comment "Liau, Kiong-Ge")
			    (group "users")
			    (supplementary-groups '("wheel" "audio" "video")))
	      %base-user-accounts))
 

 (services (list 
                 (service dummy-loopback-service-type)
		 (service dhcpcd-service-type)
                 (service syslog-service-type)
                 (service guix-service-type)
                                  (service special-files-service-type
                          `(("/bin/sh" ,(file-append bash "/bin/sh"))
                            ("/usr/bin/env" ,(file-append coreutils "/bin/env"))))
                 (service udev-service-type
                          (udev-configuration
                           (rules '())))
                 (service openssh-service-type
                          (openssh-configuration
                           (openssh openssh-sans-x)))
		 )))

The last blocker for guix system incus instance is the $GUIX_NEW_SYSTEM hack, which requires manual works to update the environment variable and which boot script to run:

image

1 Like