How To Install Arch Linux (Windows Dualboot)

We are going to be dualbooting Arch Linux on a Windows laptop today. Despite what others say, Arch is relatively easy to setup in comparison to other distros in my opinion. The fact that it is minimal just means that you have minimal things to setup. Sometimes you will run into issues when installing on hardware compared to a VM, so I will also be covering some of my troubleshooting problems at the end.

Requirements

Configuring Window’s Side

Battery

This can be found by right-clicking your battery icon from taskbar > power options > (left side) choose what the power button does > (at the top) change settings that are currently unavailable.

Partitions

Usually it will be disk 0, which is your main drive. You want to shrink the main space (normally C drive) by however much space you want to give your Linux OS.

BIOS

  • Disable Secure Boot
  • Change the storage to UEFI mode

Every bios is a little different, so the method to change these options will vary. Do not worry if you cannot find the UEFI mode option, we can fix that during our Arch install.

Download Arch ISO

At the fingerprint’s link, you should see something like the image below. You want to go to “pub” link and copy the URL address.

After getting the URL address, you want to run gpg --fetch-key 'URL_ADDRESS' in your WSL terminal, like in the image below.

Before running gpg --keyserver-options auto-key-retrive --verify archlinux-*.iso.sig , you want to make sure the .sig and .iso files are in the same directory. Good signature means that it’s good to go, ignore the warning.

Bootable Arch Linux ISO

Once you have your USB bootable drive, you are all set to work on installing Arch Linux.

Installing Arch Linux

Bootable USB’s loader after changing boot order from BIOS
Replicating my hardware install on a VM

Connecting to the internet

It should show something like wlan0 under Name

We will be using iwctl to connect, so type iwctl to go into it’s interface. Use device list to see the name of our wifi device. Then station device_name scan . If your device_name is wlan0, it is station wlan0 scan . Next is station device_name get-networks to get the name of the wifi to connect to. With the name/SSID, use station device_name connect wifi_name , a password prompt should show up if the name/SSID is correct. Now we can check if we’re connected to the internet with station device_name show and the ‘State’ should show ‘connected’. Type quit to quit.

Setting our time and date

Partitoning

This should be totally different on a Windows laptop.

The image above should look totally different from what would be on hardware. It might be ‘sda’ or ‘nvme0n1’ depending on what storage device you have:

nvme0n1         disk
|--nvme0n1p1 part
|--nvme0n1p2 part
|--nvme0n1p3 part
|--nvme0n1p4 part

You will want to run lsblk -f or fdisk -l to see which part is labeled the EFI System. This should be your Window’s EFI partition, remember these commands as we will need to reference these parts throughout partitioning our system.

Run cgdisk /dev/block_device, where block_device should be your storage’s partition system name. Note: If your storage is GPT, you will run cgdisk. Otherwise, you will run fdisk. You will get an error telling you it’s not GPT if you’re mismatching your storage type. Reference here for more info on block device names.

Arrow keys to move around the bottom menu

The images above show how to partition 1 section for EFI. I will be going with 3 sections:

  • Linux EFI Partition
  • Linux Root Partition (your main folder/drive essentially)
  • Linux Swap

Usually people just go with Boot and Root, but I chose this setup for my laptop because I might use hibernate sometimes, so I need swap and a separate EFI from Windows to avoid any corruption during hibernation. You can check out the partition codes for cgdisk here. You will want to go through these 3 setups:

  • EFI: first sector: blank, size: 512M, guid: ef00 , name: Linux EFI
  • Swap: first sector: blank, size: 8G (or your ram size), guid: 8200, name: Linux Swap
  • Root: first sector: blank, size: blank (fills all the way), guid: blank, name: Linux Root

Just imagine having extra partitions on the top of these, which should be your Windows partition. So our Linux partitions should be EFI system, Linux swap, and Linux filesystem.

Use fdisk -l to check your partitions types

Be sure to triple check that everything is correct, because if you write over a windows partition, you will need to recover the disk as there will be no working OS on the drive anymore. Once you have those 3 partitions with the correct settings, select [Write], ‘yes’, then [Quit]. Congrats for making this far, the hardest part is over.

Formatting

Next we will format our filesystem with mkfs.ext4 /dev/YOUR_FILESYSTEM_PARTITION , and hit the default for when creating the journal.

If you have swap, formatting it, we will run mkswap /dev/YOUR_SWAP_PARTITION . It will be mkswap /dev/nvme0n1p7, but it might be /dev/sda# for you. Turn on the swap with swapon /dev/YOUR_SWAP_PARTITION .

Formatting Example from my VM for demo purposes

Mounting

Mounting Example from my VM for demo purposes

You can run df to make sure you have both EFI and filesystem mounts with the correct partitions.

Packages

fstab

Setting Up Arch

You can see, it changes our terminal prompt.

If every is mounted correctly, you should get a prompt like in the image above.

Setting Time and Language

Next, let’s set the locale by going into vim /etc/locale.gen with your favorite terminal editor.

Uncomment en_US.UTF-8 UTF-8 , and/or whichever languages you want, and save+exit the file. Then run locale-gen to generate the files.

Set our language by making a file in/etc/locale.conf and typing in this line: LANG=en_US.UTF-8 , and save+exit.

Setting Hosts, Hostname

Let’s set our hosts by going into /etc/hosts and writing these 3 lines in:

127.0.0.1    localhost
::1 localhost
127.0.1.1 YOUR_HOSTNAME.localdomain YOUR_HOSTNAME

Replace YOUR_HOSTNAME with your actual hostname.

Lastly let’s set our root’s password with passwd .

Setting Wifi

Grub

Next we need to let os-prober where our Windows is. So let’s check our Window’s EFI system partition directory with fdisk -l to double check. As mentioned in the partitioning step, any partitions before the ones you’ve created are the Window’s ones. Mine is on the 1st partition, so /dev/nvme0n1p1 . It might be something like /dev/sda# for you.

Let’s make a new mount folder for Windows withmkdir /mnt/win10 , and mount our Windows EFI to it with mount /dev/nvme0n1p1 /mnt/win10 .

Lastly let’s make our grub config with this command: grub-mkconfig -o /boot/grub/grub.cfg . The last output should show “Found Windows Boot Manager …”, which means we have successfully made a dualboot.

Taken from random example

Now we have successfully installed and configured Arch for dualboot on a Windows PC. Last commands to run areexit to get out of arch-chroot, umount -a to unmount all drives, then reboot. After rebooting, you should be greeted at the grub interface with an option for Arch or Windows. You can log into your new Arch system with root as user and the password you made earlier.

For NVME Users that CANNOT set to UEFI in BIOS

Starting version 247.3-1-arch
ERROR: device 'UUID=...' not found. Skipping fsck.
mount: /new_root: can't find UUID=...
You are now being dropped into an emergency shell.
sh: can't access tty: job control turned off

This most likely means that you haven’t set your storage to UEFI mode through the BIOS. It seems like newer computers with shiny NVME drives have this issue a lot. The steps to solve this:

  1. Boot back into the bootable Arch USB drive, go into the installation prompt
  2. mount /dev/linux_root_partition /mnt
  3. mount /dev/linux_efi_partition /mnt/boot
  4. arch-chroot /mnt
  5. vim /etc/mkinitcpio.conf

6. Change modules to the image above and save+quit

7. Run mkinitcpio -P linux to regenerate your kernel images

8. quit then umount -a then reboot , and your arch boot should work now.

I hope this helps out anyone trying to install Arch Linux, it is definitely a great Linux distro with a good community.

Like my content? — Support MeGithubTwitterMedium

Software Engineer living in Tokyo | Linux | Cats | https://github.com/kai-dg | https://haruspace.dev | https://ko-fi.com/harukai