arrow-left arrow-right brightness-2 chevron-left chevron-right circle-half-full dots-horizontal facebook-box facebook loader magnify menu-down rss-box star twitter-box twitter white-balance-sunny window-close
Linux on a laptop, 2020 edition - Arch on Clevo N141CU
2 min read

Linux on a laptop, 2020 edition - Arch on Clevo N141CU

Introduction

If you're new into the Linux ecosystem, consider using Ubuntu or elementary instead of Arch unless you're willing to spend a significant amount of time learning about Linux internals.
Furthermore, what I will cover here is well described in the official Arch Linux installation guide

Preparation

As Clevo N141CU (or Galago Pro, if you bought it from System76) doesn't have an optical drive, we're going to use a USB stick.
Download the latest archlinux ISO from the official release site and write it onto your USB stick using dd or Balena Etcher

dd if=archlinux-2020.06.01-x86_64.iso of=/dev/sdc

Replace /dev/sdc with the path of your disk (check it with fdisk -l if you're on a Linux already)

Use a wired connection if you can, but if you cannot, NetworkManager is your ally:

systemctl start NetworkManager.service
nmcli device wifi list
nmcli device wifi connect SSID password password

And that's it; you should have your wireless connection working

Next step is to update the system clock:

timedatectl set-ntp true

Then you should partition the disk. Remember that you need to format EFI partition as FAT32.
When you're done with that, mount proper partitions (I assume you set EFI partition as the first one, swap partition as second, / partition as third, and /home partition as the fourth):

mount /dev/nvme0n0p2 /mnt
mkdir /mnt/boot
mount /dev/nvme0n0p1 /mnt/boot
mkdir /mnt/home
mount /dev/nvme0n0p4 /mnt/home

Arch installation

To install Arch Linux on the system, you have just prepared simply run:

pacstrap /mnt base base-devel vim linux linux-firmware

Generate /etc/fstab file based on current mounts:

genstab -U /mnt >> /mnt/etc/fstab

Chroot into the bootstrapped system:

arch-chroot /mnt

Set your local time zone:

ln -sf /usr/share/zoneinfo/Europe/Warsaw /etc/localtime

And synchronize system clock with the hardware clock

hwclock --systohc

Configure and generate locales:

vim /etc/locale.gen

Uncomment the lines according to what you need. In my case it's

  • en_US.ISO-8859-1
  • en_US.UTF-8
  • pl_PL.UTF-8
  • pl_PL.ISO-8859-2

And run locale-gen so the system may generate proper files.

After we have our locale generated, we need to set them for our system. To do this, edit file /etc/locale.conf and set the LOCALE variable to your needs. In my case there's a line LOCALE=en_US.UTF-8

We also need to "name" our machine somehow, edit /etc/hosts and add corresponding lines to /etc/hosts. I've named my machine thor and my /etc/hosts look like this:

# See hosts(5) for details.
127.0.0.1 localhost
::1	  localhost
127.0.1.1 thor.local thor

We need to create initial ramdisk, in Arch we have mkinitcpio bash script for that:

mkinitcpio -p linux

We also need to install a bootloader, and as we're using EFI and have Intel CPU, we should keep this in mind.

pacman -S grub efibootmgr intel-ucode
efibootmgr
grub-install --target=x86_64-efi --efi-directory=/efi/ --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

That's everything you need to do to have a running system. As the last few steps, I'd set the root password, using passwd and add a new user with the ability to sudo

useradd -m -s /bin/bash mkozak
passwd mkozak
pacman -S sudo
gpasswd -a mkozak sudo

And as the last steps:

pacman -S networkamanager

To not end without networking after reboot, then Ctrl+D to exit chroot, umount disks, and reboot

umount -R /mnt
reboot

And voila, after removing your USB stick, you should boot into freshly installed Arch.