How to use kexec on Ubuntu Bionic with GRUB-EFI

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
1
down vote

favorite












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?







share|improve this question
























    up vote
    1
    down vote

    favorite












    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?







    share|improve this question






















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      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?







      share|improve this question












      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?









      share|improve this question











      share|improve this question




      share|improve this question










      asked May 18 at 11:24









      RenWal

      737




      737




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          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





          share|improve this answer






















          • 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 at 7:44










          • @RenWal I've revised the answer with a sample configuration file.
            – WinEunuuchs2Unix
            May 19 at 16:44










          • The sample file still says No entry suitable as default, refusing to guess.
            – sup
            May 21 at 18:28










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "89"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1037733%2fhow-to-use-kexec-on-ubuntu-bionic-with-grub-efi%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          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





          share|improve this answer






















          • 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 at 7:44










          • @RenWal I've revised the answer with a sample configuration file.
            – WinEunuuchs2Unix
            May 19 at 16:44










          • The sample file still says No entry suitable as default, refusing to guess.
            – sup
            May 21 at 18:28














          up vote
          0
          down vote













          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





          share|improve this answer






















          • 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 at 7:44










          • @RenWal I've revised the answer with a sample configuration file.
            – WinEunuuchs2Unix
            May 19 at 16:44










          • The sample file still says No entry suitable as default, refusing to guess.
            – sup
            May 21 at 18:28












          up vote
          0
          down vote










          up vote
          0
          down vote









          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





          share|improve this answer














          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






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 19 at 16:44

























          answered May 19 at 0:58









          WinEunuuchs2Unix

          34.6k756131




          34.6k756131











          • 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 at 7:44










          • @RenWal I've revised the answer with a sample configuration file.
            – WinEunuuchs2Unix
            May 19 at 16:44










          • The sample file still says No entry suitable as default, refusing to guess.
            – sup
            May 21 at 18:28
















          • 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 at 7:44










          • @RenWal I've revised the answer with a sample configuration file.
            – WinEunuuchs2Unix
            May 19 at 16:44










          • The sample file still says No entry suitable as default, refusing to guess.
            – sup
            May 21 at 18:28















          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 at 7:44




          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 at 7:44












          @RenWal I've revised the answer with a sample configuration file.
          – WinEunuuchs2Unix
          May 19 at 16:44




          @RenWal I've revised the answer with a sample configuration file.
          – WinEunuuchs2Unix
          May 19 at 16:44












          The sample file still says No entry suitable as default, refusing to guess.
          – sup
          May 21 at 18:28




          The sample file still says No entry suitable as default, refusing to guess.
          – sup
          May 21 at 18:28












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1037733%2fhow-to-use-kexec-on-ubuntu-bionic-with-grub-efi%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          pylint3 and pip3 broken

          Missing snmpget and snmpwalk

          How to enroll fingerprints to Ubuntu 17.10 with VFS491