From blog post Arch Linux on The Surface Pro 4. Created for Jordi Higuera
If you do have access to a hub, and you have physical access to the machine, letting you plug a keyboard in, you're probably better off using a fresh install ISO. From the Arch Download page download an up to date ISO.
If you've already gone through the steps of shrinking your SSD to give you some extra room on your SSD, once you've booted in to the ISO run lsblk
you should see something like this:
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 1 119.1G 0 disk
└─sda1 8:1 1 119.1G 0 part /run/archiso/bootmnt
loop0 7:0 0 330M 1 loop /run/archiso/sfs/airootfs
nvme0n1 259:0 0 238.5G 0 disk
├─nvme0n1p1 259:1 0 260M 0 part
├─nvme0n1p2 259:2 0 128M 0 part
└─nvme0n1p3 259:3 0 197.2G 0 part
.You want to create a new partition, run gdisk /dev/nvme0n1
, assuming your nvme drive shows up as nvme0n1
gdisk /dev/nvme0n1
Now I'm not sure what you decided to do for your partitioning, but I would probably create a root partition, and a home partition. You probably want a root partition between 20 - 30GB, and then use the rest for your home partition where most of your data will be stored. Here is an example of creating a 25GB root partition and using the rest of what you sectioned off from your shrunken Windows disk. So if you partition 40 gigabytes, 15GB for home. (you should be able to access the rest of your windows disk as well later from Linux).
I don't usually create a swap space but if you decide you want to create one take a look at the wiki's page on swap
Here are the different options:
Command (? for help): ?
b back up GPT data to a file
c change a partition's name
d delete a partition
i show detailed information on a partition
l list known partition types
n add a new partition
o create a new empty GUID partition table (GPT)
p print the partition table
q quit without saving changes
r recovery and transformation options (experts only)
s sort partitions
t change a partition's type code
v verify disk
w write table to disk and exit
x extra functionality (experts only)
? print this menu
Add a new partition, n
It should say something like:
Partition number (4-128, default 4):
Press enter
to accept the default 4th partition.
First sector (34-500118158, default = 414345216) or {+-}size{KMGTP}:
Press enter
to accept starting the partition from the end of the last partition.
Last sector (414345216-500118158, default = 500118158) or {+-}size{KMGTP}:
type +25G
to create root.
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):
Press L
to see the codes, here are the options:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): L
0700 Microsoft basic data 0c01 Microsoft reserved 2700 Windows RE
3000 ONIE boot 3001 ONIE config 3900 Plan 9
4100 PowerPC PReP boot 4200 Windows LDM data 4201 Windows LDM metadata
4202 Windows Storage Spac 7501 IBM GPFS 7f00 ChromeOS kernel
7f01 ChromeOS root 7f02 ChromeOS reserved 8200 Linux swap
8300 Linux filesystem 8301 Linux reserved 8302 Linux /home
8303 Linux x86 root (/) 8304 Linux x86-64 root (/ 8305 Linux ARM64 root (/)
8306 Linux /srv 8307 Linux ARM32 root (/) 8400 Intel Rapid Start
8e00 Linux LVM a500 FreeBSD disklabel a501 FreeBSD boot
a502 FreeBSD swap a503 FreeBSD UFS a504 FreeBSD ZFS
a505 FreeBSD Vinum/RAID a580 Midnight BSD data a581 Midnight BSD boot
a582 Midnight BSD swap a583 Midnight BSD UFS a584 Midnight BSD ZFS
a585 Midnight BSD Vinum a600 OpenBSD disklabel a800 Apple UFS
a901 NetBSD swap a902 NetBSD FFS a903 NetBSD LFS
a904 NetBSD concatenated a905 NetBSD encrypted a906 NetBSD RAID
ab00 Recovery HD af00 Apple HFS/HFS+ af01 Apple RAID
af02 Apple RAID offline af03 Apple label af04 AppleTV recovery
af05 Apple Core Storage bc00 Acronis Secure Zone be00 Solaris boot
bf00 Solaris root bf01 Solaris /usr & Mac Z bf02 Solaris swap
bf03 Solaris backup bf04 Solaris /var bf05 Solaris /home
bf06 Solaris alternate se bf07 Solaris Reserved 1 bf08 Solaris Reserved 2
Press the <Enter> key to see more codes:
bf09 Solaris Reserved 3 bf0a Solaris Reserved 4 bf0b Solaris Reserved 5
c001 HP-UX data c002 HP-UX service ea00 Freedesktop $BOOT
eb00 Haiku BFS ed00 Sony system partitio ed01 Lenovo system partit
ef00 EFI System ef01 MBR partition scheme ef02 BIOS boot partition
f800 Ceph OSD f801 Ceph dm-crypt OSD f802 Ceph journal
f803 Ceph dm-crypt journa f804 Ceph disk in creatio f805 Ceph dm-crypt disk i
fb00 VMWare VMFS fb01 VMWare reserved fc00 VMWare kcore crash p
fd00 Linux RAID
Hex code or GUID (L to show codes, Enter = 8300):
Type 8304
.
Now do the same for home.
Type n
, then enter
to accept partition 5,
Press enter
to make the first partition start from the end of the last partition,
Press enter
to accept the last sector going to the end of the disk.
Hex code 8302
for 'linux home'.
So for both of those this is what it would look like, ignore the partition numbers, yours will be different
For root:
Command (? for help): n
Partition number (1-128, default 1):
First sector (34-3907029134, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-3907029134, default = 3907029134) or {+-}size{KMGTP}: +25G
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 8304
Changed type of partition to 'Linux x86-64 root (/)'
For home:
Command (? for help): n
Partition number (2-128, default 2):
First sector (34-3907029134, default = 52430848) or {+-}size{KMGTP}:
Last sector (52430848-3907029134, default = 3907029134) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 8302
Changed type of partition to 'Linux /home'
Type p
and make sure they look correct.
They should look like this except yours will be partition four and five:
Number Start (sector) End (sector) Size Code Name
1 2048 52430847 25.0 GiB 8304 Linux x86-64 root (/)
2 52430848 3907029134 15.0 GiB 8302 Linux /home
Now type w
to accept.
Now you should be able to go through the installation guide step by step.
Reset the keyboard layout, if you use a US layout it's already set, if you want to set something else check the options with:
ls /usr/share/kbd/keymaps/**/*.map.gz
If you wanted a German layout you would run:
loadkeys de-latin1
Check if you have internet connectivity by pinging a website:
ping archlinux.org
Hopefully there is conectivity and we can continue, otherwise you need to go through Network configuration:
No update the system clock:
timedatectl set-ntp true
Format your partitions, ext4 will be a good choice. Format root and home:
The partition number should be nvme0n1p4
, and nvme0n1p5
that we created earlier, but you should probably check with lsblk
. If they are, format them both ext4
mkfs.ext4 /dev/nvme0n1p4
mkfs.ext4 /dev/nvme0n1p5
.Mount your partitions, mount root to /mnt
and home to /mnt/home
mount /dev/nvme0n1p4 /mnt
mkdir /mnt/home
mount /dev/nvme0n1p5 /mnt/home
.We're going to use the boot partition from Windows, it should be the 260M partition you see when you run lsblk
. For me it was nvme0n1p1
Mount the partition to /mnt/boot
:
mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot
Uncomment a few mirrors in /etc/pacman.d/mirrorlist
that are close to you:
nano /etc/pacman.d/mirrorlist
Install the base:
pacstrap /mnt base
genfstab -U /mnt >> /mnt/etc/fstab
Check the file in /mnt/etc/fstab
, you should see the three partitions: root, home and boot.
nano /mnt/etc/fstab
Now chroot into the new system
arch-chroot /mnt
Set the timezone, you can find the different options in '/usr/share/zoneinfo/Region/City
For example /usr/share/zoneinfo/America/Los_Angeles
:
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
hwclock --systohc
.ncomment your locale in /etc/locale.gen
I usually just uncomment en_US.UTF-8 UTF-8
,
nano /etc/locale.gen
Then generate them:
locale-gen
Set the LANG variable to your locale, I usually set LANG=en_US.UTF-8
:
nano /etc/locale.conf
If you changed the keyboard layout earlier, set the keymap in /etc/vconsole.conf
to the same thing. For example for a German layout: KEYMAP=de-latin1
.
nano /etc/vconsole.conf
Set your hostname in /etc/hostname
. Just leave your hostname inside the file.
nano /etc/hostname
Add a matching entry in /etc/hosts
. Say your host name was myhostname
you would enter:
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost
127.0.1.1 myhostname.localdomain myhostname
nano /etc/hosts
I showed my setup in my blog post.
I like to use netctl for internet access. Once profiles are setup it allows seamless switching between interfaces such as wired and wireless. It will also automatically connect to the internet when an ethernet cable is plugged in.
netctl comes with Arch, but in order to use wireless and have ethernet automatically respond to a cable being plugged in you will need a few packages.
pacman -S ifplugd wpa_actiond
Check the interfaces.
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s20f0u1u4c2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
link/ether 60:45:bd:f9:c8:03 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.6/24 brd 192.168.0.255 scope global enp0s20f0u1u4c2
valid_lft forever preferred_lft forever
inet6 fe80::61e7:426b:5e50:9ae7/64 scope link
valid_lft forever preferred_lft forever
3: wlp2s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether b4:ae:2b:e0:fb:35 brd ff:ff:ff:ff:ff:ff
Set up an Ethernet profile
cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/ethernet-dhcp-profile
nano /etc/netctl/ethernet-dhcp-profile
# nano 2.6.2 File: /etc/netctl/ethernet-dhcp-profile Modified
Description='A basic dhcp ethernet connection'
Interface=enp0s20f0u1u4c2
Connection=ethernet
IP=dhcp
Enable the wired profile.
netctl enable ethernet-dhcp-profile
I wasn't able to get wireless working in the live installer so I set up ethernet, leaving wireless for later.
Now build the kernel:
mkinitcpio -p linux
Set the root password
passwd
Set up a bootloader with systemd-boot
bootctl --path=/boot install
Install Intel microcode
pacman -S intel-ucode
create a bootloader entry:
nano /boot/loader/loader.conf
You probably want something like:
title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
options root=PARTUUID=14420948-2cea-4de7-b042-40f67c618660 rw
Check your UUID with blkid
, use the UUID for the root partition nvme0n1p4
.
Add an entry for Windows if it remains, probably nvme0n1p3
:
nano /boot/loader/entries/windows.conf
title Windows
efi /EFI/Microsoft/Boot/bootmgfw.efi
options root=PARTUUID=1f00bed2-bfb7-48b9-95f2-5dba2cfb1552 rw
Set the default to boot Arch:
nano /boot/loader/loader.conf
default arch
timeout 2
If you want to set it to boot Windows as default replace arch with Windows.
Exit the chroot:
exit
Unmount partitions:
umount -R /mnt
Reboot and you should boot into Arch. You won't have a graphical interface yet, you probably want to look through General Reccomendations. I walk through my post install where I setup openbox.
When you say, "create a bootloader entry:"
nano /boot/loader/loader.conf
This should probably be
nano /boot/loader/entries/arch.conf
Alas, my Surface Go does not boot into arch...
Anyways, thanks for the great gist!