1

Since the upgrade to Ubuntu 18.04 Bionic kexec stopped working on my laptop. Ubuntu is installed in UEFI mode with GRUB as the bootloader, dual booting Windows. The system is fully encrypted, including the boot partition.

I have kexec-tools installed and added the following service:

[Unit]
DefaultDependencies=no
Requires=sysinit.target
After=sysinit.target

[Service]
Type=oneshot
ExecStart=-/bin/true
RemainAfterExit=yes
ExecStop=/usr/local/bin/load-kexec.sh

[Install]
WantedBy=basic.target

and this script to do the kexec reboot:

#!/bin/sh
INITRAMFS="/initrd.img";
KERNEL="/vmlinuz";

if [ "$(cat /sys/kernel/kexec_loaded)" != "1" ]; then
  echo "Load kernel ($KERNEL) and initramfs ($INITRAMFS) for kexec";
  kexec -l "$KERNEL" --initrd="$INITRAMFS" --reuse-cmdline;
else
  echo "Already loaded some kexec, not modifying";
fi;

However, running sudo systemctl kexec gives me this error message:

Failed to open "/boot/efi/loader/loader.conf": Datei oder Verzeichnis nicht gefunden
Failed to read boot config from "/boot/efi/loader/loader.conf": Datei oder Verzeichnis nicht gefunden
Failed to load bootspec config from "/boot/efi/loader": Datei oder Verzeichnis nicht gefunden

It is right about the fact that this configuration file does not exist, but I did not need to create it on Ubuntu 16.04 where kexec worked flawlessly.

Can somebody explain what changed in the upgrade and how to get kexec working again?

0

Datei oder Verzeichnis nicht gefunden

In English this means: "File or directory not found"

Looking at loader.conf — Configuration file for sd-boot it says:

sd-boot(7) will read /loader/loader.conf and any files with the ".conf" extension under /loader/loader.conf.d/ on the EFI system partition (ESP).

Although I don't have time to test kexec tonight, you should be able to fix the error with the command:

sudo mkdir -p /boot/efi/loader/loader.conf.d/

No entry suitable as default, refusing to guess

The initial error message said no file or directory. I was hoping creating a directory would make it happy. Here is a default loader.conf file:

# Example kexec-loader configuration file
# Read the documentation for more information.
#

# Number of seconds to wait before booting the default menu entry.
#
# timeout 5

# Explicitly enable/disable GRUB autodetection. Autodetection will be enabled
# by default, but only if no boot targets are specified in this file.
#
# grub-autodetect on
# grub-autodetect off

# Force GRUB path. Setting this will disable autodetection.
#
# grub-path (hda1)/boot/grub

# Map GRUB disks/partitions
# This overrides any mappings in device.map
#
# grub-map hd0 sda
# grub-map hd1,a hda8

# Example boot target
#
# title Generic Linux System
# root hda1
# kernel /boot/vmlinuz
# cmdline root=/dev/hda1 ro
# initrd /boot/initrd.gz 
  • Thanks! I tried your suggestion, but now it gives me No entry suitable as default, refusing to guess. If I understood this correctly, loader.conf would be the configuration file for systemd-boot (former gummiboot bootloader) - but I am using GRUB, so why is this file needed anyway? – RenWal May 19 '18 at 7:44
  • @RenWal I've revised the answer with a sample configuration file. – WinEunuuchs2Unix May 19 '18 at 16:44
  • 1
    The sample file still says No entry suitable as default, refusing to guess. – sup May 21 '18 at 18:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.