Archlinux on a Lenovo Thinkpad X240

Here is a full tutorial on how to install archlinux on a Lenovo ThinkPad X240.

No more Microsoft Windows

This tutorial will erase the windows partition.

Who needs to dual boot Linux & Windows when you have a lighweight system capable of launching 3 different Windows versions in VirtualBox and still be able to browse while playing music in Spotify?

I don't!

X240 intro

The Lenovo ThinkPad X240 is a powerfull PC machine. I am using it as my main developper machine.

I bought the I7, 256GB SSD, 8GB RAM model. It has two batteries, one internal and one external which seems to be a good idea.

I have been comparing it to some fellow coworkers macbooks and all I can say is that it's as fast as the most powerfull macbook pro.


This tutorial is heavily inspired by the beginners guide but only contains the necessary steps to get archlinux working on a ThinkPad X240.

Create a bootable usb key

For this step only, you need an already booted linux of course, on another machine or use an ubuntu live cd.

  1. Download the archlinux iso image
  2. Given that your usb key is mounted on /dev/sdb, burn your ISO to the usb key like this: sudo dd bs=4M if=~/Downloads/archlinux-2014.06.01-dual.iso of=/dev/sdb && sudo sync

You can now plug your usb key to your new pc.

Bios setup

X240 comes with a secure boot which prevents systems like archlinux to be easily bootable.

So we disable it.

  1. Boot then hit Enter repeatedly
  2. Enter bios setup. Go in security tab, disable the secure boot

While you are here, you might also want to enable virtualization in the security tab. So that when you will want to start virtualbox, it will work.

Activate the two virtualization options from the security tab.

Boot on the usb key

  1. Plug usb key
  2. Reboot your system. Hit enter repeatedly
  3. Change boot device, select usb key

I had to retry this step 2 or 3 times because the usb key was not showing. So retry if needed.

Installation steps

Now to the core of the installation process.


Using wired network for simplicity.

ip link set enp0s25 up  

Interface name should be enp0s25, but ip a should show you all interfaces if necessary.

If you need to go the wifi way even for installation, see the wiki.

Filesystem setup

We create partitions. The important note is that we need a specific partition for the UEFI boot loader. Because the X240 has a UEFI bios.

# erase all partitions, byebye Windows
sgdisk --zap-all /dev/sda

# partition your disk
cgdisk /dev/sda  
# create 3 partitions:
# 1. EFI system 512.0 MB
# 2. Linux filesystem 230.0 GiB
# 3. Linux Swap 8.0 GiB

# create the filesystems
mkfs.fat -F32 /dev/sda1 # EFI system partition  
mkfs.ext4 /dev/sda2 # Linux filesystem partition  
mkswap /dev/sda3 && swapon /dev/sda3 # Linux Swap

# mount partitions
mount /dev/sda2 /mnt  
mkdir /mnt/boot  
mount /dev/sda1  /mnt/boot  

EFI partition needs to be at least 512.0 MB.

Pacman repository list update

We get a fresh list of European servers for pacman. So that downloads are fast.

# update pacman mirror list with fresh European servers, then uncomment every `#Server` line to activate the servers
curl -o /etc/pacman.d/mirrorlist "" && perl -pi -e 's/#Server/Server/g' /etc/pacman.d/mirrorlist  

If you are not into the "copy paste this line in your root system" way, you can decompose this command and do eveything by yourself.


System installation

Now our partition and filesystems are ready. Install!

# install base-devel group packages
pacstrap -i /mnt base base-devel  
genfstab -U -p /mnt >> /mnt/etc/fstab  
arch-chroot /mnt /bin/bash

# activate en_US.UTF-8 as a locale to generate
perl -pi -e 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen  
echo LANG=en_US.UTF-8 > /etc/locale.conf  
export LANG=en_US.UTF-8

ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime  
# Change Europe/Paris to something relevant to you

hwclock --systohc --utc

# choose a hostname and set it
echo superarch > /etc/hostname

# add your hostname at the end of /etc/hosts, right after first line `localhost`
nano /etc/hosts

systemctl enable dhcpcd@enp0s25.service

mkinitcpio -p linux

# change root password

# install UEFI boot loader
pacman -S dosfstools refind-efi  

# exit chroot

# unount and reboot
umount -r /mnt  

You should now have an empty but working archlinux installation.

Console login should work and you get to a shell.

comments powered by Disqus