Skip to content

Instantly share code, notes, and snippets.

@mikilian
Last active July 23, 2020 13:01
Show Gist options
  • Save mikilian/57c1b13c0ff2ef9c177a47ed8037fac3 to your computer and use it in GitHub Desktop.
Save mikilian/57c1b13c0ff2ef9c177a47ed8037fac3 to your computer and use it in GitHub Desktop.
Arch Linux UEFI setup (64 Bit)

Arch Linus UEFI setup

Since I live in germany, I set my time zone and keyboard layout to it. This does not apply to the system language!

Preconfigure

I am writing this guide while installing Arch in a virtual machine. Therefore my hard disk is /dev/sda and the hostname arch-vm.

  1. Change the keyboard layout temporarily: loadkeys de-latin1
  2. Update the system clock: timedatectl set-ntp true
  3. Check where your disk lives: fdisk -l
    • For IDE controllers: /dev/hda, /dev/hdb, /dev/hdc
    • For SATA controllers: /dev/sda, /dev/sdb, /dev/sdc
    • For NVMe controllers: /dev/nvme0, /dev/nvme1
  4. Create new partitions on your target drive: fdisk /dev/sda
    1. enter g to create a new GPT partition table
    2. enter n for a new partition and set the last vector to: +512M -> efi
    3. enter n for a new partition and set the last vector to : +8192M -> swap
    4. enter n for a new partition and leave everything blank (default) -> root
  5. Change the partition types
    1. enter t followed by 1 to select the efi partition and enter 1 to set the EFI System type
    2. enter t followed by 2 to select the swap partition and enter 19 to set the Linux swap type
    3. enter t followed by 3 to select the root partition and enter 24 to set the Linux root (x86-64) type
  6. Enter w to write the partitions and exit fdisk
  7. Format the EFI partition as fat32: mkfs.vfat -n EFIBOOT /dev/sda1
  8. Format the Linux swap: mkswap -L swap /dev/sda2
  9. Format the root filesystem as ext4: mkfs.ext4 -L arch /dev/sda3
  10. Enable the Linux swap: spwaon /dev/sda2
  11. Mount the root partition on /mnt: mount /dev/sda3 /mnt
  12. Create the boot mount point: mkdir -p /mnt/boot
  13. Mount the boot partition: mount /dev/sda1 /mnt/boot
  14. Install base packages: pacstrap /mnt base-devel linux linux-firmware nano vim intel-ucode
  15. Generate a new fstab file: genfstab -U /mnt >>/mnt/etc/fstab
    • Optional verify the generated fstab: cat /mnt/etc/fstab
  16. Enter chroot environment: arch-chroot /mnt
  17. Update the timezone: ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
  18. Generate the /etc/adjtime file: hwclock --systohc
  19. Uncomment needed locales in /etc/locale.gen and generate locales: locale-gen && echo 'LANG=en_US.UTF-8' > /etc/locale.conf
  20. Change the default keyboard layout: echo 'KEYMAP=de-latin1' > /etc/vconsole.conf
  21. Set the hostname (required for the next step): echo 'arch-vm' > /etc/hostname
  22. Add the following code into /etc/hosts and change arch-vm into your hostname
127.0.0.1	localhost
::1		localhost
127.0.1.1	arch-vm.localdomain	arch-vm
  1. Install necessary packages: pacman -S grub efibootmgr linux-headers linux-lts linux-lts-headers networkmanager
  2. Enable the network manager, otherwise your internet connection won't work: systemctl enable NetworkManager
  3. Update the root password: passwd
  4. Create the directory efi directory for the bootloader: mkdir -p /boot/efi
  5. Mount the efi partition: mount /dev/sda1 /boot/efi
  6. Install grub: grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi --recheck
  7. Generate the configuration for grub: grub-mkconfig -o /boot/grub/grub.cfg
  8. Exit chroot environment: exit
  9. Unmount everything and reboot: unmount -a && reboot

Configure

tba

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment