Systemd boot fail after separate grub install

Hello, I have AL installed on an AMD/AMIbios mb with systemd bootloader and no other OS. Then yesterday I added a second hdd to install another OS that used grub.
After removing the second hdd I couldn’t boot AL - in the bios there was no UEFI entry and the hdd is not recognized as a boot device. I chrooted into it and the EFI System partition contained:

EFI/boot (empty)
amd-ucode.img
initramfs-linux-fallback.img
initramfs-linux.img
vmlinuz-linux

I can find instructions for repairing grub but nothing to help. I tried updating the kernel (pacman -Syu linux) and then tried ‘bootctl update’ and then ‘bootctl install’. The latter created Linux & loader & systemd directories, but reported:
Not booted with EFI, skipping EFI variable setup.
It is still unbootable and I thought I’d better stop and ask for help before I do more damage.

Many thanks for a superb OS and sorry I broke it, D.

Welcome aboard @dt78q

This saved my butt several times, hope it can be of any help to you;

Or this one might help you out also;

1 Like

Maybe this could help you out, unless you looked at this link already;

1 Like

Thanks for the suggestions I’ll look at rescatux if I can’t find a more direct method. I don’t have GRUB installed that’s, I think, why I haven’t found a solution

Ok, hope it will help you out !

Maybe other members might have other solutions to your problems.

Sorry for the delayed response.

Sounds like you aren’t booting in UEFI mode, did you install the other OS in UEFI? Make sure when booting the USB you see (U)EFI in the device name.

Depending on how much work you’ve done to the system already it may be faster to just do a reinstall. First try booting the USB in UEFI mode and chroot into the system (make sure to mount your boot partition to /boot), then use the following to setup systemd-boot (same commands we use in the installer)

mount -t efivarfs efivarfs /sys/firmware/efi/efivars > /dev/null 2>&1
systemd-machine-id-setup
bootctl --path=/boot install

Let me know if this still gives you errors/issues and we’ll go from there.

Hi, thanks
Yes I did all that correctly and the other OS was MX-linux which I assume installed as UEFI. I was surprised that GRUB would delete my existing boot setup. After I tried to recreate it by bootctl-install, bootctl-status reported:

       Firmware: UEFI 32.31 (American Megatrends 4.653)
    Secure Boot: disabled (disabled)
   TPM2 Support: no
   Boot into FW: supported

  Current Boot Loader:
        Product: systemd-boot 251.1-1-arch
       Features: ✓ Boot counting
                 ✓ Menu timeout control
                 ✓ One-shot menu timeout control
                 ✓ Default entry control
                 ✓ One-shot entry control
                 ✓ Support for XBOOTLDR partition
                 ✓ Support for passing random seed to OS
                 ✓ Load drop-in drivers
                 ✗ Boot loader sets ESP information
            ESP: n/a
           File: └─/EFI/BOOT/BOOTX64.EFI

  Random Seed:
   Passed to OS: no
   System Token: set
         Exists: yes

  Available Boot Loaders on ESP:
            ESP: /boot (/dev/disk/by-partuuid/edd0b619-3e61-4353-bed3-10ccffa01a1>
           File: └─/EFI/systemd/systemd-bootx64.efi (systemd-boot 251.3-1-arch)
           File: └─/EFI/BOOT/BOOTX64.EFI (systemd-boot 251.3-1-arch)

  Boot Loaders Listed in EFI Variables:
          Title: Linux Boot Manager
             ID: 0x0000
         Status: active, boot-order
      Partition: /dev/disk/by-partuuid/edd0b619-3e61-4353-bed3-10ccffa01a13
           File: └─/EFI/systemd/systemd-bootx64.efi
          Title: UEFI OS
             ID: 0x0004
         Status: active, boot-order
      Partition: /dev/disk/by-partuuid/edd0b619-3e61-4353-bed3-10ccffa01a13
           File: └─/EFI/BOOT/BOOTX64.EFI

  Boot Loader Entries:
          $BOOT: /boot (/dev/disk/by-partuuid/edd0b619-3e61-4353-bed3-10ccffa01a1>
  Default Boot Loader Entry:
           type: Reported by Boot Loader
          title: 01-archiso-x86_64-linux.conf
             id: 01-archiso-x86_64-linux.conf
         source: /sys/firmware/efi/efivars/LoaderEntries-4a67b082-0a4c-41cf-b6c7->

There appears to be an error with “Boot loader sets ESP information” but I can’t find any details on that.

I then ran your commands and nothing changed (status looks identical and still fails to boot) so I did bootctl-remove and ran your commands again but still the same. I haven’t tried manually deleting anything yet.

I am resigned to abandoning it if you think that’s best.

Btw, I tried to run Rescatux, as Altman suggested, and that wouldn’t boot in UEFI mode. I don’t know if that points to a problem or if it’s a problem with Rescatux - everything else I’ve booted from USB runs on UEFI.

Maybe check in the bios settings, might have some things to do there.

What s the computer s specs, might help also.

I’ve been through the bios settings many times and even loaded the defaults. The spec is:
Asus A85XM-A (firmware 6604), AMD A8-6500B Radeon and no installed hardware.

Sorry for all the problems @dt78q

Did you create a systemd-boot entry?

Should be in /boot/loader/entries/archlabs.conf

title   Archlabs Linux
linux   /vmlinuz-linux
initrd  /amd-ucode.img
initrd  /initramfs-linux.img
options root=PARTUUID=edd0b619-3e61-4353-bed3-10ccffa01a13 rw

You also need a loader.conf in /boot/loader/loader.conf

default  archlabs.conf
timeout  5
editor   no

You should also check whether there is a boot entry in the firmware and post the output

efibootmgr -v

If there is no entry for Archlabs then we can use efibootmgr to create one and set it as the default IMPORTANT: change -d /dev/sda to whichever disk contains the EFI partition and -p 1 to the part number on the disk eg. /dev/sda1 would be as shown below.

efibootmgr -b 0000 -c -d /dev/sda -p 1 -l \\EFI\\systemd\\systemd-bootx64.efi -L "Archlabs Linux"

Then run efibootmgr -v again to verify the entry was created correctly.


There’s also another option which is not using a bootloader and booting the kernel directly, I have a script that you can download to do this automatically

curl -fSL https://bitbucket.org/natemaia/dotfiles/raw/master/configs/home/nate/bin/efistub -o /usr/bin/efistub

Then edit the script vim /usr/bin/efistub and replace the distro name, root, and boot variables with your own

# these should be edited by the user
#########################################
dist='Arch Linux'
root=/dev/nvme0n1p2   # eg. /dev/sda2
boot=/dev/nvme0n1p1   # eg. /dev/sda1

Now you should be able to run it and it will setup a boot entry for your kernel

chmod +x /usr/bin/efistub
efistub
2 Likes

Oh heck, that’s tons of help, I didn’t mean to crash your Sunday!
I always liked the look of efistub but thought it was too hard for me. I’ll work through that and let you know. Thanks again

1 Like

It’s a tiny bit more involved and you don’t get the option to boot other distros from it but I’ve used it for years and the script to take the thinking and remembering commands out of it, to boot other stuff you just use the bios as your bootloader, most have an F-key (F12 or F8 usually) to change the boot.

1 Like

All working now, superb, AL forever!
I’ll try out efistub when I have a bit more time. Cheers, David

2 Likes

That s some good news in there @dt78q

Props to @natemaia for the solution.