- Joined
- May 15, 2006
I spent many hours trying to get Arch Linux installed on my brand new computer and it was somewhat painful. The instructions for UEFI in the ArchWiki are very thorough and well-documented. The problem is, they are not sorted in a fashion that makes it easy for doing a single install. It forces you to jump around between articles and points within an article. It can quickly get confusing. I'd rather not see anyone else have to go through this, so I wrote a guide.
Side note: If your motherboard can boot a CD in a UEFI environment, you can stop following my instructions after the first "grub-install" and "grub-mkconfig" commands. You'd just reboot and the operating system would already be in the list. Additionally, you would not need a UEFI bootable flash drive, but honestly, it is nice to have.
These instructions assume you have a completely blank hard drive. If you are going to start over, erase the beginning of the drive to delete the partitions. I won't explain how to do that here in case someone is not paying attention to what I'm saying and is just typing stuff in the command line!
Download and burn the Arch install to a disk (you could also do this with a bootable flash drive). http://www.archlinux.org/download/
Download the shell for UEFI, we will use this later to get into a UEFI environment. In case this link does not work, I've attached it to this post.
https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface#UEFI_Shell_download_links
Rename the file to bootx64.efi
Place the bootx64.efi file in /efi/boot/ (So, the file is located at "[flash-drive]/efi/boot/bootx64.efi") on a flash drive that is formatted FAT32. That is all that needs to be done for now.
Boot the Arch install disk on the target computer
Create the GPT label, the UEFI partition, and then setup the disk how you want.
Once you have the partitions done, run the normal Arch setup. You want to run the install until we get to the bootloader install section. We do not want to install GRUB.
Select your source and setup your network if you are using a net install
Select editor
Select region and time
Prepare the hard drives:
Select /dev/sda1
Select /dev/sda2
Select /dev/sda2+ lvm-pv
Select /dev/mapper/[lvm-name] lvm-vg
Select /dev/mapper/[lvm-name] lvm-vg
Select lvm container swap
Select lvm container root
Select packages:
Install packages
Configure system:
SKIP Install bootloader
Exit the installer
This will drop you to a command line, type the following
You will notice towards the end of the "grub-install" that it *does give an error*. "Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables." Ignore this error. We are not currently in an UEFI environment, so we can't install it just yet. This is where that flash drive we prepared earlier comes into play. Put that into the computer and reboot the system. At restart, select your motherboard's device selection screen (F8 on Asus, F12 on Gigabyte) and select the UEFI option for your flash drive. On my Gigabyte board, it was labeled as "UEFI: USB USB USB Hard Drive", no that isn't a typo. This should bring you to a UEFI Interactive Shell.
When it starts up, it outputs all the hard drives on the system. When booting to my flash drive, FS0 is the flash drive itself and FS1 is my Intel SSD. Yours may vary, so make sure you have the right one selected when you type in the following command:
The entry we just added to the motherboard is temporary, so if you restart after booting once, it will be missing and you will have to add it again. Restart the computer and select the device boot menu again. You should see "Arch Linux" in the list, select it and let the system boot like normal. Right after the grub window, you may see a bunch of lines that say "Ooops! Too many entries in the memory map!". I get these on my system and they don't seem to hurt anything. If you have information on what these are or how to fix them, I'm open to suggestions.
Before we add the entry into the UEFI section of the motherboard, we need to make sure that we can see the EFI variables. Type "efibootmgr" and you should get no errors. It should list all the current boot devices. If you do not see this list or get an error, type "modprobe efivars" and try again. If that doesn't work, post here and we can help you sort out what is going on.
To add your Arch install permanently, we will use the previous command for grub-install:
At the end, you should *not* get an error. It should say something along the lines of "No error reported". You can confirm it got added by typing "efibootmgr", which should list the newly added entry. Reboot and the entry should be in the boot menu. You can now use this like normal. I'd like to make a note that this entry stays even if the hard drive is completely wiped. If you want to delete an entry, boot to the UEFI flash drive that you made and type "bcfg boot dump" to get the boot list. This will give you numbers (00, 01, etc) that correspond with the entry. You can remove them by typing "bcfg boot rm xx" where "xx" is the number of the entry from the dump command.
If anyone has any questions or hits any issues during the install, please let me know and I'll do my best to help you out.
Side note: If your motherboard can boot a CD in a UEFI environment, you can stop following my instructions after the first "grub-install" and "grub-mkconfig" commands. You'd just reboot and the operating system would already be in the list. Additionally, you would not need a UEFI bootable flash drive, but honestly, it is nice to have.
These instructions assume you have a completely blank hard drive. If you are going to start over, erase the beginning of the drive to delete the partitions. I won't explain how to do that here in case someone is not paying attention to what I'm saying and is just typing stuff in the command line!
Download and burn the Arch install to a disk (you could also do this with a bootable flash drive). http://www.archlinux.org/download/
Download the shell for UEFI, we will use this later to get into a UEFI environment. In case this link does not work, I've attached it to this post.
https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface#UEFI_Shell_download_links
Rename the file to bootx64.efi
Place the bootx64.efi file in /efi/boot/ (So, the file is located at "[flash-drive]/efi/boot/bootx64.efi") on a flash drive that is formatted FAT32. That is all that needs to be done for now.
Boot the Arch install disk on the target computer
Create the GPT label, the UEFI partition, and then setup the disk how you want.
Code:
parted /dev/sda
(parted) mklabel gpt
(parted) mkpart fat32 1049kB 250MB
(parted) mkpart ext4 250MB 100% ([COLOR=Lime]Note, you can set this up however you want. I use a LVM later for this.[/COLOR])
(parted) toggle 1 boot
(parted) toggle 2 lvm
(parted) print ([COLOR=Lime]Verify your setup before exiting[/COLOR])
(parted) quit
Code:
/arch/setup
Select editor
Select region and time
Prepare the hard drives:
- Select manually configure
- Select by label
Select /dev/sda1
- format as "vfat"
- mountpoint is "/boot"
- label is whatever you want (I leave it blank)
- additional opts is "-F32" (no quotes)
Select /dev/sda2
- format this how you want, I use a LVM, which I'll describe here
- format as "lvm-pv"
Select /dev/sda2+ lvm-pv
- give it a name, I use the name of my computer
Select /dev/mapper/[lvm-name] lvm-vg
- select New
- label is "swap"
- size is whatever you want for swap
Select /dev/mapper/[lvm-name] lvm-vg
- select New
- label is root
- size is whatever is remaining for the lvm
Select lvm container swap
- format as "swap"
Select lvm container root
- format as "ext4"
- mountpoint is "/"
Select packages:
- Select "grub" when it asks to choose the bootloader
- Select "base" (hit enter)
- Look through the list until you find "grub", highlight it and press the space bar to deselect, then press enter
Install packages
Configure system:
- Select "/etc/rc.conf"
- Locate the "modules" line and add "efivars" into the parenthesis - "MODULES=(efivars)"
- Save and close rc.conf
- Set the root password
SKIP Install bootloader
Exit the installer
This will drop you to a command line, type the following
Code:
cp /etc/resolv.conf /mnt/etc/resolv.conf
mount -o bind /dev /mnt/dev
mount -t proc /proc /mnt/proc/
mount -t sysfs /sys /mnt/sys/
chroot /mnt bash
pacman-db-upgrade
pacman -Syy
pacman-key --init
pacman-key --populate archlinux
pacman -S grub2-efi-x86_64
grub-install --directory=/usr/lib/grub/x86_64-efi --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch --boot-directory=/boot --recheck --debug
grub-mkconfig -o /boot/grub/grub.cfg
When it starts up, it outputs all the hard drives on the system. When booting to my flash drive, FS0 is the flash drive itself and FS1 is my Intel SSD. Yours may vary, so make sure you have the right one selected when you type in the following command:
Code:
bcfg boot add 0 fs1:\efi\arch\grubx64.efi "Arch Linux"
Before we add the entry into the UEFI section of the motherboard, we need to make sure that we can see the EFI variables. Type "efibootmgr" and you should get no errors. It should list all the current boot devices. If you do not see this list or get an error, type "modprobe efivars" and try again. If that doesn't work, post here and we can help you sort out what is going on.
To add your Arch install permanently, we will use the previous command for grub-install:
Code:
grub-install --directory=/usr/lib/grub/x86_64-efi --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch --boot-directory=/boot --recheck --debug
If anyone has any questions or hits any issues during the install, please let me know and I'll do my best to help you out.
Attachments
Last edited: