Install Arch Linux, LVM and encrypt the disk (XPS 9360)
Recently I got an XPS 9360 machine from work, of course, I installed Linux. I have done this same installation (using LVM and cryptsetup
to encrypt the disk) before; this time I documented it.
The way of encrypting the disk here described is also known as LUKS on LVM.
WARNING: This steps will erase the whole disk.
BIOS
This is specific for the XPS 9360. Maybe for other XPS model, it is different or at least similar; I won't be responsible for any damage in data or hardware.
Enter BIOS with F2 and configure:
- “System Configuration” > “SATA Operation”: “AHCI”
- “Secure Boot” > “Secure Boot Enable”: “Disabled”
Install the base system
F12 to boot from usb stick. After booting your first command are:
# setfont latarcyrheb-sun32
# wifi-menu
# timedatectl set-ntp true
Respectivaly:
- Set a bigger font
- Get online
- Syncronize the time of your machine
Preparing the disk
Set up the partitions:
# parted /dev/nvme0n1
(parted) mkpart primary 1 3
(parted) name 1 grub
(parted) set 1 bios_grub on
(parted) mkpart primary 3 5123
(parted) name 2 boot
(parted) set 2 boot on
(parted) mkpart primary 5123 -1
(parted) name 3 lvm
(parted) set 3 lvm on
The UEFI partition is not encrypted. Format it using FAT:
# mkfs.fat -F 32 /dev/nvme0n1p2
Encrypt the rest of the disk:
# cryptsetup luksFormat --type luks2 /dev/nvme0n1p3
# cryptsetup open /dev/nvme0n1p3 linuxdrive
Create the LVM partitions:
# pvcreate /dev/mapper/linuxdrive
# vgcreate vg1 /dev/mapper/linuxdrive
# lvcreate -L 17G -n swap vg1
# lvcreate -l 100%VG -n rootfs vg1
Create the filesystems on top of LVM:
# mkfs.ext4 /dev/vg1/rootfs
# mkswap /dev/vg1/swap
Mount the filesystems:
# mount /dev/vg1/rootfs /mnt
# mkdir /mnt/boot
# mount /dev/nvme0n1p2 /mnt/boot
Install
And finally install the base system:
# pacstrap /mnt base
# genfstab -L /mnt >> /mnt/etc/fstab
Configuring the System
Timezone:
# cd /mnt/etc
# \rm localtime
# ln -s ../usr/share/zoneinfo/Pacific/Auckland localtime
Edit /mnt/etc/locale.gen
:
en_US.UTF-8 UTF-8
Execute:
# echo "LANG=en_US.UTF-8" > /mnt/etc/locale.conf
Edit /mnt/etc/vconsole.conf
:
KEYMAP=us
FONT=latarcyrheb-sun32
Set hostname in /mnt/etc/hostname
and /mnt/etc/hosts
(Replace: <hostname>
):
127.0.0.1 localhost
::1 localhost
127.0.1.1 <hostname>.localdomain <hostname>
Edit /mnt/etc/mkinitcpio.conf
, for this XPS 9360 with LVM and cryptsetup
:
HOOKS=(base udev autodetect consolefont keyboard keymap modconf block filesystems encrypt lvm2 resume fsck)
And run:
# arch-chroot /mnt
(chroot) # mkinitcpio -p linux
(chroot) # bootctl --path=/boot install
(chroot) # exit
#
Create the file /mnt/boot/loader/entries/arch.conf
:
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options cryptdevice=UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX:linuxdrive root=/dev/mapper/vg1-rootfs quiet rw
The uuid is /dev/nvme0n1p3
s. You can check it with lsblk -f
.
You are now good to go :).
Don't forget:
- Create a user for yourself,
useradd myname
- Setup a password for
root
,passwd
- Install an X Window System, install gnome with:
pacman -S gnome gnome-extra xorg-server-xwayland
- You might want to install
base-devel
as well:pacman -S base-devel
- You might want to install
intel-ucode
as well:pacman -S intel-ucode
, and change/boot/loader/entries/arch.conf
to this:
title Arch
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options cryptdevice=UUID=15633406-666c-4654-aab2-4bac514d60ef:linuxdrive root=/dev/mapper/vg1-rootfs rw
Recover
Just in case you need to recover (I always forget to install wpa_supplicant
):
# setfont latarcyrheb-sun32
# wifi-menu
# cryptsetup open /dev/nvme0n1p3 linuxdrive
# mount /dev/vg1/rootfs /mnt
# mount /dev/nvme0n1p2 /mnt/boot
Setup wifi
You can use wifi-menu
to setup network after installing, just install:
# pacman -S wpa_supplicant dialog
Or copy the file from /etc/netctl/xxx
. And start the network with:
# netctl start xxx
P. S.: In any case you will need pacman -S wpa_supplicant
to connect.