Search Results


I use Arch BTW

Date Dec 09, 2020
Date Nov 09, 2021

Contents

Sometimes, I want to shout, as loud as I could. Why you ask? Simple, ITS ANNOYING AF TO REINSTALL OS WITHOUT PROPER GUIDE. This journal entry mentions the step-by-step instructions on how I personally install Arch on my system.

Although, most of things I do are scripted but the steps remain same everytime. Even if you use Ansible, you have to atleast check the scripts and tune it according to your preference.

Networking: ON πŸ—Ό

    # If you are using Ethernet/Wired connection
    ip link
    # If you are using wireless

Set timedate πŸ“†

    # Set time and date
    timedatectl set-ntp true
    timedatectl set-timezone Europe/Dublin
    # Check if date is correct
    date
    # Write the correct date to CMOS RTC
    hwclock -w
    # Check if date and time is correct on RTC clock
    hwclock -r

Partition it right πŸ—‚οΈ

    STOR_DEVICE=/dev/nvme0n1
    # Set partition table to GPT
    parted -s ${STOR_DEVICE} mklabel gpt
    # Creates first partition of size 512 MB as format type fat32
    parted -s ${STOR_DEVICE} mkpart ESP fat32 1MiB 513MiB
    # Set bootable flag to ON for first partition
    parted -s ${STOR_DEVICE} set 1 boot on
    # Creates second partition with name ArchLinux and format type as ext4, taking rest of space.
    parted -s ${STOR_DEVICE} mkpart β€œArchLinux” ext4 513MiB 100%

LUKS here

    # LUKS encrypting drive for security, I always choose the best encryption. (NOT RECOMMENDED FOR OLDER PCs)
    cryptsetup --type luks2 --cipher aes-xts-plain64 --hash sha512 --iter-time 5000 --key-size 512 --pbkdf argon2i --use-random --verify-passphrase luksFormat /dev/nvme0n1p2

    # Unlock the newly created encrypted partition (Shows up in /dev/mapper/whatever)
    cryptsetup luksOpen /dev/nvme0n1p2 whatever

Logical Being

    # First: Create a physical volume
    pvcreate /dev/mapper/whatever
    # Second: Creates a Volume Group of mentioned name
    vgcreate arch /dev/mapper/whatever
    # Third: Create a logical volume/partition on the previously created volume group
    lvcreate -l +100%FREE arch --name root
    # lvcreate --size 1G arch --name swap

Format Partitions πŸ“

    mkfs.vfat -F32 -n LinuxEFI /dev/nvme0n1p1
    mkfs.ext4 -L ArchLinuxRoot /dev/mapper/arch-root

Mount Partitions πŸ“‚

    mount /dev/mapper/arch-root /mnt
    mkdir -p /mnt/efi
    mount /dev/nvme0n1p1 /mnt/efi

Select Mirrors for download πŸͺž

    reflector --verbose --latest 10 --sort rate --save /etc/pacman.d/mirrorlist

Bare Minimum Things 🦺

    pacstrap /mnt base base-devel vim efibootmgr linux linux-firmware lvm2 mkinitcpio networkmanager amd-ucode git efitools wget python neovim zsh git sudo dialog wpa_supplicant tmux dhclient reflector nvme-cli

The Main Course :pot_of_food:

    # Generate fstab and chroot into your new installation
    genfstab -U /mnt >> /mnt/etc/fstab
    arch-chroot /mnt
    # Generate Locale
    echo LANG=en_US.UTF-8 > /etc/locale.conf
    echo en_US.UTF-8 UTF-8 >> /etc/locale.gen
    locale-gen
    localectl set-locale LANG=en_US.UTF-8
    echo LC_ALL= >> /etc/locale.conf
    # Set the hostname
    echo Awesome-PC > /etc/hostname
    # Enable wheel group for sudoers
    echo "%root ALL=(ALL) ALL" > /etc/sudoers
    echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers
    # Add the primary user
    groupadd diabloxenon
    useradd -m -g diabloxenon,wheel -s /bin/zsh diabloxenon
    passwd diabloxenon

Now we will add mkinitcpio file for generating initramfs. Open with vim /etc/mkinitcpio.conf

All the files are added here for this website.

    # vim:set ft=sh
    # MODULES
    # The following modules are loaded before any boot hooks are
    # run.  Advanced users may wish to specify all system modules
    # in this array.  For instance:
    #     MODULES=(piix ide_disk reiserfs)
    MODULES=(ext4)

    # BINARIES
    # This setting includes any additional binaries a given user may
    # wish into the CPIO image.  This is run last, so it may be used to
    # override the actual binaries included by a given hook
    # BINARIES are dependency parsed, so you may safely ignore libraries
    BINARIES=()

    # FILES
    # This setting is similar to BINARIES above, however, files are added
    # as-is and are not parsed in any way.  This is useful for config files.
    FILES=()

    # HOOKS
    # This is the most important setting in this file.  The HOOKS control the
    # modules and scripts added to the image, and what happens at boot time.
    # Order is important, and it is recommended that you do not change the
    # order in which HOOKS are added.  Run 'mkinitcpio -H <hook name>' for
    # help on a given hook.
    # 'base' is _required_ unless you know precisely what you are doing.
    # 'udev' is _required_ in order to automatically load modules
    # 'filesystems' is _required_ unless you specify your fs modules in MODULES
    # Examples:
    ##   This setup specifies all modules in the MODULES setting above.
    ##   No raid, lvm2, or encrypted root is needed.
    #    HOOKS=(base)
    #
    ##   This setup will autodetect all modules for your system and should
    ##   work as a sane default
    #    HOOKS=(base udev autodetect block filesystems)
    #
    ##   This setup will generate a 'full' image which supports most systems.
    ##   No autodetection is done.
    #    HOOKS=(base udev block filesystems)
    #
    ##   This setup assembles a pata mdadm array with an encrypted root FS.
    ##   Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
    #    HOOKS=(base udev block mdadm encrypt filesystems)
    #
    ##   This setup loads an lvm2 volume group on a usb device.
    #    HOOKS=(base udev block lvm2 filesystems)
    #
    ##   NOTE: If you have /usr on a separate partition, you MUST include the
    #    usr, fsck and shutdown hooks.
    HOOKS=(base udev autodetect modconf block filesystems keyboard keymap lvm2 encrypt resume fsck)

    # COMPRESSION
    # Use this to compress the initramfs image. By default, gzip compression
    # is used. Use 'cat' to create an uncompressed image.
    COMPRESSION="cat"
    #COMPRESSION="gzip"
    #COMPRESSION="bzip2"
    #COMPRESSION="lzma"
    #COMPRESSION="xz"
    #COMPRESSION="lzop"
    #COMPRESSION="lz4"

    # COMPRESSION_OPTIONS
    # Additional options for the compressor
    #COMPRESSION_OPTIONS=()

After editing the file, please run mkinitcpio -p linux

Dessert 🍦

To add cherry on top, we will use yay AUR helper, for installing packages

cd /opt
git clone https://aur.archlinux.org/yay.git
chown -R diabloxenon:users ./yay
cd yay
su diabloxenon
makepkg -si
exit

Generating EFI 🧬

Create new file called /boot/cmdline.txt and enter the following

cryptdevice=UUID=%uuid%:lvm:allow-discards root=/dev/mapper/arch-root rw quiet

after entering this, replace the line with sed -i s/%uuid%/$(blkid -o value -s UUID /dev/nvme0n1p2)/ /boot/cmdline.txt

Now the main part,

cd /boot
mkdir -p /efi/BOOT/ArchLinux
objcopy \
    --add-section .osrel=/etc/os-release --change-section-vma .osrel=0x20000 \
    --add-section .cmdline="cmdline.txt" --change-section-vma .cmdline=0x30000 \
    --add-section .linux="vmlinuz-linux" --change-section-vma .linux=0x40000 \
    --add-section .initrd="initramfs-linux.img" --change-section-vma .initrd=0x3000000 \
    /usr/lib/systemd/boot/efi/linuxx64.efi.stub /efi/BOOT/ArchLinux/linux-signed.efi

If you use lts versions of this

cd /boot
mkdir -p /efi/BOOT/ArchLinuxLTS
objcopy \
    --add-section .osrel=/etc/os-release --change-section-vma .osrel=0x20000 \
    --add-section .cmdline="cmdline.txt" --change-section-vma .cmdline=0x30000 \
    --add-section .linux="vmlinuz-linux-lts" --change-section-vma .linux=0x40000 \
    --add-section .initrd="initramfs-linux-lts.img" --change-section-vma .initrd=0x3000000 \
    /usr/lib/systemd/boot/efi/linuxx64.efi.stub /efi/BOOT/ArchLinuxLTS/linux-lts-signed.efi

Finally, copy the generated bootloader in your EFI directory /efi/EFI/BOOT/

mkdir -p /efi/EFI/BOOT
cp /efi/BOOT/ArchLinux/linux-signed.efi /efi/EFI/BOOT/BOOTX64.EFI

Bare minimum things πŸ€”

Lastly, I am adding a list here to install things that can be the quintessential things for you noobies with big boobies :squinting_face_with_tongue:

    su diabloxenon
    yay -S \
    # Disk usage analyzer
    baobab \
    # Image previewer
    eog \
    # Document viewer (PDF, DJVU etc.)
    evince \
    # Archive manager
    file-roller \
    # Desktop Login Manager
    gdm \
    # IDE editor
    code \
    # Privacy focused web browser
    brave-bin \
    # Great EPUB reader
    foliate \
    # Scientific/Programming Calculator
    gnome-calculator \
    # Character/Emoji viewer
    gnome-characters \
    # Clock/Timer/Stopwatch
    gnome-clocks \
    # Display color profile manager
    gnome-color-manager \
    # System/user installed fonts viewer
    gnome-font-viewer \
    # Disk management software
    gnome-disk-utility \
    gdisk \
    # Keyring for local credentials management
    gnome-keyring \
    # Log viewer
    gnome-logs \
    # Menubar stuff
    gnome-menus \
    # Minimal music player
    gnome-music \
    # Photo viewer/ Album manager
    gnome-photos \
    # Snipping tool
    gnome-screenshot \
    # Gnome Session manager
    gnome-session \
    # Settings backend
    gnome-settings-daemon \
    # GUI shell for gnome
    gnome-shell \
    # Extensions
    gnome-shell-extensions \
    # Process viewer
    gnome-system-monitor \
    # GPGPU powered TTY based on Rust
    alacritty \
    # Shell themes
    gnome-themes-extra \
    mutter \
    # File manager
    nautilus \
    nemo \
    # Wifi, Wired etc.
    networkmanager \
    # File previewer
    sushi \
    xdg-user-dirs-gtk \
    # Scanner frontend
    simple-scan \
    # Video player
    vlc

    exit

    systemctl enable gdm
    systemctl enable NetworkManager
    reboot

Final Touch :man_getting_haircut:

If you have reached till the end then good job! You and I both know that your system is working now. If you want to add some additional pointers then you are welcome to do so! Just email me the things you need to mention along with your fauxname (twitter, github handle etc.) so I personally can shoutout to you for that.