Subject: [bug#75027] guix system reconfigure fails with kexec-load-file: Invalid argument (KEXEC_FILE_DEBUG issue)

From: boogs <[email-masked]>
Date: Sun, 05 Jan 2025 11:16:33 -0500

Hi,
It looks like some people[1,2] including myself are running into an issue where the `guix system reconfigure` command fails, presumably because `KEXEC_FILE_DEBUG` is not supported in older kernel configurations. 

The output of reconfiguring my system is the same as Simen's[2] ending in:

```
To complete the upgrade, run 'herd restart SERVICE' to stop,
upgrade, and restart each service that was not automatically restarted.
Run 'herd status' to view the list of services on your system.
WARNING: (guile-user): imported module (guix build utils) overrides core binding `delete'
guix system: error: kexec-load-file: Invalid argument
```

My system runs a custom kernel configuration that I created via `make menuconfig` in the kernel repo. I suspect the issue lies here:

```
(define (kexec-loading-program os)
  "Return a program that calls 'kexec_file_load' to allow rebooting into OS
via 'kexec'."
  (let ((root-device (file-system-device
                      (operating-system-root-file-system os))))
    (program-file
     "kexec-load-system.scm"
     (with-imported-modules '((guix build syscalls))
       #~(begin
           (use-modules (guix build syscalls))

           (let ((kernel (open-fdes #$(operating-system-kernel-file os)
                                    O_RDONLY))
                 (initrd (open-fdes #$(operating-system-initrd-file os)
                                    O_RDONLY)))
             (kexec-load-file kernel initrd
                              (string-join
                               (list #$@(operating-system-kernel-arguments
                                         os root-device)))
                              KEXEC_FILE_DEBUG)))))))
```

This is the relevant snippet from my kernel configuration: 

```
#
# Kexec and crash features
#
CONFIG_CRASH_CORE=y
CONFIG_KEXEC_CORE=y
CONFIG_KEXEC=y
CONFIG_KEXEC_FILE=y
CONFIG_KEXEC_JUMP=y
CONFIG_CRASH_DUMP=y
CONFIG_CRASH_HOTPLUG=y
CONFIG_CRASH_MAX_MEMORY_RANGES=8192
# end of Kexec and crash features
# end of General setup
```

[1] https://issues.guix.gnu.org/75320
[2] https://issues.guix.gnu.org/75211

-- 
Boogs