Arch Linux Setup: Installation - dmitana/dotfiles GitHub Wiki
Installation
Install essential packages
$ pacstrap /mnt base linux linux-firmware base-devel less which vim tmux python3 htop ntfs-3g openssh lvm2 xclip git wget curl dhcpcd netctl iputils iwd iw wpa_supplicant wireless_tools dialog networkmanager man-db man-pages texinfo
Configure the system
Fstab
Generate an fstab file (use -U
or -L
to define by UUID or labels, respectively):
$ genfstab -U /mnt >> /mnt/etc/fstab
Chroot
Change root into the new system:
$ arch-chroot /mnt
Time zone
Set the appropriate time zone:
$ ln -sf /usr/share/zoneinfo/Europe/Bratislava /etc/localtime
Run hwclock to generate /etc/adjtime
:
$ hwclock --systohc
Localization
Edit /etc/locale.gen
and uncomment en_US.UTF-8 UTF-8and
sk_SK.UTF-8 UTF-8` (and other needed) locales. Generate the locales by running:
$ locale-gen
Create the locale.conf
file, and set the LANG variable accordingly:
$ echo 'LANG=en_US.UTF-8' > /etc/locale.conf
Create the vconsole.conf
file, and set the KEYMAP variable accordingly:
$ echo 'KEYMAP=us' > /etc/vconsole.conf
Network configuration
Create the hostname file:
$ echo 'MYHOSTNAME' > /etc/hostname
Add matching entries to hosts:
vim /etc/hosts
127.0.0.1 localhost
::1 localhost
127.0.1.1 myhostname.localdomain myhostname
If the system has a permanent IP address, it should be used instead of 127.0.1.1.
Initrams
Due to LVM modify mkinitcpio.conf and recreate the initramfs image.
In case your root filesystem is on LVM and encrypted by LUKS, you will need to enable the appropriate mkinitcpio hooks, otherwise your system might not boot. Add systemd
, keyboard
, sd-vconsole
, block
, sd-encrypt
, and lvm2
hooks for the systemd-based initramfs:
/etc/mkinitcpio.conf
HOOKS=(base systemd autodetect microcode modconf kms keyboard sd-vconsole block sd-encrypt lvm2 filesystems fsck)
Recreate the initramfs image:
$ mkinitcpio -P
Root password
Set the root password:
$ passwd
Boot loader
First, install the packages grub
, efibootmgr
and os-prober
: GRUB is the bootloader while efibootmgr is used by the GRUB installation script to write boot entries to NVRAM. os-prober
allows grub-mkconig
to search for other installed systems and automatically add them to the menu.
$ pacman -S grub efibootmgr os-prober
If you use LVM for your /boot
or /
root partition, make sure that the lvm
module is preloaded and root
kernel parameter points to the mapped device.
If you use LUKS encryption set rd.*
and rootflags=*
kernel parameters. The LUKS-DEVICE-UUID
refers to the UUID of the LUKS superblock, in this example it is the UUID of /dev/nvme0n1p6
, use lsblk -f
to get the UUID.
/etc/default/grub
GRUB_PRELOAD_MODULES="... lvm"
GRUB_CMDLINE_LINUX_DEFAULT="... rd.udev.log_priority=3 vt.global_cursor_default=0 rd.luks.name=<LUKS-DEVICE-UUID>=cryptlvm rd.luks.options=<LUKS-DEVICE-UUID>=timeout=0 rootflags=x-systemd.device-timeout=0 root=/dev/vg0/root"
GRUB_DISABLE_OS_PROBER=false (uncomment)
Execute the following command to install the GRUB EFI application grubx64.efi
to esp/EFI/GRUB/
and install its modules to /boot/grub/x86_64-efi/
. Make sure to install grub after modifying /etc/default/grub
.
$ grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB
Use the grub-mkconfig tool to generate /boot/grub/grub.cfg
.
$ grub-mkconfig -o /boot/grub/grub.cfg
Note: See more about GRUB and LUKS encryption.
Note: To remove the grub delete GRUB
from /efi/EFI/
and delete a boot entry from NVRAM using efibootmgr
.
$ rm -rf /efi/EFI/GRUB/
# List boot entries to find out Boot000N boot number
$ efibootmgr -v
# Delete a boot entry
$ efibootmgr -b <N> -B
microcode updates.
EnableFor AMD processors, install the amd-ucode
package.
For Intel processors, install the intel-ucode
package.
$ pacman -S intel-ucode
grub-mkconfig
will automatically detect the microcode update and configure GRUB appropriately. After installing the microcode package, regenerate the GRUB config to activate loading the microcode update by running:
$ grub-mkconfig -o /boot/grub/grub.cfg
Reboot
Exit the chroot environment by typing exit
or pressing Ctrl+d
.
Optionally manually unmount all the partitions with umount -R /mnt
: this allows noticing any "busy" partitions, and finding the cause with fuser
.
Finally, restart the machine by typing reboot
: any partitions still mounted will be automatically unmounted by systemd. Remember to remove the installation medium and then login into the new system with the root account.
Continue to Post-Installation