About a week ago, I picked up a beaten up old Lenovo X230 machine with the goal of making this my schlepp-everywhere Linux development box.
Those little laptops are awesome! They support the Linux operating system extremely well, in fact most things work out of the box and reliably, such as sleep, hibernate, attaching external displays, Wifi, keyboard, touchpad, trackpoint, etc. The X230 has a full voltage CPU that’s actually quite beefy and makes the machine very pleasant to develop with.
First thing I did though was toss the built-in 4GB RAM stick and pop in a fresh set of Kingston HyperX SODIMMs. They can be had at Canada Computers for around 80$ and are totally worth the investment - especially when running tons of docker containers and VMs during development.
This git repo records my journey of installing Arch Linux, a running, binaries based Linux distribution that’s quite popular among developers.
Why Arch? Well I’m a big fan of continuous integration (CI) and continuous delivery (CD) at my workplace so I knew that I wouldn’t want a step-wise released system such as Ubuntu or Fedora.
Don’t get me wrong, they are by no means bad distributions of Linux, in fact they are well preferable for servers where it’s all about repeatability of the environment. In any case, that choice left me with Gentoo or an Arch-based Linux distribution.
I don’t like compiling everything and the kitchen sink from scratch - I’ve done that a decade ago during my undergrad days to learn about all things C++, make and optimization, but boy is it a time sucker! I need to be productive. Fast! That really only left me with Arch Linux. I dabbled with Manjaro, but in the end decided to go pure Arch for the power of choice. Here we go!
- Intel i5 3360M with vPro
- Upgraded to 16GB RAM SODIMM DDR3L PC12800 CL9 204 Pin Kingston HyperX (Model HX316LS9IBK2/16)
- 9 Cell Battery Genuine Lenovo 44++
- Intel SSD 530 Series SATA 120GB
- 00:00.0 Host bridge: Intel Corporation 3rd Gen Core processor DRAM Controller (rev 09)
- 00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
- 00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04)
- 00:16.0 Communication controller: Intel Corporation 7 Series/C210 Series Chipset Family MEI Controller #1 (rev 04)
- 00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)
- 00:1a.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
- 00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04)
- 00:1c.0 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 1 (rev c4)
- 00:1c.1 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 (rev c4)
- 00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)
- 00:1f.0 ISA bridge: Intel Corporation QM77 Express Chipset LPC Controller (rev 04)
- 00:1f.2 SATA controller: Intel Corporation 7 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04)
- 00:1f.3 SMBus: Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller (rev 04)
- 02:00.0 System peripheral: Ricoh Co Ltd PCIe SDXC/MMC Host Controller (rev 07)
- 03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 [Taylor Peak] (rev 34)
UEFI Bios Version | G2ET99WW (2.59) |
UEFI Bios Date | 2013-12-04 |
Embedded Controller Version | G2HT34WW (1.13) |
CPU Type | Intel Core i5 3360M |
CPU Speed | 2.80 GHz |
Installed Memory | 16,384MB |
UEFI Secure Boot | Off |
Wake on LAN | AC Only |
UEFI IPv4 Network Stack | Enabled |
UEFI IPv6 Network Stack | Enabled |
UEFI PXE Boot Priority | IPv4 First |
USB UEFI BIOS Support | Enabled |
Always on USB | Enabled |
Always on USB Charge in Off Mode | Disabled |
USB 3.0 Mode | Auto |
Trackpoint | Enabled |
Touch Pad | Enabled |
Fn and Ctrl Key Swap | Disabled |
Fn Key Lock | Disabled |
Boot Display Device | ThinkPad LCD |
Intel Speedstep Technology | Enabled |
Mode for AC | Maximum Performance |
Mode for Battery | Battery Optimized |
Adaptive Thermal Management | |
Scheme for AC | Maximize Performance |
Scheme for Battery | Balanced |
Optical Drive Speed | Normal |
CPU Power Management | Enabled |
PCI Express Power Management | Enabled |
Express Card Speed | Automatic |
Power On with AC Attach | Disabled |
Intel Rapid Start Technology | Enabled |
Entry After | 30 Minutes |
Password Beep | Disabled |
Keyboard Beep | Enabled |
SATA Controller Mode Option | AHCI |
Core Multi-Processing | Enabled |
Intel Hyper-Threading Technology | Enabled |
Intel AMT Control | Disabled |
Hardware Password Manager | Enabled |
Supervisor Password | Enabled |
Lock UEFI Bios Settings | Enabled |
Password at unattended Boot | Enabled |
Password at restart | Enabled |
Power-On Password | Enabled |
Hard-Disk Password | Enabled |
Predesktop Authentication | Enabled |
Reader Priority | External -> Internal |
Security Mode | Normal |
Security Chip | Active |
BIOS ROM Strings Reporting | Disabled |
CMOS Reporting | Disabled |
NVRAM Reporting | Disabled |
SMBIOS Reporting | Disabled |
Intel TXT Feature | Disabled |
Physical Presence for Provisioning | Disabled |
Physical Presence for Clear | Enabled |
Flash BIOS Updating by End-Users | Enabled |
Secure Rollback Prevention | Disabled |
Execution Prevention | Enabled |
Intel Virtualization Technology | Enabled |
Intel VT-d Feature | Enabled |
Ethernet LAN | Enabled |
Wireless LAN | Enabled |
WiMAX | Enabled |
Wireless WAN | Enabled |
Bluetooth | Enabled |
USB Port | Enabled |
ExpressCard Slot | Disabled |
Ultrabay | Enabled |
eSATA Port | Enabled |
Memory Card Slot | Enabled |
Integrated Camera | Enabled |
Microphone | Enabled |
Fingerprint Reader | Enabled |
Intel AT Module Activation | Disabled |
Intel AT Module State | Not Activated |
CompuTrace Module Activation | Disabled |
CompuTrace Module State | Not Activated |
Secure Boot | Disabled |
Platform Mode | User Mode |
Secure Boot Mode | Standard Mode |
Network Boot | PCI LAN |
UEFI/Legacy Boot | UEFI Only |
CSM Support | Yes |
Boot Mode | Quick |
Option Key Display | Enabled |
Boot Device List F12 Option | Enabled |
Boot Order Lock | Disabled |
Download the arch-XXX-dual.iso image from http://www.archlinux.org
- Open a terminal
- Find USB drive
diskutil list
- Write image
sudo dd if=archlinux.img of=/dev/rdiskX bs=1m
- Ensure
Secure Boot
is disabled in the BIOS. - Hit
ENTER
on BIOS prompt, hitF12
, select USB drive. - In the menu, select Arch Linux UEFI.
Either plug in the Ethernet cable, or to get access via WiFi, run wifi-menu
command and follow the prompts.
We will use the following partition layout using the parted
and gdisk
commands:
- 512MB partition for EFI, formatted
fat32
, mounted to/boot
- 40GB partition for OS, formatted
ext4
, mounted to/
- 60GB partition for User, formatted
ext4
, mounted to/home
- 16GB partition for Intel Rapid Start, labeled GUID=D3BFE2DE-3DAF-11DF-BA40-E3A556D89593
Note that we will not create a swap partition in this system, since 16GB of RAM are plenty and anything beyond that we can more easily handle with swap files anyway. Instead we will use the Intel Rapid Start firmware of our i5 vPro chip to implement a BIOS based suspend to hibernate. It is also entirely possible to implement a software based suspend to hibernate on this system via a swap partition.
- Check which block devices are available in the system using the
lsblk
command. Usually the SSD is/dev/sda
. - Start the partition editor with
parted /dev/sdX
, whereX
is the correct block device name. - In
parted
create a GPT partition table on the block device. THIS WILL DESTROY ALL DATA ON THE DEVICE!
mklabel gpt
- In
parted
run to create a UEFI partition of type EFI System Partition (ESP), formatted tofat32
filesystem with a size of 512 MB.
(parted) mkpart ESP fat32 1MiB 513MiB
- In
parted
set the boot flag on the ESP partition.
(parted) set 1 boot on
In parted
run to allocate 40GB space and formatted to an ext4 filesystem.
(parted) mkpart primary ext4 513MiB 40GiB
In parted
run to allocate 100GB space and formatted to an ext4 filesystem.
(parted) mkpart primary ext4 40GiB 100GiB
Run gdisk /dev/sdX
where X
is the correct block device name. Once in gdisk
we will run the following commands in order:
p
to print the partition table. The output of this command should say 16.5GiB of free space available on the 128GB SSD drive.n
to create a new partition. Since we only have 16.5GB free space at the very end of the disk, we can hitENTER
on all questions until we see info about HEX code or GUID.- Enter
D3BFE2DE-3DAF-11DF-BA40-E3A556D89593
as the GUID for this partition. - Finish with
w
andY
to write these changes to disk.
Next, we need to format the partitions created in the previous step. I assume
that you block device is /dev/sda
and that the partitions were created as
above.
mkfs.fat -F32 /dev/sda1
mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/sda3
Now it’s time to mount our OS, Home and Boot Partitions. First we mount root.
mount /dev/sda2 /mnt
Next, we create a directory boot
and mount our ESP partition to it.
mkdir -p /mnt/boot
mount /dev/sda1 /mnt/boot
Now, we create a directory home
and mount our Home partition to it.
mkdir -p /mnt/home
mount /dev/sda3 /mnt/home
We are all set to proceed the installation and install the base system files.
With all the partitions mounted in place, we will now continue to install Arch
Linux on the system. We install the base
and base-devel
collections:
pacstrap -i /mnt base base-devel
After all packages are installed, we generate an fstab
file. Here the -U
flag asks the generator to use partition UUIDs instead of kernel device names.
genfstab -U /mnt > /mnt/etc/fstab
Next, we switch into our new system and finish the installation there.
arch-chroot /mnt /bin/bash
First, we setup the system language:
nano /etc/locale.gen
In this file, find the line that corresponds to your language preference. Mine
is US English with UTF-8 character support, aka en_US.UTF-8
. After editing, we
let the system generate the locale files.
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8
Next, we configure the system time:
tzselect
We also create a symbolic link, for me the selected time zone was America/Toronto
ln -s /usr/share/zoneinfo/America/Toronto /etc/localtime
Finally, we will use the hardware clock for our system, which expects the clock to be set to UTC. This can often mix things up with other Operating Systems such as Windows or Mac OS X, so be careful when multi-booting. Our system is a Linux-exclusive, so no worries there.
hwclock --systohc --utc
In the next step, set the hostname for your machine.
echo "my-laptop" > /etc/hostname
We are using an UEFI setup, so let’s install grub
and the efibootmgr
. For
multiboot setups, make sure to also install the os-prober
package for
multiboot support. We don’t need this for our machine.
pacman -S grub efibootmgr
Now let’s setup grub
, our Boot partition was mounted earlier under /mnt/boot
which in the change root environment becomes /boot
:
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub
grub-mkconfig =o /boot/grub/grub.cfg
First things first! Let’s set a password for our root
user account before we
proceed!
passwd
Next, we will go ahead an add a regular user account that we will use in our
day-to-day activities. I picked nicbet
for my username, you can pick your own!
useradd -m -G wheel,users -s /bin/bash nicbet
passwd nicbet
We added the user to the wheel
group. This is a special group that will allow
our user to execute administrative commands using the sudo
tool. For this to
work we will have to allow the wheel
group to execute sudo
commands. The
safest way to do this is via the visudo
command.
pacman -S sudo
EDITOR=nano visudo
Find and uncomment the line
%wheel ALL=(ALL) ALL
Before we can exit out of our change root environment and start our fresh system
for the first time, we need to install some essentials while we are still booted
from the USB and have a working network connection. The wifi-menu
command we
ran earlier to get our Wifi connection working was installed as part of the
base
packages, however, for it to function, we need the dialog
and the
wpa_supplicant
dependencies.
pacman -S iw wpa_supplicant dialog
We are ready to boot our new system! First we exit out of the change root environment.
exit
Next, we unmount all partitions:
umount /mnt/home
umount /mnt/boot
umount /mnt
And finally shutdown the system:
shutdown -h now
Once the shutdown is completed, remove the USB Boot Media and power on the new system.
Add the following line to /etc/modprobe.d/audio_powersave.conf
:
options snd_hda_intel power_save=1
- Create file
/etc/modprobe.d/iwlwifi.conf
- Insert lines
options iwlwifi 11n_disable=1
options iwlwifi swcrypto=1