Arch Installation Media Grub Screen

Installing Arch Linux (Dual Boot with Windows – Seperate Drives)

Have you always wanted to be able to add the iconic words; “I use Arch BTW” to your signature on a Linux forum? Are you distro-hopping and thought it would be a good idea to try out Arch Linux? It doesn’t really matter because it took me a bit of trial-and-error to get a working Arch installation that could co-exist with my Windows Installation with each on seperate physical drives (I have my reasons), but now that I have done that, I guess I can share the steps that I used. At the very least, I can refer to this post when I inevitably do it again.

My setup is such that I have Windows 11 running on a 1TiB NVMe drive and Arch (using systemd-boot) running on a separate 512GB NVMe drive. I also have a shared vfat partition on my 512GB Linux drive that I makes it rather convenient to share files between the two OS’ but that is highly optional.

The boot sequence, obviously, is to boot to the Linux Drive (using systemd-boot) where I can then select Windows 11, Arch or an EFI Shell (Which is handy when you need to set up systemd-boot).

I game a bit and need the proprietary nvidia drivers, I also do some cuda development and need the nvidia-cuda-toolkit, so I will be installing these along with my arch installation.

I use Gnome DE and Wayland, so these will also be installed along with my core OS.

Step 1 – Get Installation Media

Look, if you need my help with this step, then Arch is likely not for you and you should consider something a bit easier. 

  1. Download an iso from the Arch Downloads Page
  2. Verify it (or not, I don’t care)
  3. Burn it to USB media (Use Balena Etcher, nothing else really works reliably)

I just dumped a copy of the ISO (After verification) onto my Ventoy drive and took it from there.

Step 2 – Boot the Installation Media

  1. Firstly, you will need to disable SecureBoot in your UEFI (BIOS), this is required as you will not be able to boot the installation media with it enabled.
  2. Change your boot order or, use the boot-selection option (Depends on your hardware) to boot to the USB Media containing the Arch Installation Media
  3. When the Grub Bootloader on the media starts up, select: “Arch Linux install medium (x86_64, UEFI)
    Arch Installation Media Grub Screen
  4. Wait for the Arch Installation Environment to finish booting and you should see a command prompt like this:

    root@archiso ~ # _

Congratulations, you have just booted into the installation environment, notice the lack of any assistance or an installation Wizard, yeah, that’s the point. You need to perform each step along the way to get your installation running and whil the Arch Installation Instructions do help, it iexpects you to have a working understaning of each of the steps along the way to get your system working just right.

Step 3 – Connect to the Internet (WiFi)

You are going to need to download several required packages to get your Arch Installation working and, unless you are connected via ethernet, you are going to notice the lack of internet connectivity quite fast so let’s get that WiFi Connection up and running.

  1. Start the iwctl tool:

    iwctl
  2. You should now be in the iwd utility, so firstly, find your wireless device:

    device list
  3. This should list all the detected Wireless devices on your system (If none are shown, try restarting, sometimes my Intel Comet Lake Wireless need a restart cycle, I don’t know why but it mostly occurs for the first few restart cycles and then goes away). In my case, I see wlan0 so that’s the one I’m using (Your mileage may vary), now let’s put the wireless device in scan mode:

    station wlan0 scan
  4. Next we need to find a Wireless AP to connect to, so we use the get-networks function:

    station wlan0 get-networks
  5. You should now see a populated list of available wireless networks, in my case, BuFf0k Wireless is the SSID I want, so to connect (The brackets are necessary if there are spaces or special characters in the SSID name):

    station wlan0 connect "BuFf0k Wireless"
  6. It will ask for your passphrase, which you just enter and it should now be connected, once succesfully connected, exit the utility with Ctrl+D.
  7. Test your connection by pinging google.com:

    ping google.com
  8. If this didn’t work, you likely didn’t use the correct passphrase, just repeat points 1 through 7 again.

Now that we have a working internet connection we can go to the next step of the installation.

Step 4 – Partition your boot drive (Not the one with Windows on), format the partitions and then mount them

  1. Let’s list our drives so that we choose the right drive:

    fdisk -l
  2. This will list each drive detected by fdisk, in my case, it shows some Microsoft Partitions on /dev/nvme1n1 so I know that is not the drive I want, the one I want is /dev/nvme0n1 so I will tell fdisk to use that drive:

    fdisk /dev/nvme0n1
  3. Firstly, delete all existing partitions using d (Do this as many times as you need to make sure there are no more partitions, it will, by default, delete the last partition so in my case no. 3 first. Once all partitions are deleted, we can create our first partition with the n command.
  4. Since we are starting with the EFI Partition, make sure that it is Partition number 1, leave the First Sector at the default and set the last sector at 1Gb by typing +1G.
  5. Set the partition type to EFI by typing t and hitting enter (Note, you can then use L to list all the different options, but in my case EFI is option 1 so I choose that).
  6. Now we are going to create a root partition, sure you can add swap and seperate home partitions but I don’t want to so I am not going to. Again I use the n command and leave the default partition number and starting sector but, as this is also the last partition, I am using the default last sector as this will use the rest of the drive if you don’t want the shared vfat partition, in my case I set it to +400G, leaving around 79Gb for my shared partition.
  7. As the default partition type is Linux, I don’t need to change this and can now write our changes with w. If successful, this will exit fdisk and take us back to the prompt.
  8. Optionally, I now create my shared partition and change the type to Windows Standard, using t and selecting 7.
  9. Since we have partitioned the drive, we need to format those partitions, so firstly, we format the EFI Partition (/dev/sda1) as FAT32:

    mkfs.fat -F32 /dev/nvme0n1p1
  10. Then we format the root partition as EXT4 (Or whatever you wish)

    mkfs.ext4 /dev/nvme0n1p2
  11. Optionally, we will need to format the shared partition:

    mkfs.vfat /dev/nvme0n1p3
  12. Now we just need to mount the two (or three) partitions (Note that I am first mounting the second created (root) partition to /mnt and thereafter mounting the first created EFI partition to /mnt/boot, this matters and the last created shared partition to /mnt/mnt/shared) (Also, don’t miss the –mkdir switch when mounting the furhter partitions and the fact that shared is /mnt/mnt (to be in the /mnt directory of the installed system):

    mount /dev/nvme0n1p2 /mnt
    mount --mkdir /dev/nvme0n1p1 /mnt/boot
    mount --mkdir /dev/nvme0n1p3 /mnt/mnt/shared

Congratulations, you have no succesfully created, formatted and mounted the necessary partitions where we are going to install Arch to.

Step 5 – Optimize pacman to speed up the installation of Arch Linux:

This step is optional, but recommended as it should speed up not only the installation of Arch but also updates in future.

  1. Update pacman repos:

    pacman -Syy
  2. Install reflector:

    pacman -S reflector
  3. Generate an updated mirrorlist for pacman using the fastest mirrors for your region (Note I am using ZA for South Africa):

    reflector -c "ZA" -f 12 -l 10 -n 12 --save /etc/pacman.d/mirrorlist 
  4. Increase the number of concurrent downloads in pacman:

    nano /etc/pacman.conf
    ParallelDownloads = 10

And that is done, we should now be using the fastest possible mirrors for the rest of our installation.

Step 6 – Download and install the base Linux System

Now we are finally going to install the necessary linux packages to get a bootable system. Note here that I am including wayland, gnome, if you want another x-manager or DE, go ahead, it’s your system (Note I include nvidia and nvidia-settings but if you don’t have an nVidia GPU then don’t), if you get :

pacstrap -K /mnt base base-devel linux linux-firmware sof-firmware fwupd intel-ucode edk2-shell nvidia nvidia-settings cuda-tools wayland gdm xorg-xwayland xorg-xlsclients glfw-wayland egl-wayland networkmanager network-manager-applet gnome gnome-tweaks nautilus-sendto gnome-nettool gnome-usage xdg-user-dirs-gtk gnome-terminal gnome-control-center gnome-bluetooth-3.0 gnome-power-manager sudo nano bash-completion git vlc

Step 7 – Generate an fstab file

  1. You need to have the installed system be able to mount it’s partitions at boot, otherwise you won’t be suing your system. Yeah, I know, sounds basic but we are working with Arch here:

    genfstab -U /mnt >> /mnt/etc/fstab
  2. Optionally, if you created the shared partition, you will need to adjust fstab to allow read write permissions, that is done by removing fmask=022 and dmask=022 and adding user and umask=000 to the newly created fstab file:

    # /dev/nvme0n1p2
    UID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx	/         	ext4      	rw,relatime	0 1
    
    # /dev/nvme0n1p1
    UUID=xxxx-xxxx      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2
    
    # /dev/nvme0n1p3
    UUID=xxxx-xxxx      	/mnt/shared	exfat     	rw,relatime,user,umask=000,iocharset=utf8,errors=remount-ro	0 2

Step 8 – Configure your newly installed system

Hah, thought you were done, havin installed everyting and told Linux where all the installed stuff can be found, guess again, because it still doesn’t work, for that, we are going to chroot into the installed system to configure a few last things:

  1. chroot into the newly installed system using arch-chroot:

    arch-chroot /mnt
  2. Now we need to system clock and location, this is done by creating a symlink as follows (Note I am using Africa/Johannesburg as this is GMT+2 for where I live):

    ln -sf /usr/share/zoneinfo/Africa/Johannesburg /etc/localtime
  3. Syncrhonize the clock (Assuming your system clock is set to UTC):

    hwclock --systohc
  4. Edit the /etc/locale.gen file to uncomment any locales you will need, for my purposes I am using en_ZA.UTF-8 so I can just uncomment that line:

    nano /etc/locale.gen
  5. Generate the locale your chosen language:

    locale-gen
  6. Now generate the /etc/locale.conf file with your chosen language:

    echo LANG=en_ZA.UTF-8 > /etc/locale.conf
  7. Since we are in chroot, we need to set the locale environment variable for the session:

    export LANG=en_ZA.UTF-8
  8. Next we need to set the hostname for your new system, I am using buff0k, but feel free to substitute your own:

    echo buff0k > /etc/hostname
  9. You also need to create the /etc/hosts file:

    touch /etc/hosts
  10. Populate the /etc/hosts file with your settings, again, note that I am using the hostname, buff0k, this should be the same as per point 8 above in your case:

    nano /etc/hosts
  11. And add the following to the file:

    #127.0.0.1	localhost
    #::1		localhost ip6-loopback ip6-localhost
    #127.0.1.1	buff0k.local buff0k
  12. Set the root user’s password for your new system:

    passwd
  13. Configure your timezone in timedatectl:

    timedatectl set-timezone "Africa/Johannesburg"
  14. Create your user account and home directories:

    useradd -m buff0k
  15. Set a password for your new user:

    passwd buff0k
  16. And grant the required privileges to this user (Note, we will add wheel to the sudoers list in the next step so there is no need to include sudo):

    usermod -aG wheel,audio,video,storage buff0k
  17. In order to have sudo access for the wheel group, you can edit the sudo configuration:

    EDITOR=nano visudo

    And uncomment the following line:

    %wheel ALL=(ALL:ALL) ALL

    Optionally, if you dont’t want to require a password for sudo, uncomment this line instead:

    %wheel ALL=(ALL:ALL) NOPASSWD: ALL
  18. Next we need to install the systemd-boot bootloader:

    bootctl install
  19. We also need to enable some systemd services:

    systemctl enable gdm.service
    systemctl enable NetworkManager.service
    systemctl enable bluetooth.service
    systemctl enable systemd-boot-update.service
  20. Earlier we installed the edk2-shell EFI shell, which we now need to make bootable, since systemd-boot can only boot from its own partition, we need to copy the EFI shell there. This is also how we are going to get systemd-boot to boot Windows from another partition:

    cp /usr/share/edk2-shell/x64/Shell.efi /boot/shellx64.efi
  21. Now to create a boot entry for the EFI shell for systemd-boot, all we need to do is create a loader entry .conf file:

    nano /boot/loader/entries/efi.conf

    and edit to look like this:

    title EFI Shell
    efi /shellx64.efi
  22. In order to create a loader entry for Arch Linux, we will need to know the UUID for the root partition, in order to get that we use blkid:

    blkid

    and note down the UUID (Not the PARTUUID) for nvme0n1p2, it will resemble: UUID=240e775a-6e20-47f5-8ab1-91cd47c34894

  23. Now we just create a boot entry for Arch for system-d boot:

    nano /boot/loader/entries/arch.conf

    and, using the UUID from point 22 above, edit to look like this:

    title Arch Linux
    linux /vmlinuz-linux
    initrd /intel-ucode.img
    initrd /initramfs-linux.img
    options root=UUID=240e775a-6e20-47f5-8ab1-91cd47c34894 rw
  24. Optionally, you can also create a Arch Liunux Fallback entry:

    nano /boot/loader/entries/arch-fallback.conf

    and, using the same UUID as point 23 above, edit it to look like this:

    title Arch Linux Fallback
    linux /vmlinuz-linux
    initrd /intel-ucode.img
    initrd /initramfs-linux-fallback.img
    options root=UUID=240e775a-6e20-47f5-8ab1-91cd47c34894 rw
  25. Since I like to clean up some junk before I boot into Arch, I also want to remove some packages I don’t want:

    pacman -Rcs gnome-contacts gnome-music gnome-calendar gnome-tour gnome-weather epiphany gnome-software
  26. We are now ready to finalize the installation of Arch by exitint arch-chroot:

    exit
  27. We can unmount the /mnt partition:

    umount -R /mnt
  28. And now we can safetly reboot into Arch:

    reboot

Step 9 – Add the Windows Boot Loader to systemd-boot

Now that we have a working installation of Arch, we need to add a loader entry for Windows, but since this requires a bit of EFI knowledge, we need to restart our computer and choose the EFI entry from the systemd-boot selection screen. This is because it will boot to an EFI shell which will list all the FS Alias’  that EFI uses, and we need to know the FS Alias for the Microsoft EFI partition on the second drive, in our case, it was HD1b, so making a note of that, we can restart back into arch and then open our terminal.

Once in terminal, we need to create two files:

  1. We need a windows.nsh file, which tells the EFI loader where to find the Windows Boot Loader, to do that:

    sudo nano /boot/windows.nsh
  2. We now use the FS Alias (HD1b in my case) for the Windows Boot Loader Partition and make this file look like this:

    HD1b:EFI\Microsoft\Boot\bootmgfw.efi
  3. Now that we have an nsh script for the EFI shell, we need to create an entry for systemd-boot:

    sudo nano /boot/loader/entries/windows.conf

    and edit the file to point to that entry:

    title Windows 11
    efi /shellx64.efi
    options -nointerrupt -noconsolein -noconsoleout windows.nsh
  4. Optionally, we might want to set a default option, this can be done by editing the loader.conf file:

    sudo nano /boot/loader.conf

    and edit to point to the .conf file of your choice (arch.conf, arch-fallback.conf, windows.conf or efi.conf):

    default arch.conf
    timeout 5
    console-mode keep

We now have a fully working bootloader to dual-boot between Arch and Windows using systemd-boot.

Step 10 – Further configurations:

With all the real work done, we can now add some additional software just to make using the AUR easier, I like to use YAY and pamac for that purpose:

  1. Firstly, we need to git clone the yay-bin repo from the AUR:

    git clone https://aur.archlinux.org/yay-bin.git
  2. Then we need to cd into the yay-bin directory:

    cd yay-bin
  3. And then simply install yay:

    makepkg -si
  4. Once yay is installed, we can safely remove the yay-bin directory:

    rm -rf ~/yay-bin
  5. Now we can use yay to install some additional software, noting that it will ask you for options on how to compile and which specific packages to overwrite, so pay attention, this is AUR:

    yay -S pamac-aur gnome-terminal-transparency microsoft-edge-stable-bin visual-studio-code-bin

And now we are basically done with installing Arch and some extra goodies.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *