Installation of ArchLinux

This post aims to record the installation procedure of ArchLinux on my notebook, Thinkpad X1 Carbon (x1c) 2018, i.e., 6th generation.

Preparition

  • Download the installation image from the nearest mirror.
  • Burn the image into a USB stick.

      dd if=/path/to/image/ of=/dev/sdb status=progress bs=10M
  • The notebook has Windows 10 installed with 快速启动 enabled. Therefore, it needs to be disabled before the installation. Uncheck the option of 控制面板 -> 硬件和声音 -> 电源选项 -> 选择电源按钮的功能 -> 更改当前不可用的设置 -> 启用快速启动(推荐).

Installation

Boot

  • Power on the notebook.
  • Press Enter and F1 to enter the BIOS configuration.
  • Disable the Security -> Secure Boot.
  • Enable Config -> Thunderbolt BIOS Assist Mode. This will significantly reduce the power consumption of CPU wakeups1.
  • Insert the prepared USB and press F10 to save the change and reboot the notebook.
  • Press Enter and F12 to temporarily boot from the prepared USB stick.

Partition

For UEFI booting, a dedicated EFI system partition (ESP) is mandatory. EFI bootloaders, applications and drivers can be stored in an ESP and lauched by the UEFI firmware at the boot stage. In other words, it is completely independent of OS. Considering the potential support of dual-boot in the futher, I prepare a 1 GB partition for ESP. Accordingly, I created a primary partition (/dev/nvme0n1p1) of partion type EFI System. Taking fdisk for instance, the type can be selected by alias uefi.

In addition, I created two ext4 partitions for / and /home respectively.

Format the partitions

  mkfs.fat -F 32 /dev/nvme0n1p1
  mkfs.ext4 /dev/nvme0n1p2
  mkfs.ext4 /dev/nvme0n1p3

Mount the partitions

  mount /dev/nvme0n1p2 /mnt
  mount --mkdir /dev/nvme0n1p1 /mnt/boot
  mount --mkdir /dev/nvme0n1p3 /mnt/home

Connect to the Internet

  iwctl --passphrase PASSWORD station wlan0 connect-hidden SSID

Select the nearest mirror

Edit /etc/pacman.d/mirrorlist as below.

  Server = http://mirrors.aliyun.com/archlinux/$repo/os/$arch

Install the base system

  pacstrap /mnt base

Generate file system table

  genfstab -U /mnt >> /mnt/etc/fstab

The /etc/fstab looks

  # Static information about the filesystems.
  # See fstab(5) for details.

  # <file system> <dir> <type> <options> <dump> <pass>
  # /dev/nvme0n1p2 LABEL=OS
  UUID=a2d1afa4-4a38-4849-a4e7-ab5a5c4dba8d	/         	ext4      	rw,relatime	0 1

  # /dev/nvme0n1p1 LABEL=ESP
  UUID=019D-1686      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2

  # /dev/nvme0n1p3 LABEL=DATA
  UUID=386c4fbc-f1fd-4147-98bb-547867e762f5	/home     	ext4      	rw,relatime	0 2

Chroot into the newly installed system

  arch-chroot -S /mnt

Host name

Create file /etc/hostname.

  notebook

Time zone

  ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
  hwclock --systohc

Locale

Edit /etc/locale.gen and uncomment the following lines.

...
en_US.UTF-8 UTF-8
...
zh_CN.UTF-8 UTF-8
...

Generate and set locales.

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

Kernel and microcode

  pacman -S linux linux-firmware intel-ucode

Initramfs

  mkinitcpio -P

CPU frequency scaling

  pacman -S cpupower
  systemctl enable cpupower

Network

  pacman -S networkmanager
  systemctl enable NetworkManager

Bootloader

I adopt systemd-boot as the UEFI boot manager, shipped with systemd.

Installation

  bootctl install

Configuration

  • /boot/loader/loader.conf

      default arch.conf
      timeout 3
  • /boot/loader/entries/arch.conf

      title	Arch Linux
      linux	/vmlinuz-linux
      initrd	/intel-ucode.img
      initrd	/initramfs-linux.img
      options	root=UUID=a2d1afa4-4a38-4849-a4e7-ab5a5c4dba8d rw
  • /boot/loader/entries/arch-fallback.conf

      title	Arch Linux (fallback)
      linux	/vmlinuz-linux
      initrd	/intel-ucode.img
      initrd	/initramfs-linux-fallback.img
      options	root=UUID=a2d1afa4-4a38-4849-a4e7-ab5a5c4dba8d rw

Password for root

  passwd

Unmount and reboot

  exit
  umount -R /mnt
  reboot

Footnotes

Tags: linux 
Table of Contents