EFISTUB
So in this post I’m gonna guide you how you can use efistub, a feature which you can use to boot the kernel without an extra boot manager(grub, systemd-boot, rEFInd etc.)
Create a boot entry using efibootmgr.
|
|
Explaination of the command.
|
|
I have an encrypted installation on my machine so here is how I create an entry for me.
|
|
where cryptdevice UUID is the UUID of my SSD’s encrypted container’s UUID and root’s UUID is the UUID for my lvm volume where root is located, resume UUID is the lvm UUID where swap partition is. You can get UUID with blkid command.
Now go to /boot directory and check for the vmlinuz and initrd.img. They might be in child directories like if EFI/grub or maybe somewhere else depending on your current boot managers. and move them to /boot. Also change your fstab (/etc/fstab) so that it mount your boot partition on /boot.
|
|
and your fstab should be look like this.
|
|
By default, debian installs kernel and initrd images with their version numbers. But also puts a symlink to it in / with vmlinuz name. So we have to write a script so that if we get an update of kernel, it will automatically rename it to vmlinuz and initrd.img. Just create a script with following path and make it executable.
|
|
save it and make it executable.
|
|
and do the same with initramfs.
|
|
make it executable.
|
|
That’s it. Now uninstall any extra boot manager and reboot. You’ll see that your machine is booting without a boot manager. Yeah, you heard it right. No sensible person will call it bootloader. They are just boot managers which also create an entry just like we did. So why don’t we do it ourselves. Feel free to mail me if you get some errors.
NOTE: On a standard debian installation, installer creates an ESP if not already exists, and formats it as vFAT. And also creates another ext2 formatted partition. Installer mounts ESP as /boot/efi. So for debian standard install, your command looks like this.
|
|
and for an encrypted installation with lvm, it should be.
|
|
where first UUID is your /dev/sda3 encrypted container UUID, root UUID is where rootfs is installed and resume UUID is your encrypted swap partition UUID.