0

I try to start the system (Kubuntu 20.04) without a Bootloader direct from the EFI/BIOS for faster boot.
I compiled the Linux-kernel-5.8.5, copied and renamed the /usr/src/linux-5.8.5/arch/x86/boot/bzImage file to /boot/efi/EFI/ubuntu.efi. Rebooted in to the BIOS, selected ubuntu.efi and added to the secure boot.
The system starts but I get the following error:

Please append a correct device "root=" boot option; here are the available partitions:
(driver?)
103:00001 123456 nvme0n1p1 ...UUID....
103:00002 123456 nvme0n1p2 ...UUID....
103:00003 123456 nvme0n1p3 ...UUID....

kernel panic - not syncing: VFS: unable to mount root fs on unknown-block(0,0)

The pci, fs and nvme driver are build in the kernel (*). As far as I can tell, only the path to the partition and the root directory have to be entered, but where?


----EDIT----

The error message says, to select the correct partition.
I entered the correct partition here:

make menuconfig

Processor type and features  --->
    [*] Built-in kernel command line
        (root=/dev/nvme0n1p5) Built-in kernel command string
            [*] Built-in command line overrides boot loader arguments

I get the same error.
Then I tried it by replacing the path root=/dev/nvme0n1p5 with the UUID and got the same error.
I took a closer look at the UUID and found out, that the listed UUID is actually a PARTUUID (You can find out with the command: blkid), so I tried the PARTUUID, nothing changes same error.
Regardless of what I enter in the Built-in kernel command string I always get the same error.

FEI boot error photo

2 Answers 2

0

One way would be to add the boot options to the UEFI boot variables in NVRAM, using the -@ option of the efibootmgr command:

echo "root=/dev/nvme0n1pX" | efibootmgr -c -d /dev/nvme0n1 -L "Kubuntu with kernel UEFI stub" -l \\EFI\\ubuntu.efi -@ -

... where /dev/nvme0n1pX is the NVME device partition containing your actual root filesystem, and /dev/nvme0n1 is the NVME device containing your ESP partition, and \\EFI\\ubuntu.efi is the Windows-style pathname relative to the root of the ESP partition, with doubled backslashes because backslash is a special character for the shell. You can set whatever label text (the -L option parameter) you want.

Note that this does not include an initramfs at all, unless you have embedded it into the kernel file. It may be possible to have the UEFI stub load an initramfs by adding the kernel boot parameter like initrd=\\EFI\\initrd.img but support is uncertain because this is very poorly documented and depends on UEFI firmware support which may have bugs and vendor-specific quirks (some systems may require an absolute path with all caps, others a relative one with accurate case, etc.).

It also does not allow booting into emergency/single user mode by editing the kernel boot options, as you don't have a bootloader that would allow editing them at boot time. So you'll need to anticipate any possible boot option requirements and generate several UEFI boot variables to cover any possible scenarios in advance, or just reboot the system from external media any time there's any sort of problem with the early boot process.

But if you are building an appliance or kiosk-style system that should not be easily tamperable by users, these limitations might suit you just fine.

(In ancient versions of Linux, there used to be a way to manipulate the bzImage file directly to pre-set the default root device by minor/major device numbers; but I'm not sure if this works any more with modern kernels, and don't seem to recall the name of the command used to perform the manipulation.)

4
  • Thank you for the quick and competent answer. Unfortunately it doesn't work. I believe that the BIOS doesn't allow "efibootmgr" modifications. Therefore I would like to modify the bzImage in /home/USER/Documents and then copy it into the /boot/efi/EFI directory and rename it to Kubuntu like: sudo cp /home/USER/Documents/bzImage /boot/efi/EFI/Kubuntu.efi. How can I add root echo "root = nvme0n1p5" to the bzImage?
    – Teso
    Sep 3, 2020 at 14:03
  • I could also change the kernel configuration and recompile the kernel.
    – Teso
    Sep 3, 2020 at 14:19
  • Unfortunately some UEFI firmwares do have quirks like that. You could set CONFIG_CMDLINE_BOOL=y and then CONFIG_CMDLINE="root=/dev/nvme0n1p5" in kernel configuration, and recompile the kernel.
    – telcoM
    Sep 3, 2020 at 15:54
  • I think i have it. make menuconfig :: Processor type and features ---> [*] Built-in kernel command line ---> (root=/dev/nvme0n1p5) Built-in kernel command string ---> [*] Built-in command line overrides boot loader arguments Thank you very much.
    – Teso
    Sep 4, 2020 at 16:24
0

I solved it.
The right command is: fs0:> Kubuntu.efi root=/dev/nvme0n1p5
The solution found in: Linux-kernel ---> ~/Documentation/admin-guide/efi-stub.rst

Thank you very much for your help.

You must log in to answer this question.

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