Skip to content
Sigurd Bøe edited this page Nov 1, 2017 · 13 revisions

Arch Linux with LUKS LVM on GPD Pocket

Tutorial how to install Arch Linux with full disk encryption on GPD Pocket

If you want to use an unmodified ArchISO (from https://archlinux.org ) go to the old guide. The following guide is for the custom ISO with preloaded drivers, settings and help files.

- The custom ISO has not yet been released and will be released shortly

Making the USB Stick

Download the ISO from the Releases section of this repository.

Flash it to a USB Stick 2GB or more. It can be USB2 or USB3 it doesn't matter. I suggest using etcher.io if you are unsure how to do this.

For more advanced methods see the Arch Wiki

Booting

Plug your USB stick with arch into the USB-A (regular usb port)

While you boot spam the Del key to get into the UEFI menu if you have problems try without the charger

Hit left once to go to the Save and Exit, use the up arrow key to find the USB stick and boot from it.

Connecting to the internet

Ethernet should just work, but it is only suggested if you have a USB-C dock or hub, with charging. If you connected the ehternet cable or network card after you booted you may need to run. systemctl restart dhcpcd

For extensive information on connecting via see the Arch Wiki. For condensed instructions read on.

Check if your wireless card is up.

ip link show wlp1s0

If its not up, you can activate it.

ip link set wlp1s0 up

To see what access points are available.

iw dev wlp1s0 scan | less

Connect to a WPA/WPA2 network

wpa_supplicant -i wlp1s0 -c <(wpa_passphrase "your_SSID" "your_key")

Optional

If you want to be able to copy paste the commands from another PC using SSH follow the page on SSH before you continue.

Partitioning

Warning, this does wipe your whole disk!!!!

gdisk /dev/mmcblk0
# o ↵ to create a new empty GUID partition table (GPT)
# y ↵ to confirm

# n ↵ add a new partition
# ↵ to select default partition number of 1
# ↵ to select default start at first sector
# +512M ↵ make that size partition for booting
# ef00 ↵ Partition type EFI

# n ↵ to add new partition
# ↵ to select default partition number of 2
# ↵ to select default start of sector
# ↵ to select default end of sector
# 8e00 ↵ to make partition type of LVM

# p ↵ if you want to check the partition layout
# w ↵ to write changes to disk
# y ↵ to confirm

Formatting

The EFI partition

mkfs.fat -F32 /dev/mmcblk0p1

Encrypt the LVM partition with LUKS

cryptsetup luksFormat -v -s 512 -h sha512 /dev/mmcblk0p2

Read the warning thourougly it says you need to confirm writing YES in capital letters. set a password.

Then open the partition.

cryptsetup luksOpen /dev/mmcblk0p2 luks

Initialize a physical volume

pvcreate /dev/mapper/luks

Create a volume group, we'll call it rootvg

vgcreate rootvg /dev/mapper/luks

Create swap -C makes continuous data blocks

lvcreate -n swap -L 8G -C y rootvg

Create a root partition (can resize later if you need, probably not)

lvcreate -n root -L 30G rootvg

Create /home partition (lower case -l this time)

lvcreate -n home -l 100%FREE rootvg

Formatting continued

This formats home and root as ext4 filesystems. Then designates the swap partition as such, and enables the swap.

mkfs.ext4 /dev/mapper/rootvg-home
mkfs.ext4 /dev/mapper/rootvg-root
mkswap /dev/mapper/rootvg-swap
swapon /dev/mapper/rootvg-swap

Mounting before install

Mount root to /mnt (this is the convention while installing)

mount /dev/mapper/rootvg-root /mnt

Make a boot and a home folder (two commands in one :) )

mkdir /mnt/{home,boot}

Mount home and boot

mount /dev/mapper/rootvg-home /mnt/home
mount /dev/mmcblk0p1 /mnt/boot

Installing

Install Arch some things needed for AUR repository and an easier text editor.

pacstrap /mnt base base-devel nano zsh grml-zsh-config tlp

Generate the fstab

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

Install the njkli repository and set the console font.

gpd-setup

Remote control your installation

arch-chroot /mnt /usr/bin/zsh

Install some of the GPD packages

Install some packages related to the GPD

pacman -Syyu --force gpd-pocket-support linux-jwrdegoede-docs linux-jwrdegoede-headers 

Configuring boot environment

Then make the initramfs

mkinitcpio -p linux-jwrdegoede

Install the bootloader

bootctl install

Configure bootloader
First we want to write down the UUID of the partition with this weird command

blkid | grep mmcblk0p2 | cut -f2 -d\" > /boot/loader/entries/arch.conf

Then edit the file

nano /boot/loader/entries/arch.conf

You will only see the UUID. You can put it into nano's clipboard by pressing ctrl+k and paste it later using ctrl+u

title Arch Linux
linux /vmlinuz-linux-jwrdegoede
initrd /initramfs-linux-jwrdegoede.img
options cryptdevice=UUID=xxxx-yyyy-zzzz-aaaa:luks root=/dev/mapper/rootvg-root quiet rw fbcon=rotate:1

paste the UUID in after options cryptdevice=UUID= and before :luks root=/dev/mapper/rootvg-root quiet rw fbcon=rotate:1
CTRL+x, then y then ↵ to save and exit

Make this the default boot entry

nano /boot/loader/loader.conf

Have the text be

timeout 2
default arch

CTRL+x, then y then ↵ to save and exit

Do some basic config

Create your user

useradd -m -g users -G wheel,storage,power -s /usr/bin/zsh USERNAMEHERE
passwd USERNAMEHERE

Give this user sudo access

EDITOR=nano visudo

uncomment the line %wheel ALL=(ALL) ALL

CTRL+x, then y then ↵ to save and exit

set hostname

echo LOWERCASEHOSTNAMEHERE > /etc/hostname

set your timezone (use your own continent and city)

ln -sf /usr/share/zoneinfo/Europe/Oslo /etc/localtime

Configure locale

nano /etc/locale.gen

Uncomment the lines en_US.UTF-8 UTF-8 and en_US ISO-8859-1
CTRL+x, then y then ↵ to save and exit

generate locales

locale-gen

set language

echo "LANG=en_US.UTF-8" > /etc/locale.conf

Congrats, you may now reboot the system. You can install whatever desktop enviornment you like, now or after reboot. Or you can reboot to test if its working, then boot into the USB again and take a backup of your install using clonezilla which is included on the USB.

After the reboot you may want to install pacaur to get access to AUR. Dont do this before rebooting, and dont do it as root.

git clone https://aur.archlinux.org/cower.git
cd cower
makepkg -si
cd
git clone https://aur.archlinux.org/pacaur.git
cd pacaur
makepkg -si
cd
rm -rf {cower,pacaur}

Credits

emanuelduss as basis for partitioning, encryption and bootloader.
Hans de Goede for making the kernel
njkli for compiling the kernel and updating it
u/sultanmvp for being awesome

Clone this wiki locally