Hello the Guix Community,

I am struggling to get my Guix System boot.

This was my previous /etc/config.scm configuration:

```
(use-modules (gnu)
             (gnu packages linux)
             (gnu packages cryptsetup)
             (gnu services desktop)
             (gnu services ssh)
             (gnu system)
             (gnu system linux-initrd)
             (guix)
             (guix packages)
             (guix gexp)
             (srfi srfi-1)
             (ice-9 regex))

(use-package-modules emacs
                     librewolf
                     tor-browsers
                     wget
                     text-editors
                     toys
                     games
                     fcitx5
                     fonts
                     shells)

(define font-packages (fold-packages (lambda (pkg acc) (if (string-match "^font-" (package-name pkg))
                                                           (cons pkg acc)
                                                           acc))
                                     '()))

;; --- grub-efi with LUKS+LVM support ---
;; Build a small installer that creates an EFI image containing
;; the required grub modules so GRUB can cryptomount and read LVs.
(define install-grub-efi-with-luks
  #~(lambda (bootloader efi-dir mount-point)
            (when efi-dir (let* ((grub-mkimage (string-append bootloader "/bin/grub-mkimage"))                                  (modules (list "luks" "luks2" "cryptodisk" "lvm" "part_gpt" "part_msdos" "fat" "ext2" "gcry_rijndael" "pbkdf2"                                                 "gcry_sha256" "gcry_sha512" "search" "search_fs_uuid" "search_fs_file" "search_label"))                                  (prefix (string-append mount-point "/boot/grub"))                                  (output (string-append efi-dir "/EFI/Guix/grubx64.efi")))                                 (apply invoke (append (list grub-mkimage "-O" "x86_64-efi" "-p" prefix "-o" output)
modules))))))

;; Create a bootloader object that inherits the stock grub-efi-bootloader
(define grub-efi-bootloader-luks
  (bootloader
    (inherit grub-efi-bootloader)
    (name 'grub-efi-luks)
    (installer install-grub-efi-with-luks)))
;; --- end grub-efi with LUKS+LVM support ---

(define my-keyboard-layout (keyboard-layout "us"))

(operating-system (host-name "rebel1725-Alaric")
                  (timezone "Asia/Shanghai")
                  (locale "en_GB.UTF-8")
                  (keyboard-layout my-keyboard-layout)

                  (mapped-devices (list (mapped-device (source (uuid "7955ff80-6ebf-49d8-b5f5-ab4d69ef5fab"))                                                        (target "alaric-crypt")                                                        (type luks-device-mapping))))

                  (file-systems (let ((root-fs (file-system (mount-point "/")
(device "/dev/alaric-group/alaric-root")
                                                            (type "ext4")
(dependencies mapped-devices)))
                                      (boot-fs (file-system (mount-point "/boot")
(device "/dev/sda2")
                                                            (type "ext4")))
                                      (efi-fs (file-system (mount-point "/boot/efi")                                                            (device "/dev/sda1")
                                                           (type "vfat"))))
                                      (list root-fs boot-fs efi-fs)))

                  (swap-devices (list (swap-space (target "/dev/alaric-group/alaric-swap")                                                   (dependencies mapped-devices))))

                  (bootloader (bootloader-configuration (bootloader grub-efi-bootloader-luks)                                                         (targets (list "/boot/efi"))
(keyboard-layout my-keyboard-layout)))

                  (initrd (lambda (file-systems . rest)
                                  (apply base-initrd
                                         file-systems
                                         #:helper-packages (list lvm2-static cryptsetup-static e2fsck/static)
                                         rest)))

                  (services (append (list (service mate-desktop-service-type))                                     (modify-services %desktop-services (guix-service-type config => (guix-configuration (inherit config)
(substitute-urls (list "https://bordeaux.guix.gnu.org/";)))))))

                  (packages (append (list emacs
                                          librewolf
                                          torbrowser
                                          wget
                                          nano
                                          micro
                                          sl
                                          cowsay
                                          fcitx5
                                          fcitx5-gtk
                                          fcitx5-gtk4
fcitx5-material-color-theme
                                          fcitx5-configtool
                                          fcitx5-chinese-addons
                                          font-google-noto
                                          font-google-noto-emoji
font-google-noto-sans-cjk
font-google-noto-serif-cjk
font-google-noto-serif-cjk-static
                                          font-lisnoti
                                          zsh)
                                    ;; font-packages
                                    %base-packages))

                  (users (cons (user-account (name "rebel1725")
                                             (comment "Rebel Zhang")
                                             (group "users")
                                             (supplementary-groups '("wheel" "audio" "video"))                                              (home-directory "/home/rebel1725")                                              (shell (file-append zsh "/bin/zsh")))
                               %base-user-accounts)))
```

I ran `guix system init /mnt/etc/config.scm` and then it `Unrecognized keyword: #:helper-packages`. If I use `extra-packages` it will be `Unrecognized keyword: #:extra-packages`. If I remove entire `(initrd (...))` entry, the `guix system init /mnt/etc/config.scm` will succeed but GRUB will fail with wrong prefix. I could manually set the correct prefix using `(hd0,gpt2)` and `insmod normal` but this is not stable as the `0` of `hd0` will change. Also after entering GRUB and entering the LUKS password during the initramfs, it will fail with:

```
e2fsck: No such file or directory while trying to open /dev/alaric-group/alaric-root
Possibly non-existent device?
File system check on /dev/alaric-group/alaric-root failed
Spawning Bourne-like REPL.
```

I could see `/dev/mapper/alaric-crypt` exists, but neither the LVM logical volumes nor the LVM volume group exist.

After consulting in the IRC channel, I changed my configuration to this:

```
(use-modules (gnu)
             (gnu packages linux)
             (gnu packages cryptsetup)
             (gnu services desktop)
             (gnu services ssh)
             (gnu system)
             (gnu system linux-initrd)
             (guix)
             (guix packages)
             (guix gexp)
             (srfi srfi-1)
             (ice-9 regex))

(use-package-modules emacs
                     librewolf
                     tor-browsers
                     wget
                     text-editors
                     toys
                     games
                     fcitx5
                     fonts
                     shells)

(define font-packages (fold-packages (lambda (pkg acc) (if (string-match "^font-" (package-name pkg))
                                                           (cons pkg acc)
                                                           acc))
                                     '()))

;; --- grub-efi with LUKS+LVM support ---
;; Build a small installer that creates an EFI image containing
;; the required grub modules so GRUB can cryptomount and read LVs.
(define install-grub-efi-with-luks
  #~(lambda (bootloader efi-dir mount-point)
            (when efi-dir (let* ((grub-mkimage (string-append bootloader "/bin/grub-mkimage"))                                  (modules (list "luks" "luks2" "cryptodisk" "lvm" "part_gpt" "part_msdos" "fat" "ext2" "gcry_rijndael" "pbkdf2"                                                 "gcry_sha256" "gcry_sha512" "search" "search_fs_uuid" "search_fs_file" "search_label"))                                  (prefix (string-append mount-point "/boot/grub"))                                  (output (string-append efi-dir "/EFI/Guix/grubx64.efi")))                                 (apply invoke (append (list grub-mkimage "-O" "x86_64-efi" "-p" prefix "-o" output)
modules))))))

;; Create a bootloader object that inherits the stock grub-efi-bootloader
(define grub-efi-bootloader-luks
  (bootloader
    (inherit grub-efi-bootloader)
    (name 'grub-efi-luks)
    (installer install-grub-efi-with-luks)))
;; --- end grub-efi with LUKS+LVM support ---

(define my-keyboard-layout (keyboard-layout "us"))

(operating-system (host-name "rebel1725-Alaric")
                  (timezone "Asia/Shanghai")
                  (locale "en_GB.UTF-8")
                  (keyboard-layout my-keyboard-layout)

                  (mapped-devices (list (mapped-device (source (uuid "7955ff80-6ebf-49d8-b5f5-ab4d69ef5fab"))                                                        (target "alaric-crypt")                                                        (type luks-device-mapping))))

                  (file-systems (let ((root-fs (file-system (mount-point "/")
(device "/dev/alaric-group/alaric-root")
                                                            (type "ext4")
(dependencies mapped-devices)))
                                      (boot-fs (file-system (mount-point "/boot")
(device "/dev/sda2")
                                                            (type "ext4")))
                                      (efi-fs (file-system (mount-point "/boot/efi")                                                            (device "/dev/sda1")
                                                           (type "vfat"))))
                                      (list root-fs boot-fs efi-fs)))

                  (swap-devices (list (swap-space (target "/dev/alaric-group/alaric-swap")                                                   (dependencies mapped-devices))))

                  (bootloader (bootloader-configuration (bootloader grub-efi-bootloader-luks)                                                         (targets (list "/boot/efi"))
(keyboard-layout my-keyboard-layout)))

                  (initrd (lambda (file-systems . rest)
                                  (apply raw-initrd
                                         file-systems
                                         #:helper-packages
                                         (list lvm2-static cryptsetup-static e2fsck/static)
                                         rest)))

                  (services (append (list (service mate-desktop-service-type))                                     (modify-services %desktop-services (guix-service-type config => (guix-configuration (inherit config)
(substitute-urls (list "https://bordeaux.guix.gnu.org/";)))))))

                  (packages (append (list emacs
                                          librewolf
                                          torbrowser
                                          wget
                                          nano
                                          micro
                                          sl
                                          cowsay
                                          fcitx5
                                          fcitx5-gtk
                                          fcitx5-gtk4
fcitx5-material-color-theme
                                          fcitx5-configtool
                                          fcitx5-chinese-addons
                                          font-google-noto
                                          font-google-noto-emoji
font-google-noto-sans-cjk
font-google-noto-serif-cjk
font-google-noto-serif-cjk-static
                                          font-lisnoti
                                          zsh)
                                    ;; font-packages
                                    %base-packages))

                  (users (cons (user-account (name "rebel1725")
                                             (comment "Rebel Zhang")
                                             (group "users")
                                             (supplementary-groups '("wheel" "audio" "video"))                                              (home-directory "/home/rebel1725")                                              (shell (file-append zsh "/bin/zsh")))
                               %base-user-accounts)))
```

`guix system init` succeeded but then resulted in two new problems:

1. It said `/mnt/boot/grub/x86_64-efi/normal.mod` does not found. The scm specified a wrong prefix. I need to manually specify the correct prefix and `insmod normal` to boot. 2. After booting and entering the LUKS password, it kept popping `Waiting for /dev/alaric-group/alaric-root` and then stuck in the early Guile.

I shall be grateful if someone can help to get my Guix System boot and running.

Sincerely,

Rebel

Attachment: OpenPGP_0xBCD5DC5659C7FB50.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to