We will install a Debian ISO on a usb or hard drive. And then convert the bios to UEFI
(This example can also be entirely done in a with Virtualization)
Tools you may need:
- A USB or cd for putting the OS on it
- and other USB or hard drive as your main installation drive.
- uefi compatible motherboard
After writing the iso on a usb and booting from it and install it on a hard drive with the graphical interface.
Because you can’t (easily) build uefi if you are not booted from it, we will download and iso from a linux distro that provides iso with uefi already on it(evolve os, manjaro, semplice 6, Slackel,…) and rewrite on the first usb. Boot from it.
With gparted GUI resize your main boot partition from 243 to 200.
create a fat32 primary partition for 43mb. Give it the boot and esp flag
and now gdisk -l /dev/sda
should give you:
BSD: not present
APM: not present
Mount your hard drive on /mnt (sda is bootable usb and sdb is your hard drive and it may differ in your case)
mount -t ext4 /dev/sdc5 /mnt
or if it is encrypted:
cryptsetup luksOpen /dev/sdb5 sdb5_crypt
mount -t ext4 /dev/mapper/example-root /mnt
mount /dev/sda1 /mnt/boot
mount /dev/sda2 /mnt/boot/efi
for i in /dev/ /dev/pts /proc /sys ; do mount -B $i /mnt/$i ; done
get a chroot environment:
type blkid to get the UUID of your fat32 partition
edit /etc/fstab and add the following line with your UUID
UUID=94D0-2462 /boot/efi vfat defaults 0 2
For internet access inside chroot:
cp /etc/resolv.conf /mnt/etc/resolv.conf
apt-get remove grub-pc && apt-get install grub-efi-amd64
grub-install /dev/sdb –target=x86_64-efi
cp debian/grubx64.efi boot/bootx64.efi
for i in /sys /proc /dev; do umount /target$i; done
and now you should be able to boot to uefi
if you have any question or if you get any other problems, just leave a comment down below and I'll try to answer it if i can.