Installing Arch Linux
I have tried to install Arch before but it failed. Will it work this time?
I really can’t wait to install Arch Linux! Now it’s the perfect time because I’m in a holiday. Currently I use Lubuntu as my main OS to do college work. But I want to try Arch Linux So I followed the official installation guide for Arch Linux at https://wiki.archlinux.org/index.php/Installation_guide to install a very basic Arch Linux Installation. I want to install Arch Linux on Acer Swift 3 laptop, with Intel i7–8550U.
Pre-Installation
After downloading the ISO with torrent, I check both md5 and sha1 hash to verify the download.
$ md5sum archlinux-2019.12.01-x86_64.iso
$ sha1sum archlinux-2019.12.01-x86_64.iso
And then I burn the ISO with dd
to my 4GB flash drive. (my flash drive location is on /dev/sdb
).
$ dd bs=4M if=archlinux-2019.12.01-x86_64.iso of=/dev/sdb status=progress oflag=sync
After it was finished. I managed my partition on Lubuntu because it is easier. I’d have to use the terminal if I create partition in Arch Live Environment rather than GUI in Lubuntu. My partition setup would be:
- 100MB
/dev/sda1
for EFI System Partition (later will be/efi
). I don’t format this partition because it already exist. - 2GB
/dev/sda5
for Swap - 32GB
/dev/sda6
for Root (later will be/
) - 33GB
/dev/sda7
for Home (later will be/home
)
Then I restart my computer and go to the Firmware then booting by pressing F2 to change the boot order. I put my flash drive on top and save the changes. After that, Arch Linux booted as expected and I got to the Zsh shell prompt. So far so good. I skipped setting the keyboard layout because my keyboard mapping is already US. To verify that I’m on UEFI mode:
$ ls /sys/firmware/efi/efivars
When I had to connect to the Internet, I got stuck for a while. I tried to install Arch Linux on my college, because the WiFi is faster than at home. But I need to login with my username and password to be able to access the internet. But I cannot do that when installing Arch Linux because I don’t have a browser to access the login page. So I tried to get USB Tethering working to connect my laptop with internet through my phone. My laptop detects my phone, but if I tried to ping a server for example ping archlinux.org
I got nothing. This got me searching on forums for a long time. I asked my friend (I called him kak gio) if he knows what I should do. It turns out my laptop is already connected to the internet XD. I cannot ping any server because my college WiFi block ping and ssh connections. To check my internet, he used:
$ curl -v google.com
It works because it is a http request and my college WiFi network would never block it. After that, I update my system clock with:
$ timedatectl set-ntp true
Because I had already partitioned my disk, I went straight to mounting my partitions and turning on my swap partition.
$ mount /dev/sda6 /mnt
$ mkdir /mnt/efi
$ mount /dev/sda1 /mnt/efi
$ mkdir /mnt/home
$ mount /dev/sda7 /mnt/home
$ swapon /dev/sda5
Installation
When installing required packages, Arch uses the first matching mirror in /etc/pacman.d/mirrorlist
. I put Indonesia and Singapore servers on top because I live in Indonesia, and Singapore very close to Indonesia. Then I ran:
$ pacstrap /mnt base linux linux-firmware vim
I added vim in the end because vim is my favorite text editor ❤. Later I realized that I forgot to install a few more packages, but it is okay because we can do it after we chroot-ed into the new system. Then I generate fstab file with:
$ genfstab -U /mnt >> /mnt/etc/fstab
fstab file is used by Arch to mount partitions on corresponding directory when we booted the new system. After that I change root into the new system:
$ arch-chroot /mnt
When writing this article, I can’t remember if I use arch-chroot
or just chroot
. After I used arch-chroot
, I was in my new system as a root user. To set time zone:
$ ln -sf /usr/share/zoneinfo/Asia/Jakarta /etc/localtime
$ hwclock --systohc
Edit /etc/locale.gen
to uncomment en_US.UTF-8 UTF-8
then generate locales with:
$ locale-gen
Create a new file in /etc/locale.conf
and write LANG=en_US.UTF-8
in it. After that I need to configure hostname. I want my computer name okto-swift
, so I create new file /etc/hostname
and write okto-swift
in it. And also write inside /etc/hosts
:
127.0.0.1 localhost
::1 localhost
127.0.1.1 okto-swift.localdomain okto-swift
To set up root password, I ran:
$ passwd
And finally I need to install a booloader. I prefer to use GRUB because I’m already familiar with configuring GRUB. The difference between install a package on Arch compared to Ubuntu is in arch, they use pacman
as the package manager. But in Ubuntu, they use apt
as the package manager. To install GRUB in Arch Linux, I ran:
$ pacman -S grub intel-ucode os-prober efibootmgr
intel-ucode
is a microcode update for intel CPU. If you use AMD, use amd-microcode
instead. Meanwhile os-prober
is for GRUB to detect other OS (Windows or other linux distribution installed on your drive) so after I reboot my computer, I can switch between other OS easily. This only install the program, but not install the bootloader to my computer yet. To install the bootloader, I ran:
$ grub-install /dev/sda --efi-directory=/efi
Don’t forget to put the correct EFI partition in the options. After that, I should run:
$ grub-mkconfig -o /boot/grub/grub.cfg
Because I forgot, when I rebooted my system, the GRUB menu will open, but to load Arch Linux, I have to type commands in GRUB command line manually. If you tried to install linux, don’t forget to run grub-mkconfig
. After Installing the bootloader, I install a few more things:
$ pacman -S network-manager base-devel dialog dhcpcd
network-manager
is for manage connections (I think). I installed it because it was used in my Ubuntu system.base-devel
because I was missing thesudo
command if I didn’t instalbase-devel
package.dialog
for connecting to WiFi network withwifi-menu
. I don’t want to not be able to connect to the WiFi (flashback to the first time I tried to install Arch).- I install
dhcpcd
just in case I cannot connect to a network without it.
I enable network-manager service with:
$ systemctl enable NetworkManager
All that is left is for me to reboot my system. But first, I need to unmount my partition before rebooting:
$ exit # to leave chroot
$ umount -R /mnt # unmount my system recursively
$ reboot
Post-Installation
To ran my new system. I need to change boot order in the firmware. so I hold F2 and put arch linux on the top. After it booted, I can only login as root because I hadn’t create any other user. To create a new user:
$ useradd -m -G wheel -s /bin/bash dimas # create user
$ passwd dimas # set password to the user
user dimas
is the username i want to create. You can change dimas to any username you want. I also need to configure sudo permission for the wheel
group. To do that, I ran:
$ EDITOR=vim visudo
If you don’t understand to use vim, use type :q!
and press Enter to leave vim editor and replace vim
to nano
instead. In that file, uncomment the line that contains %wheel ALL=(ALL) ALL
by removing the hashtag ( #
).
After all these hours, I finally have a VERY BASIC installation of Arch Linux. I planned to install X environment ( xorg
and xorg-server
) so I can use my mouse instead of only the keyboard. And I also want to install i3
as my Window Manager after I fixed the problems with my installation.
Problems
I met a couple of problems after I installed Arch Linux. Here are some of them:
Could not login with user other than root
After reboot my laptop and change boot order, I cannot login with my new user ( dimas
).
After a bit of digging, it turns out only root can access the root folder (/
), which can be shown with ls. The solution is to use chmod
to change folder permission.
$ ls -ld /
drwx------ 23 root root 4096 Dec 23 20:18 /$ chmod 755 /$ ls -ld /
drwxr-xr-x 23 root root 4096 Dec 23 20:18 /
After that, I can finally login with my new user.
Could not open Firmware when arch bootloader in EFI Partition
I noticed the first time I open Firmware Settings (by holding down F2 when Acer logo shows up) Arch boot option doesn’t have a name in the options (I knew it because other options are Windows, Ubuntu, and my flash drive). After changing it, Arch booted successfully and into the shell. But when I tried to change boot option to Ubuntu again, It shows only black screen after I hold down F2 to get to the Firmware Settings. Sh*t, that makes me very panic. What if I can’t get There’s nothing I could do other than forcing to shut down by holding the power button. After searching on the browser (from my phone of course), I could not find anything similar to my case.
I found a temporary workaround to my problem. I had to remove all Arch Linux bootloader inside my EFI partition. In my case, I removed 2 folder:
$ rm -r /efi/EFI/arch
$ rm -r /efi/EFI/GRUB
BE CAREFUL when editing the EFI partition manually. I noticed that after I ran grub-install
and grub-mkconfig
that those folders are added to the partition. So I removed both of them. After I reboot the system, the firmware automatically goes to the second bootloader, which is my Lubuntu bootloader. I’m no longer in a panic after that.
My general tip is: Don’t mess around your EFI partition (like I did) if you don’t know what you’re doing.
Conclusion
Some things aren’t working as I expected. I still cannot access the Firmware if Arch bootloader is in my EFI Partition. In the end, I rate my experience 9/10, would risk bricking my laptop again :)