Arch Linux Install - VirtualBox/EFI/i3

This is a simplified guide to installing a minimal version of Arch on VirtualBox with i3 using an EFI bootloader.

Do your best to simply follow the installation guide on the Arch Wiki (and other Arch Wiki pages). Everyone in the community is just going to point you back there anyways - a splendid group I tell ya. Learn, embrace, and submit to the Arch install.

  1. Download latest Arch ISO from one of the mirrors here.

    • If you are on Windows, then you can verify the signature using Gpg4win.
  2. Setup your virtual machine.

    • Make sure you have the latest version of VirtualBox on your host. Arch will have the latest and if there is a version mismatch, then it can cause issues. Also, download the extension pack if you want USB 2.0 support.

    • Set name, memory, storage, and other settings as you see fit. I typically dedicate half of my system memory and processors, use a dynamically allocated drive with a generous amount of space (~50 GB), max out the video memory, enable 3D acceleration, set the Shared Clipboard and Drag'n'Drop to Bidirectional, and enable USB 2.0 (again, this requires the extension pack).

    • Check the Enable EFI (special OSes only) box in the System tab.

    • Run machine and select downloaded ISO when prompted. SHA256 validated screen sticks for a bit.
  3. For non-US users, set the keyboard layout.

    • List available layouts:

    # ls /usr/share/kbd/keymaps/**/*.map.gz

    • Example of setting layout for Germany:

    # loadkeys de-latin1

  4. Verify the boot mode (this should spit out a list).

    # ls /sys/firmware/efi/efivars

  5. Verify internet connection.

    • List network interfaces - make note of the interface name (e.g., enp0s3):

    # ip link

    • Ping a website to test connection:

    # ping -c1 archlinux.org

  6. Update the system clock.

    # timedatectl set-ntp true

  7. Partition Drive

    • List drives (generally looking for sd#, where '#' is a given letter, replace '#' in the commands below as required):

    # ls /dev

    • Use gdisk to partition drive:

    # gdisk /dev/sda

    • Table of common settings I use for partition drives:
    Partition Drive Description
    BIOS Bootloader, +10MB, EF02
    EFI Bootloader, +500MB, EF00
    swap +2GB, 8200
    root System Files, +15GB (Minimum), 8300
    home Personal Files, Remaining Space, 8300
    • Setup your partitions:
      // EFI BOOT PARTITION
      # p
      ::RETURN::
      # n
      ::RETURN::
      ::RETURN::
      ::RETURN::
      # +500M
      ::RETURN::
      # EF00
      ::RETURN::
      
      // SWAP PARTITION
      # n
      ::RETURN::
      ::RETURN::
      ::RETURN::
      # +2G
      ::RETURN::
      # 8200
      ::RETURN::
      
      // ROOT PARTITION
      # n
      ::RETURN::
      ::RETURN::
      ::RETURN::
      # +15G
      ::RETURN::
      ::RETURN::
      
      // HOME PARTITION
      # n
      ::RETURN::
      ::RETURN::
      ::RETURN::
      ::RETURN::
      ::RETURN::
      
      // CREATE PARTITIONS
      # p
      ::RETURN::
      // NOTE WHAT PARTITION NUMBERS CORRESPOND TO WHAT PARTITIONS FOR FORMATTING
      w
      ::RETURN::
      y
      ::RETURN::
      
  8. Format Partitions (remember to update drive letter and partition number as necessary).

    // EFI BOOTLOADER PARTITION
    # mkfs.fat -F32 /dev/sda1
    
    // SWAP PARTITION
    # mkswap /dev/sda2
    
    // ROOT PARTITION
    # mkfs.ext4 /dev/sda3
    
    // HOME PARTITION
    # mkfs.ext4 /dev/sda4
    
  9. Mount Partitions (remember to update drive letter and partition number as necessary).

    // TURN SWAP ON
    # swapon /dev/sda2
    
    // MOUNT ROOT
    # mount /dev/sda3 /mnt
    
    // CD INTO /MNT
    # cd /mnt
    
    // CREATE BOOT AND HOME DIRECTORIES
    # mkdir boot home
    
    // MOUNT BOOT
    # mount /dev/sda1 boot
    
    // MOUNT HOME
    # mount /dev/sda4 home
    
  10. Install Arch (If you forget something, then you can chroot back in)

    # pacstrap /mnt base base-devel linux linux-firmware vim rxvt-unicode firefox thunar xorg-server xorg-xinit i3 dmenu grub efibootmgr netctl wpa_supplicant dhcpcd dialog ttf-dejavu virtualbox-guest-modules-arch virtualbox-guest-utils xf86-video-vmware mousepad

  11. Generate fstab file

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

  12. chroot into system

    # arch-chroot /mnt

  13. Set Timezone

    # ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
    # hwclock --systohc
    
  14. Localization

    • Uncomment "en_US" locales in /etc/locale.gen

    # vim /etc/locale.gen

    • Generate locales

    # locale-gen

    • Set locale language (add LANG=en_US.UTF-8 to file below)

    # vim /etc/locale.conf

  15. Set root password

    # passwd

  16. Add another user and adjust privileges

    # useradd --home-dir /home/benny --create-home benny
    # passwd benny
    // ADD "benny ALL=(ALL) ALL" UNDER "root ALL=(ALL) ALL"
    # vim /etc/sudoers
    
  17. Setup internet and virtual box services

    • Internet (replace enp0s3 as necessary - see Step 5).

    # systemctl enable dhcpcd@enp0s3.service

    • Virtual box (auto-load vbox modules)
      # vim /etc/modules-load.d/virtualbox.conf
      // ADD LINES
      vboxguest
      vboxsf
      vboxvideo
      # systemctl enable vboxservice.service
      
  18. Install & Configure GRUB

    # grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --removable
    # grub-mkconfig -o /boot/grub/grub.cfg
    
  19. Shutdown virtual machine, remove ISO file from the Storage tab in Settings, and restart.

  20. Login an non-root user

    # echo "exec i3" > ~/.xinitrc
    # startx
    

References:

Random Tips:

The command below installs and overwrites all files (be careful). This has helped me out when I've messed up an install before.

# pacman -S package --overwrite='*'

If you land in grub after install, then use the ls command to check filenames. I've had to point to the config file before.

grub> configfile (hd1,gpt1)/boot/grub/grub.cfg.new