Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save chrisleekr/a23e93edc3b0795d8d95f9c70d93eedd to your computer and use it in GitHub Desktop.
Save chrisleekr/a23e93edc3b0795d8d95f9c70d93eedd to your computer and use it in GitHub Desktop.
Install Arch Linux with Full Disk Encryption (LVM on LUKS) for Dell XPS 15 7590

This is Arch Linux with Full Disk Encryption (LVM on LUKS) for Dell XPS 15 7590

Based on:

[IMPORTANT] ASSUMPTIONS

  • I assume that /dev/nvme0n1 is the system's disk, and /dev/sda is USB drive.
  • RAM is 32G

STEPS

  1. Download arch iso image from https://www.archlinux.org/ and copy to a USB drive.

    # dd if=arch.iso of=/dev/sdb
    
  2. Boot up and pressing the F2 key

     Under 'System Configuration', change the SATA Mode from the default "RAID" to "AHCI". This will allow Linux to detect the NVME SSD.
     Under 'Secure Boot', disable secure boot to allow Linux to boot.
     Under 'POST Behaviour', change "Fastboot" to "Thorough". This prevents intermittent boot failures.
    
     Save & Reboot
    
  3. Connect to internet. Useful commands:

    # iwctl --passphrase <passphrase> station wlan0 connect <SSID>
    
  4. Partitioning

    # gdisk /dev/nvme0n1
    
    # o
    
    # n
    # 1
    # 4096
    # +512M
    # ef00
    
    # n 
    # 2
    # <Enter>
    # <Enter>
    # 8e00
    
    # w
    # y 
    

    Format Partitions:

    # mkfs.fat -F32 /dev/nvme0n1p1
    
  5. Setup encryption

    # cryptsetup -c aes-xts-plain64 -y --use-random luksFormat /dev/nvme0n1p2
    # cryptsetup luksOpen /dev/nvme0n1p2 luks
    
  6. Create LVM Partitions This creates one partions for root, modify if /home or other partitions should be on separate partitions

    # pvcreate /dev/mapper/luks
    # vgcreate vg0 /dev/mapper/luks
    # lvcreate --size 8G vg0 --name swap
    # lvcreate -l +100%FREE vg0 --name root
    
  7. Format LVM partitions

    # mkfs.ext4 /dev/vg0/root
    # mkswap /dev/vg0/swap
    
  8. Mount the new system

    # mount /dev/vg0/root /mnt
    # mkdir /mnt/boot
    # mount /dev/nvme0n1p1 /mnt/boot
    # swapon /dev/vg0/swap
    
  9. Install the base system

    # pacstrap -i /mnt base base-devel linux linux-firmware lvm2 openssh git vim intel-ucode lm_sensors networkmanager
    
  10. Generate /etc/fstab. This file can be used to define how disk partitions, various other block devices, or remote filesystems should be mounted into the filesystem.

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

    (Optional) For making /tmp a ramdisk, add following line to /mnt/etc/fstab:

    tmpfs	/tmp	tmpfs	defaults,noatime,mode=1777	0	0
    
  11. Enter the new system

    # arch-chroot /mnt /bin/bash
    
  12. Set TimeZone

    See available timezones:
    # ls /usr/share/zoneinfo/
    
    Set timezone:
    # ln -s /usr/share/zoneinfo/Australia/Melbourne /etc/localtime
    
  13. Set Locale

    # vim /etc/locale.gen (uncomment en_US.UTF-8 UTF-8)
    # locale-gen
    # echo LANG=en_US.UTF-8 > /etc/locale.conf
      # export LANG=en_US.UTF-8
    
  14. Set the hardware clock mode uniformly between your operating systems. Otherwise, they may overwrite the hardware clock and cause time shifts.

    # hwclock --systohc --utc
    
  15. Set hostname

    # echo myhostname >/etc/hostname
    

    Add it to /etc/hosts:

    127.0.1.1	myhostname.localdomain	myhostname
    
  16. Create User

    # useradd -m -g users -G wheel chrislee
    # passwd chrislee
    # visudo
    uncomment %wheel ALL=(ALL) ALL
    
  17. Configure mkinitcpio with modules needed for the initrd image

    # vim /etc/mkinitcpio.conf
    MODULES=(ext4 nvidia nvidia_modeset nvidia_uvm nvidia_drm xhci_pci wd719x aic94xx)
    HOOKS=(base systemd autodetect keyboard modconf block sd-encrypt sd-lvm2 filesystems fsck)
    COMPRESSION="lz4"
    

    Regenerate initrd image

    # mkinitcpio -p linux
    
  18. Setup systemd-boot

    # bootctl --path=/boot install
    
    # mkdir -p /boot/loader
    # vim /boot/loader/loader.conf
    default arch.conf
    timeout 2
    editor 0
    
    # blkid -s UUID -o value /dev/nvme0n1p2
    

    Copy UUID

    # mkdir -p /boot/loader/entries/
    # vim /boot/loader/entries/arch.conf
    title Arch Linux
    linux /vmlinuz-linux
    initrd /intel-ucode.img 
    initrd /initramfs-linux.img 
    options rd.luks.name=<UUID>=cryptlvm root=/dev/vg0/root resume=/dev/vg0/swap rd.luks.options=discard mem_sleep_default=deep acpi_rev_override=5 nvidia-drm.modeset=1 quiet splash rw
    
    
    # bootctl --path=/boot update
    
    # mkdir -p /etc/pacman.d/hooks/
    # vim /etc/pacman.d/hooks/systemd-boot.hook
    [Trigger]
    Type = Package
    Operation = Upgrade
    Target = systemd
    [Action]
    Description = Updating systemd-boot
    When = PostTransaction
    Exec = /usr/bin/bootctl update
    
  19. Enabled some services

    # systemctl enable fstrim.timer
    # systemctl enable NetworkManager
    
  20. Exit new system and unmount all partitions

    # exit
    # umount -R /mnt
    # swapoff -a
    
  21. Reboot into the new system. Don't forget to remove the CD/USB.

    # reboot
    
  22. System is installed now. If you want to install Gnome desktop, perform following steps.

  23. Setup WiFi

    # nmtui
    
  24. Download base/gnome installer script

    # curl https://raw.githubusercontent.com/exah-io/arch-linux/master/2_gnome.sh -o 2_gnome.sh
    # chmod +x 2_gnome.sh
    # ./2_gnome.sh
    
  25. Install OLED brigtness control

    # git clone https://github.com/udifuchs/icc-brightness
    # make
    
    Test with watch 
    
    # ./icc-brightness watch
    
    Install 
    
    # sudo make install
    
    Reboot
    
  26. Install fish

    # yay -S fish
    # curl -L https://get.oh-my.fish | fish
    # sudo pacman -S fzf
    # omf install https://github.com/jethrokuan/fzf
    # omf install bobthefish
    # chsh -s /usr/local/bin/fish
    # git clone https://github.com/powerline/fonts.git --depth=1
    # cd fonts
    # ./install.sh
    # cd ..
    # rm -rf fonts
    # gnome-terminal -e fish
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment