A while back I switched from Windows to Linux, and one of my friends convinced me to use Arch Linux. It was a heavy lift to use Arch Linux as one of my first installs, but he guided me along, and I compiled our chat history regarding installing Arch into a nice tutorial, that even a technically inexperienced person should manage to follow along.
This tutorial specifically is originating from when I installed Arch on my Surface 7 Pro device, yet it should be almost the same on all other devices.
From this point onwards, it becomes technical
Step 0: Boot your Arch Linux Livesystem
This is different from device to device, and I have no idea which device you use. Usually you have to set the boot order in your BIOS, just google how it works on your device. Additionaly, do not forget to deactivate Secure Boot, because if it stays activated, it will just boot the currently installed system again.
Step 1: Repartitioning the disk
The disk on which your OS is running is separated into partitions. Those are completely independent sectors of your disk, basically virtual disks on your physical disks. We will now create a partition for the OS and for the userspace.
In the console, enter
fdisk /dev/nvme0n1
The nvme0n1 part can be different, depending on what kind of disk you are running in your system.
Inside fdisk, delete all existing Windows partitions by pressing d repeatedly until p doesn’t show any partitions anymore. I can’t think of any errors you could encounter during this. Additionally, p has to tell you that you currently have a GPT disk. If not, follow the instructions using m.
FROM NOW ON, YOUR DEVICE WON’T BE BOOTABLE UNTIL ARCH IS FULLY INSTALLED. THERE IS NO UNDO BUTTON, NO CTRL+Z. IF YOU SWITCH OFF YOUR DEVICE, ALL PROGRESS IS LOST!
Create a new EFI and Root partition
In fdisk, you create a new partition with n. Type n, take all the default values except the last sector, where you will type +100M. This creates a 100 million byte (or 100 megabytes) long partition. Change the type of the partition to EFI. Use t and select EFI, which is usually ID 1 or ef00. Running p now should show something like
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 206847 204800 100M EFI System
The next partition is created by just typing n and accepting all default values.
If you have mistyped something, just delete the partition with d and restart creating the partition.
Write your changes to the disk by executing w. If fdisk exits without errors, the new partition table is now live.
Formatting the Filesystems
The EFI partition must be FAT:
mkfs.vfat /dev/nvme0n1p1
This should return
mkfs.fat 4.2
The root partition uses ext4:
mkfs.ext4 /dev/nvme0n1p2
That should return
Creating filesystem with ...
Discarding device blocks...
Warnings about discarding blocks are normal on SSDs.
Hint: the p1 part in nvme0n1p1 stands for “Partition 1”.
Step 2: Mounting everything
In Linux, you have to mount your file systems. That is basically telling Linux via which folders you can access the file systems on your disk. This may be a bit unfamiliar concept to Windows users. In Linux, every folder can reference another folder, files, but also file systems.
We now have to mount the root filesystem:
mount /dev/nvme0n1p2 /mnt
We then create and mount the EFI directory:
mkdir /mnt/efi
mount /dev/nvme0n1p1 /mnt/efi
Verify that everything worked with df -h. That should return
Filesystem Size Used Avail Use% Mounted on
/dev/nvme0n1p2 ... ... ... ... /mnt
/dev/nvme0n1p1 100M ... ... ... /mnt/efi
In case that /mnt/efi/ is missing, the GRUB installation will fail later.
Step 3: Network check
Making sure your computer is connected to the internet is always a good thing. Execute ping google.com, and wait until it returns something like 64 bytes from ... icmp_seq=1 ttl=....
If you are not connected because you are in a WLAN
If you want to connect via WLAN, type iwctl. This should change the prompt to [iwd]#, an indicator that you are now inside the tool. Identify your devices with device list. For further examples I used the device name wlan0, but replace that with the name displayed to you in the device list.
Scan for networks with
station wlan0 scan
station wlan0 get-networks
Find the name of your network (the so-called SSID) in your list and execute
station wlan0 connect "Your-Network-Name"
Once it connects, close iwctl by typing exit and check your connection with the ping command from earlier.
---- End of WLAN connection section ----
If you are not using WLAN but are connected via an Ethernet cable, you should already be connected to the internet.
Step 4: Installing the base system
We are now ready to install the Arch Linux base system. The live system is using a tool called pacstrap for that, a lightweight tool of its bigger cousin pacman.
Install the following packages
pacstrap /mnt base base-devel linux linux-firmware grub zsh htop openssh vim grml-zsh-config efibootmgr
You should see a lot of progress bars. If it failed, you may have some unstable connection to mirrors (the page where all the packages are stored). Before changing anything, just try again.
Generating the fstab
A mistake I made during the installation was to forget to generate the fstab. If you forget that, your system will boot into nothing. Execute
genfstab /mnt >> /mnt/etc/fstab
Do not expect any output.
Entering the installed system
It is time to enter the system you just installed:
arch-chroot /mnt
If this failed, then /mnt is not mounted correctly. I am afraid you have to jump back to Step 2 and repeat everything again.
Step 5: Configuring everything
It is time to give the computer a name and also set the keyboard layout if you want to change the layout:
echo YOUR-COMPUTER-NAME > /etc/hostname
echo KEYMAP=de-latin1 > /etc/vconsole.conf
If you were a non-penguin user before, now will probably be the first time you come into contact with vim. It is normal to hate it at first, but you will come to love it. We have to generate the locale configuration. This will tell the computer how to display certain stuff like date, time, languages, and so on.
Open the locale file with
vim /etc/locale.gen
Find the line of the locale you want to use. In this example I used the US locale named en_US.UTF-8 UTF-8. You want to use a UTF-8 too!
For that, in vim, press i to enter Insert Mode. Navigate with the arrow keys, set the cursor at the very beginning of the line of the locale you want to use, press the Delete key to remove the #, press ESC, then type :wq for Write and Quit. Alternatively, you can just press x when the cursor is on the character that should be deleted. Remember the insert mode for later though.
Then generate the locale by executing locale-gen. Now, set the default language:
echo LANG=en_US.UTF-8 > /etc/locale.conf
Also copy the timezone info you want:
ln -s /usr/share/zoneinfo/Europe/Vienna /etc/localtime
Step 6: Install the bootloader (GRUB)
Install GRUB:
grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB
This should output something like
Installation finished. No error reported.
If this fails, check if you correctly typed x86_64-efi (underscore matters), and if /efi is mounted.
Generate the GRUB config file with:
grub-mkconfig -o /boot/grub/grub.cfg
Step 7: Network and Desktop
Then you want to install a Network Manager and a desktop. Install the network manager with
pacman -S networkmanager
systemctl enable NetworkManager
and KDE with
pacman -S plasma-meta kde-applications-meta sddm
systemctl enable sddm
This takes a while. That is normal.
Step 8: Users and passwords
You want to make a password for your root user. Type passwd for that and enter a password.
You also want to make a user that you are using for everything else. Type
useradd -m -s /bin/zsh <username>
passwd <username>
and set a password.
Step 9: First reboot
Now this is the moment of truth: the first reboot. Execute:
exit
umount /mnt/efi /mnt
reboot
If you have done everything correctly, then GRUB should appear, KDE should start, and the network should be connected automatically.
If that happened, congratulations, you successfully installed Arch Linux.
Surface-specific stuff that happens now
At this point, Arch is running on whatever device you installed it on. But now, instructions to install some packages that I needed to make Arch Linux fully work on my Surface device will follow. If you are not running a Surface device, you are now finished and can enjoy your new Linux device.
The problems I ran into with the normal Linux kernel were
- No touch
- No pen
- No sensors
- The login screen was effectively unusable without a physical keyboard.
The standard Arch Linux kernel (linux) does not fully support Microsoft Surface hardware.
Booting works. Graphics work. WLAN usually works. But touch and related devices rely on drivers that are not upstream or are incomplete.
The fix is the Surface Linux kernel, maintained separately by volunteers. This is not optional if you want to use the device as intended.
If you are in your normal user now, get into the root user. It will make stuff a lot easier. Type su - in your terminal and then enter your password. You can see that you are now root by the prefix.
The next part is basically ripped off from the surface-kernel wiki link, but I’ll describe it here too.
Importing the linux-surface Signing Key
Before Arch will trust the repository, its signing key must be imported.
curl -s https://raw.githubusercontent.com/linux-surface/linux-surface/master/pkg/keys/surface.asc \
| pacman-key --add -
Expected output:
gpg: key XXXXXXXX: public key "linux-surface <contact@linux-surface.org>" imported
It is strongly recommended to verify the key fingerprint:
pacman-key --finger 56C464BAAC421453
Expected output:
Key fingerprint = 56C4 64BA AC42 1453
Finally, the key must be locally trusted:
pacman-key --lsign-key 56C464BAAC421453
Expected output:
==> Locally signing key 56C464BAAC421453...
If pacman complains here, this can have several reasons:
- You are not root
- The key was not imported correctly
- Adding the linux-surface repository
Add the repository to pacman. For that, open the config
vim /etc/pacman.conf
Enter Insert mode by pressing i, use the arrow keys to navigate, and type the following at the end of the file:
[linux-surface]
Server = https://pkg.surfacelinux.com/arch/
Save and exit by pressing ESC and typing :wq.
Now we have to update pacman by executing pacman -Syu. That should show something like
:: Synchronizing package databases...
linux-surface [######################] 100%
If you can see that, you did well!
Now we can install the new kernel:
pacman -S linux-surface linux-surface-headers iptsd
Updating GRUB config file
Just to be safe, we have to recreate the GRUB config file, to make sure it doesn’t load the old kernel. For that, we just type
sudo mkinitcpio -P
sudo grub-mkconfig -o /boot/grub/grub.cfg
and reboot the system by typing reboot. After it booted up again, verify the kernel by using uname -a.
At this point, the tutorial is finished. In case you have any questions or improvements, please reach out to me so I can make this tutorial correct, complete, or easier to understand. If you run into an error, I can really recommend the Arch Wiki Installation Guide. They have an even more complete tutorial than I have here.