Gorgeous Combo: Arch Linux on Thinkpad T450s (with a Arch Linux How-to)

23 August 2015

Until now, I was using an Asus laptop that I had to buy quickly because I needed a new one for my work. However, the laptop wasn't very Linux-friendly and as I had enough with the problems I was encountering, I decided to change for a Lenovo Thinkpad T450s. First time of my life I can say I'm satisfied with a computer! I will give you also the installation guide I used for ArchLinux.

On the Asus laptop, I had installed Ubuntu Gnome that I liked, but after two months, it began to show errors and failures before getting to the login screen. It obliged me to do hard reboots several times until I could finally log in normally. Sometimes it took me literally more than 10 minutes! Besides of that, I have had since the beginning issues with the touchpad because it was recognized only as a mouse and I couldn't use the multi-touch feature, and concerning the keyboard, the screen brightness function keys wasn't working either. All these little issues made me enough of this computer.

Thinkpad T450s picture from a nice Ars Technica review (Photographer: Peter Bright, Source: Ars Technica)

As I saw that quite a lot of people using Linux on their laptop were having a Lenovo Thinkpad, I chose to try the Thinkpad T450s. Switching to this hardware was awesome: I bought the extended battery for some bucks more and now its battery life can go until 18 hours with browsing the web and other light tasks! The case is lightweight, the screen is not too big (good for moving around), the keyboard is precise and has a nice touch feeling, the touchpad is working nicely (even though the best touchpads are on Macbooks), and almost everything worked from scratch. Only the touchpad needed the Thinkpad drivers, which was very easy to install. I repeat: awesome.

_Arch Linux logo is so great! (Source: Wikipedia)
_

When I began my internship at Gandi, my tutor was using Arch Linux on its laptop so I went for a try. I was always attracted by its KISS philosophy, having only the things you want and by the same time having a lightweight operating system. So he helped me to install it on the company's laptop and later on I did it myself on my own laptop. It wasn't as hard as it felt last time when I tried in VirtualBox.

As Arch Linux is easy to install only if you know what you are doing, even though they are quite a lot of installation guides, I will write here the one my tutor gave me:

Caution: this tutorial will teach you how to encrypt your hard disk. It means that all data will be encrypted when using the computer and so protected in case of theft, but also that forgetting the password may make impossible for you to retrieve your data.

Once you have created the Arch Linux Live USB and booted on it, you first have to load keys for your keyboard if you don't have a qwerty

loadkeys fr # For a french keyboard

Then, you have to format your hard disk and partition it:

cgdisk /dev/sda

Partition it the following way:

Create the filesystems:

mkfs.ext2 /dev/sda1  
mkfs.ext4 /dev/sda2

Create the encrypted device (if you changed your keyboard layout at start, switch to 'us' for entering the password as your keyboard will be in qwerty at each boot):

cryptsetup -c aes-xts-plain -s 512 luksFormat /dev/sda2  
cryptsetup luksOpen /dev/sda2 lvm

Create new partitions on the encrypted LVM (swap's size should be the same as the amount of RAM you have):

pvcreate /dev/mapper/lvm  
vgcreate lvm_storage /dev/mapper/lvm  
lvcreate -L 8G lvm_storage -n swapvol  
lvcreate -L 80G lvm_storage -n rootvol  
lvcreate -l 100%FREE lvm_storage -n homevol

Create the filesystems on the encrypted LVM:

mkfs.ext4 /dev/mapper/lvm_storage-rootvol  
mkfs.ext4 /dev/mapper/lvm_storage-homevol  
mkswap /dev/mapper/lvm_storage-swapvol

Mount the directories:

mount /dev/lvm_storage/rootvol /mnt  
mkdir /mnt/home  
mkdir /mnt/boot  
mount /dev/lvm_storage/homevol /mnt/home  
mount /dev/sda1 /mnt/boot  
swapon /dev/lvm_storage/swapvol

Install the base system (we use Syslinux instead of GRUB which is more lightweight):

pacstrap /mnt base base-devel gptfdisk syslinux wpa_supplicant dialog vim

Save your filesystems:

genfstab -p /mnt >> /mnt/etc/fstab

Edit mkinitcpio.conf to enable the encryption:

vim /mnt/etc/mkinitcpio.conf  

```  
    HOOKS="... encrypt lvm2 filesystems ..."  
```

Chroot to the system:

arch-chroot /mnt

Update timezone (replace Europe/Paris by your continent and your city):

ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime

Set a password:

passwd

Install kernel/boot:

mkinitcpio -p linux  
syslinux-install_update -iam

Uncomment your language in locale.gen:

vim /etc/locale.gen

Then generate it:

locale-gen  
echo LANG=en_US.UTF-8 > /etc/locale.conf  
export LANG=en_US.UTF-8

Set your keyboard layout:

vim /etc/vconsole.conf  

    KEYMAP=fr # Or your keyboard layout

Set your machine's hostname:

echo 'myhostname' > /etc/hostname

Finally set the encryption at boot:

vim /boot/syslinux/syslinux.cfg  
```  
    APPEND root=/dev/mapper/lvm_storage-rootvol cryptdevice=/dev/sda2:lvm_storage rw  
```

Reboot and remove your Live USB:

exit  

umount /mnt/boot  
umount /mnt/home  
umount /mnt  
reboot

Congratulations! You have now installed Arch Linux !

You still have to install a desktop environnement like GNOME, KDE or XFCE and your differents apps. I will write about it in a next article.

And you, what is your laptop for GNU/Linux?

Edit: To continue your Arch installation with GNOME you can follow this next article: "Thinkpad T450s: what to do after a raw Arch Linux installation"