Ensure your machine has the latest updates and firmware installed on the windows side.
Later in this guide we will disable secure boot. If you have BitLocker enabled, you will have to reenter your BitLocker key in order to boot your device. My preference is to disable BitLocker entirely, but if you want to keep it turned on make sure you have your BitLocker key.
From the settings menu click Privacy encryption > Find your BitLocker recovery key
From the settings menu click Privacy & Security > Device encryption
and
turn Device encryption
off. At the warning prompt click Turn off
Press WIN + R
to get a run dialog and run diskmgmt.msc
.
Right click on Local Disk (C:)
and click Shrink Volume...
Enter the amount of space you would like to set aside for Linux. I have
the 512GB Model, so I like to give linux roughly half at 256GB. The size
is in MB, so 256 * 1024 = 262144MB then click Shrink
. The Windows
partition ends up being slightly smaller because of the recovery
partition, boot partition and the fact that manufactures report drive
sizes in GiB not GB. Resize as you see fit.
Arch does not configure secure boot out of the box. Though it is possible to configure, I have not attempted it yet and simply disable secure boot in my setup.
Reboot your machine and hold down the volume up
button during boot to
enter the UEFI Menu
From the Security
menu, under Secure Boot
click Change configuration
Select None
and click OK
From the Boot Configuration
menu, click and drag USB Storage
to the
top of your boot order.
Plug in your USB drive with the Arch ISO
From the Exit
menu click Restart now
Your machine should boot to the Arch install environment
The default keyboard layout is US. If you are using a US keyboard you can skip this step. If you need to adjust your layout follow the step on the ArchWiki.
Get an interactive iwctl
prompt:
# iwctl
Scan for networks
[iwd]# station wlan0 scan
List available networks
[iwd]# station wlan0 get-networks
Connect to your wifi network
[iwd]# station wlan0 connect <YOUR_SSID>
Enter your Passphrase if prompted
Verify your connection with
[iwd]# station wlan0 show
Exit iwdctl
with
[iwd]# exit
# timedatectl set-ntp true
List your block devices with
# fdisk -l
There should be 3 devices listed /dev/nvme0n1
is the one we are
concerned with. It will have 4 existing partitions. We will be adding
2 more.
Use fdisk to modify partition tables
# fdisk /dev/nvme0n1
Verify free space
Command (m for help): F
If all went well shrinking the drive earlier, you should see a free space
the size you specified, in my case 256G
The amount of space to set aside for swap is debatable. I use 8GB. If you ever want to hibernate it needs to exceed the size of your RAM, but I do not use that feature, and I'm not sure if its even supported.
Create a swap partition
Command (m for help): n
You can leave the partition number and first sector default
For Last sector enter
Last sector, ... : +<SIZE IN GB>G
In my example I would enter +8G
By default this will create a Linux filesystem
partition. We need to
change it to a swap partition.
Command (m for help): t
Select the partition number you just created (likely 5)
Partition number...: 5
Select the partition type Linux swap
Partition type or alias ... : 19
Now we can create our root partition with the remaining space
Command (m for help): n
You can leave the partition number, first sector, and last sector all
default. The Linux filesystem
type for this partition is fine as well
Write the table to the disk and exit
Command (m for help): w
If you have been following along with me your swap partition should be on
/dev/nvme0n1p5
and your root partition should be on /dev/nvme0n1p6
.
Format your swap partition
# mkswap /dev/nvme0n1p5
Format your root partition
# mkfs.ext4 /dev/nvme0n1p6
We will use the existing EFI boot partition from windows so there is no need to format that partition.
Mount the root partition
# mount /dev/nvme0n1p6 /mnt
Create the boot mount point
# mkdir /mnt/boot
Mount the boot partition
# mount /dev/nvme0n1p1 /mnt/boot
Enable the swap partition
# swapon /dev/nvme0n1p5
Use pacstrap to install the base, kernel, and firmware packages. I include neovim here to edit files later. You can include your favorite text editor.
# pacstrap /mnt base linux linux-firmware neovim
Generate an fstab file
# genfstab -U /mnt >> /mnt/etc/fstab
Change root into the new system
# arch-chroot /mnt
Set the time zone:
# ln -sf /usr/share/zoneinfo/<REGION>/<CITY> /etc/localtime
Run hwclock to generate /etc/adjtime
# hwclock --systohc
Edit /etc/locale.gen
and uncomment en_US.UTF-8 UTF-8
and other needed
locales.
# nvim /etc/locale.gen
Generate the locales
# locale-gen
Create and edit the /etc/locale.conf
file
# nvim /etc/locale.conf
Set the LANG
variable by adding the following line to the file
LANG=en_US.UTF-8
If you set the console keyboard layout, make the changes persistent by
adding and editing the file /etc/vconsole.conf
# nvim /etc/vconsole.conf
Add your keyboard layout with the following
KEYMAP=<your keymap>
for example: KEYMAP=de-latin1
Create and edit the hostname file
# nvim /etc/hostname
Simply add your desired hostname to the first line of the file. For
example archbook
Install a network manager. I use iwd just like the installer
# pacman -S iwd dhcpcd
Enable the iwd service at boot
# systemctl enable iwd
Enable the dhcpcd service at boot
# systemctl enable dhcpcd
Set the root password
# passwd
Install the Intel Microcode
# pacman -S intel-ucode
Install a boot loader. I use refind
# pacman -S refind
Activate refind as the boot loader
# refind-install
When refind-install
is run in a chroot environment like we are now,
/boot/refind_linux.conf
is populated with kernel options from the live system,
not the one on which it is installed. Edit the /boot/refind_linux.conf
file
and simply delete the first two lines. We will be changing this later anyway.
# nvim /boot/refind_linux.conf
Leave only the following line
"Boot with minimal options" "ro root=/dev/nvme0n1p6"
Exit the chroot environment
# exit
Reboot
# reboot
You should be greeted with your rEFInd boot menu where you can select your Arch install or you Windows install. Boot your Arch Install and log in as root using the password you setup earlier
Create a user with the wheel group
# useradd -m -G wheel <USERNAME>
Give the new user a password
# passwd <USERNAME>
Allow users of the wheel
group to use sudo
# nvim /etc/sudoers
Uncomment the line
%wheel ALL=(ALL:ALL) ALL
Log out and log back in as your new user
# logout
Connect to the internet using iwctl
and the instructions above
Import the keys used to sign the packages
$ curl -s https://raw.githubusercontent.com/linux-surface/linux-surface/master/pkg/keys/surface.asc \
| sudo pacman-key --add -
Check and verify the fingerprint of the key
$ sudo pacman-key --finger 56C464BAAC421453
Locally sign the key
$ sudo pacman-key --lsign-key 56C464BAAC421453
Open /etc/pacman.conf
for editing
$ sudo nvim /etc/pacman.conf
Add the following to the bottom
[linux-surface]
Server = https://pkg.surfacelinux.com/arch/
Refresh the repositories
$ sudo pacman -Syu
Install linux-surface
linux-surface-headers
and iptsd
$ sudo pacman -S linux-surface linux-surface-headers iptsd
Enable iptsd
at boot
$ sudo systemctl enable iptsd
Install git and the required build tools and dependencies
$ sudo pacman -S git base-devel
Clone the libwacom-surface repository
$ git clone https://aur.archlinux.org/libwacom-surface.git
Change to the libwacom-surface directory
$ cd libwacom-surface
Get the gpg key for libwacom
$gpg --recv-key E23B7E70B467F0BF
Build and install the package
$ makepkg -sirc
Edit refind_linux.conf
$ sudo nvim /boot/refind_linux.conf
Update it to read
"Boot using default options" "root=/dev/nvme0n1p6 rw add_efi_memmap initrd=intel-ucode.img initrd-initramfs-linux-surface.img"
"Boot usind fallback initramfs" "root=/dev/nvme0n1p6 rw add_efi_memmap initrd=intel-ucode.img initrd-initramfs-linux-surface-fallback.img"
"Boot to terminal" "root=/dev/nvme0n1p6 rw add_efi_memmap initrd=intel-ucode.img initrd-initramfs-linux-surface.img systemd.unit=multi-user.target"
"Boot with minimal options" "ro root=/dev/nvme0n1p6"