Arch Linux UEFI with Grub – Installation Guide

For those of you who are looking to install Arch Linux on your machines, this guide is for you! I have gone through the process and taken notes along away. I’m hoping this guide will help you as much as it will help me with future installs.

Let’s get started!

Pre-Requisites:

You’ll want to create bootable media for your Arch Linux ISO. I recommend the software Rufus: http://rufus.akeo.ie/

After you’ve built your media, boot your computer and launch your bootable media.

There are two things you’ll want to do before starting the installation.

  1. Verify you have a working internet connection on the machine
  2. Find out your HDD scheme

To test if you have internet, ping google.com and make sure you get successful replies.

ping google.com

Then you’ll want verify your hard drive scheme using the fdisk command. Most machines will use /dev/sda as the primary disk naming scheme.

fdisk -l

Great, now the pre-reqs are all out of the way. We can jump into install.

 

Create partitions using fdisk:

  • There are 3 partitions we will create: /boot, /root, and /home

Create an EFI partition by typing the command:

fdisk /dev/sda (or whatever your disk naming scheme is from earlier)

These are the options for creating the /boot partition:
	g
		This creates a new GPT partition
	n
		For new partition
	1
		For first partition
	enter
		Press enter for First Sector
	+300M
		300MB partition size
	t
		Change partition type
	1
		Select partition
	1
		Partition type is option 1. This converts the partition into an 'EFI System'
	w
		Writes data to disk

You’re done. Let’s move onto creating the /root partition:

fdisk /dev/sda (or whatever your disk naming scheme is from earlier)

These are the options for creating the /root partition:
	n
		For new partition
	2
		For second partition
	enter
		Press enter for Second Sector
	+30GB
		30GB partition size
	w
		Writes data to disk

You’re done. Let’s move onto creating the /home partition:

fdisk /dev/sda (or whatever your disk naming scheme is from earlier)

These are the options for creating the /home partition:
        n
		For new
	3
		For thrid partition
	enter
		Press enter for Third Sector
	enter
		To use all remaning space
	w
		Writes data to disk

 

The next step in the installation process is to format the partitions we just created.

Formatting the partitions:

Type these three commands:

# This will format and prepare /boot for sda1
mkfs.fat -F32 /dev/sda1

# This will format and prepare /root for sda2
mkfs.ext4 /dev/sda2

# This will format and prepare /home for sda3
mkfs.ext4 /dev/sda3

Now lets mount these three partitions:

# Mount sda2 to /mnt
mount /dev/sda2 /mnt

# Make a new directory in /mnt called home
mkdir /mnt/home

# Mount sda3 to the directory you just created call home: /mnt/home
mount /dev/sda3 /mnt/home

Now we are read for the base image install of Arch Linux

Installing base image for Arch and configuring the boot partition:

Install the base image to /mnt

pacstrap -i /mnt base

This next step is important!!

/mnt needs to be mounted during boot. To do that run the following command:

# Tell Arch which partition to mount during boot
genfstab -U -p /mnt >> /mnt/etc/fstab

At this point Arch Linux is officially installed. But don’t stop here, there is more to configure.

After the install!

Log into the Arch Linux installation by typing:

arch-chroot /mnt

Let’s update the user root password:

passwd

Install basic programs:

pacman -S grub efibootmgr dosfstools os-prober mtools linux-headers linux-lts linux-lts-headers

Setup the TimeZone, Date, and Hostname:

Let’s do the TimeZone first with these commands:

# Note: Change America/Chicago to wherever you are from
# You can navigate to /usr/share/zoneinfo for all the options
ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime

hwclock --systohc

Second let’s update the Date:

# You'll need some Vi text editor knowledge to navigate the file, edit the file, and save/exit the file.
# Use this link for reference: http://www.lagmonster.org/docs/vi.html 

vi /etc/locale.gen

# Find your locale in the list and uncomment your locale

Example would be changing:
#en_US_.UTF-8 UTF-8
to:
en_US_.UTF-8 UTF-8

# Then Save and Exit

After completing the above type:

locale-gen

Last we will change the Hostname:

# Change "archinstall" to whatever you would like your computer's name to be
echo 'archinstall' >> /etc/hostname

Now that the TimeZone and Date are setup we can finish up this install with EFI Grub install:

Create a directory for the EFI partition:

# make new directory called EFI in /boot
mkdir /boot/EFI

# Mount /boot/EFI to sda1
mount /dev/sda1 /boot/EFI

Install grub + efi boot loader with these three commands:

grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck

cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

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

Building a swapfile:

Now a SwapFile needs created:

# Choose the size of your swapfile
# Here I chose 2GB
fallocate -l 2G /swapfile

# Set the permissions on the swapfile
chmod 600 /swapfile

# make the directory swapfile a ...swapfile
mkswap /swapfile

# Edit /etc/fstab with the swapfile configuration
echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab

# Verify /etc/fstab has been updated appropriately
cat /etc/fstab

# You should see:
	/
	/home
	/swapfile none swap sw 0 0

Wrap this up already!

That’s it! Now just exit chroot, unmount your drives, and reboot!!

# Type exit to exit chroot 
exit

# Unmount your drives
umount -a

# Reboot the machine
reboot

Final Thoughts:

The first time I ran through all these steps it took several hours researching what each step actually means and why it’s important. With that said, if you have a good internet connection, running through this guides commands should take 15 to 20 minutes from start to finish to get to the log in prompt after the install.

4 comments on “Arch Linux UEFI with Grub – Installation Guide”

  1. MICHAEL Ray HAVENS Reply

    I was excited when I found this page. At last I will get my lovely arch installed. But my excitement turned to dismay when it wouldn’t load. Instead it givesintel splash screen and then the screen that says Select proper boot device
    Bummer! Do you have any clue what I did wrong?
    the only did two things differently. when you told us to edit /etc/fstab,I did it with nano instead of echo like you did. my /etc/fstab:
    #/dev/sda2
    uuid# / ext4 rw,relatime 0 1
    #/dev/sda3 /home ext4 rw,relatime 0 2
    uuid# /swapfile none swap sw 0 0
    what is this relatime thing?
    I also was unable to umount the drives so I let it shutdown with the power button.

  2. MICHAEL Ray HAVENS Reply

    I get the intel splash screen then the the screen that says to insert boot media or press any key. That screen also says No boot filename received. Then when I press a key it looks for the internet

  3. MICHAEL Ray HAVENS Reply

    I redid everything to make sure I folowed your instructions and I forgot something that happened:

    “Create a directory for the EFI partition:
    # make new directory called EFI in /boot
    mkdir /boot/EFI
    # Mount /boot/EFI to sda1
    mount /dev/sda1 /boot/EFICopy
    Install grub + efi boot loader with these three commands:
    grub-install –target=x86_64-efi –bootloader-id=grub_uefi –recheck
    cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
    grub-mkconfig -o /boot/grub/grub.cfg

    WELL, When I got to the cp command I got the error No such file or directory.

  4. totally bogus bullsh?? > dev/null Reply

    In my opinion, MBR-BOOT with MBR-BIOS is easier and safer to configure and support and maintain. UEFI (and GPT) has never really ever fully stabilized as of year 2022. I have successfully implemented a lot of linux ISO’s into fully functional systems (laptop and desktop hardwares, old and new) using MBR instead of GPT.

    To be fair, some hardware systems (and/or their firmwares) are kind enough to offer some nice EFI boot options, but they don’t always work as described (or at all) and they might not even be available in certain models or editions or manufacturers, etc.

    MBR-BIOS is limited to only 4 (four) logical partitions, but that’s OK!!!!!!!!!! 1 for System, 2 for SWAP, 3 for Alternative OS, and 4 for Special Storage!!!!!!!

    If you plan it out really carefully, you WILL NOT NEED MORE THAN 4 partitions!!!!
    Then, you can just use so many varieties of legacy partition managers from the classic antique eras or just modern stuff too, to set up or maintain the partions. And then also, you don’t have to worry about lack of backwards compatibility.

    Most systems from hardware, thru firmare, thru os, and etc still support “legacy mode” or whatever else they might still call it. Check your computer firmware settings and the documentation. Often it turns out that “Secure Boot” needs to be disabled and “Legacy” mode needs to be turned on. Sometimes the firmware does it partially automatically. Also, the OS boot loader settings need to be edited and rearranged too.

    Once you get into the habit of doing this stuff on a regular basis with a computer manufacturer that you trust and are familiar with, it gets easier and easier to remember even if you shift to a different make or model or manufacturer and even if the firmware interface(s) are unexpected or different.

    The primary benefit of doing it “ye olde fashioned wayye” is because then you can avoid so many of the “UNDOCUMENTED DESIGN FLAWS AND BUGS” of so muchy of the rest of the stuff.

    And you can still do your partition backups and maintainance and all that.

    Really the only “WORST” part is that too many linux “distros” (distributions) are put out for EFI / UEFI / GPT default settings and support instead of for MBR / BIOS or with the free choice. Some linux distro installers (and or Live bootup systems) claim to offer a choice, but then actually force EFI / GPT / UEFI “on the fly” (in realtime during install)!!!!!!

    This is really complicated in a bad way for the ISO authors and or the packagers to do this to us, because more honest and fair techies still admit that there are dozens if not hundreds of varieties of states of ambiguous pure and/or hybrid combos of both (U)EFI and MBR (with and/or without GPT).

    Come to think of it, I might even have misrepped “MBR-BIOS” because I think the other term is “MBR-BOOT”; they are two separate things!!!!!
    Ironically, even wonderful Puppy Linux never fully explained how GRUB4DOS worked or how to work it.

    And availability of GRUB4DOS and it’s documentation outside of Puppy Linux seems to have always been rare or maybe even non-existant!!!
    This is kinda funny, because GRUB4DOS turns out to be really useful and powerful as an alternative to GRUB(2), because you can just edit the basic text file menu list of what shows up on screen during boot, and also add kernel parameters without having to get complex with sudo update-grub or “vi” (why not geany or mousepad or gedit!!!!!) as I was saying without having to fuss with “vi /etc/default/grub”

    You might not even have to fuss that much with fstab!!!

    So yeah, I got some opinions on this topic!!!
    Good luck linux users, and by the way, maybe they ought to be called “distris” or “distribs” or “distrus” instead of “distros”; the singular of “distros” looks too much like “d?stro?” which tragicly and faultingly linguistically implies “:: DESTROY” (“:: linux ::destroy”).

    No, Linux, no need to destroy nor be destroyed; peace be with you, Linux, my friend. Also no need to imply “Distr OS” (“distr” operating system), which might actually exist someday if not already, also known as “D.I.S.T.R. OS”.

    Yes, it really does matter.
    Yes, IT (information technology does matter also).

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.