[2024-jan-12] The Wiki has been upgraded and its template changed from MonoBook to Vector for a more modern look and feel.

Welcome to the Slackware Documentation Project

Set up Grub as boot loader on UEFI hardware

Installation and running of Slackware on computers that use Unified Extensible Firmware Interface (UEFI) rather than traditional BIOS poses problems. It may be impossible to boot the official install media via UEFI directly and the installation discs do not include a UEFI bootloader.

Installation of Slackware on UEFI systems is described in the page http://docs.slackware.com/howtos:slackware_admin:installing_on_uefi_hardware

That page describes production of a USB disk which can used to boot slackware.

This page describe installation of Grub2 as bootloader for UEFI based systems. Grub2 has the advantage that it brings up a menu on booting and it is possible to use the menu to dual boot with Windows. It is assumed that Slackware has been installed and it is being booted through a UEFI based system.

The sequence followed is that of

  1. Installation of Grub2-efi to a USB boot stick (This stage can be bypassed but it might be safer to check carry out the installation to a USB stick first)
  2. Once booting from the USB stick is working Grub2-efi is installed on the hard drive
  3. Modification of the UEFI boot menu

Install Grub2-efi

Install grub2 using the slackbuild but modifying it by adding

--with-platform=efi \ 

to ./configure

Then follow some of the instructions at https://wiki.archlinux.org/index.php/Grub#UEFI_systems_2

starting with mounting the usb stick at /boot/efi

#mount /dev/sdc1 -t vfat /boot/efi (where sdc1 is your USB stick)
#modprobe dm-mod
#grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub --recheck --debug
#mkdir -p /boot/grub/locale
#cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

Configure grub.cfg with

#grub-mkconfig -o /boot/grub/grub.cfg

This process should have created a file on the USB stick


At this point it is advisable that to check that it is possible to boot from the USB stick with grubx64.efi. If the UEFI system does not see it copy it to /EFI/BOOT/bootx64.efi

Installation of grubx64.efi to the hard drive

The EFI partition on the hard drive should be mounted. The partition will have a structure like this:


There may be a folder /EFI/Microsoft/Boot and the efi file booting windows may be bootmgr.efi

The safest way of proceeding at this stage is to create a new folder, for example /EFI/Linux/ and place grubx64.EFI in there.

At this point it may be worth testing if the UEFI system is able to see the new Linux boot option or not, usually by pressing F8 on booting the computer. If it does then it should be straightforward to set this as a default option. It is also likely that it is not seen. If that is the case the choice it to either replace the working .efi (for example /EFI/Boot/bootx64.efi or /EFI/Microsoft/Bootbootmgr.efi) or to modify the UEFI boot menu. Replacing the existing file is likely to make it impossible to boot into Windows. If the intention is to set up a dual boot system then the UEFI boot menu has to be modified.

Modifying the UEFI boot menu

Download efibootmger from http://linux.dell.com/efibootmgr/

untar it, change into the folder and run make

Copy src/efibootmgr/efibootmgr into /usr/sbin and chown it to root.

Mount the efi partition of the hard drive to /boot/efi

# mount /dev/sdXy -t vfat /boot/efi 
where X = drive and y = partition
# modprobe efivars
# efibootmgr -c -g -d /dev/sdX -p Y -w -L "Linux" -l '\EFI\Linux\bootx64.efi' 
assuming that the grubx64.efi file had been copied to \EFI\Linux\bootx64.efi

On next reboot Linux with Grub comes up as an option on the boot menu.


* Originally written by arubin

 howtos:slackware_admin:set_up_grub_as_boot_loader_on_uefi_based_hardware ()