0

I have an external SSD with Arch Linux on it. The ESP is mounted to /boot. On the ESP, I have the directory EFI and in that, there is a BOOT directory. I created a BOOTx64.EFI using an /ext/kernel/cmdline that says \vmlinuz-linux root=PARTUUID=[partuuid] initd=\initramfs-linux.img.

My thought is that when I use the Boot list and select my SSD, the UEFI system will automatically find /boot/EFI/BOOT/BOOTx64.EFI and correctly boot. But instead, I am dropped to the rootfs and I have to mount /dev/sda2 (the root partition) to new_root and then exit rootfs. And the boot works. But /proc/cmdline in that case shows YRY.

Alternatively, if I tell the boot list to boot from a file and select the BOOTx64.EFI file, it boots perfectly and /proc/cmdline shows my /etc/kernel/cmdline.

So I think that the HP Elitebook is correctly trying to run BOOTx64.EFI when I select the SSD, but for some reason, it doesn't see the root partiion (says device is '' and filesystem doesn't exist). So I have to manually mount it and then all is well.

I'm hoping to figure out why the laptop doesn't mount my root partition to new_root when I invoke the EFI from SSD, but does when I invoke it from the EFI file directly.

11
  • Does the command line include initd=, as written in the question, or initrd=? Partition can be not recognized by the kernel either because the kernel module supporting its fstype or device is not loaded (initrd), or udev has not created /dev/disk/by-partuuid/* (so again initrd). Commented Sep 16, 2022 at 23:37
  • Actually, since writing the question, I amended things. The /etc/kernel/cmdline now how no initrd (which is what it had...not initd...typo). Instead, I put the initramfs line in the linux.preset file and redid mkinitcpio --uefi ...--cmdline /etc/kerne/cmdline. That cmdline now has only \vmlinuz-linux and the root=PARTUUID=... with rw and nowatchdog at the end. The BOOTx64.EFI created with the linux.preset behaves in exactly the same way as before. Trying to boot from the device (SSD) shown in the boot list drops me to the rootfs. Directly booting from the file itself is fine.
    – dojero
    Commented Sep 17, 2022 at 0:04
  • BTW: On a much older Dell Inspiron (with UEFI, of course), it all works perfectly. Select the device from the boot list and it boot. Select the file, and it boots. I suspect, therefore, that the problem is with either the HP Elitebook iteration of the UEFI or the fact that the HP internal drives are nvme, not /dev/sda or whatever. The reason I don't use the /dev/sda parition designation in the EFI file is that I want to be able to use this external SSD on any computer...including ones like the Dell, where the hard drive is /dev/sda.
    – dojero
    Commented Sep 17, 2022 at 0:09
  • Are you saying that the 'early hook' udev is not getting the chance to recognize the root? But why does it work correctly when I tell HP to boot directly from the BOOTx64.EFI file? Incidentally, I also can boot by dropping into the UEFI shell and running an nsh file. In that, I have the one line like the old /etc/kernel/cmdline line (vmlinuz, root by partuuid, and initrd img file. And it works perfectly.
    – dojero
    Commented Sep 17, 2022 at 0:13
  • What boot manager are you using? What are /ext/kernel/cmdline and /etc/kernel/cmdline and how is BOOTx64.EFI "created" by them? mkinitcpio only creates the initrd (initramfs-*.img). Commented Sep 17, 2022 at 8:59

1 Answer 1

0

CAUTION: This is not for newbies or people who are just getting to know Arch Linux. YOU RISK LOSING EVERYTHING ON YOUR DRIVE IF YOU MAKE SOME KIND OF MISTAKE. AT A MINIMUM, PLEASE BACK UP ALL DATA BEFORE EXPLORING THIS OPTION.

I finally learned how to do this correctly. Best approach, I think, is to use the systemd-auto-gpt-generator. This is a part of systemd and it is designed to find and mount partitions based on their GPT type. In order for it to work, the first step is to make sure that your GTP types are correct: EFI for your EFI partition (EF00 code), Linux-x64-root (8304 code) for your root partition, and Home (8302), if you use a separate home partition.

The next step is to set your hooks in mkinitcpio.conf to start with systemd, and not base and udev. In other words, replace base and udev with systemd in the hooks line of the configuration file.

At this point, you're ready to make the efi boot file: mkinitcpio --uefi /boot/EFI/BOOT/BOOTx64.EFI

Once completed, the selecting your external drive from the boot menu will automatically work, mounting the root partition and the home partition. The boot partition will not be mounted until you try to access files on it. At that point, the system will automatically mount it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .