Skip to content

Encrypted installation

Sigurd Bøe edited this page Mar 22, 2018 · 14 revisions

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 dialog openssl-1.0

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

Configuring boot environment

Then make the initramfs

mkinitcpio -P

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-gpd-pocket-linux-jwrdegoede
initrd /intel-ucode.img
initrd /initramfs-gpd-pocket-linux-jwrdegoede.img
options cryptdevice=UUID=xxxx-yyyy-zzzz-aaaa:luks root=/dev/mapper/rootvg-root quiet rw

paste the UUID in after options cryptdevice=UUID= and before :luks root=/dev/mapper/rootvg-root quiet rw
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 have now completed the install of the system

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. If you want to reboot you need to exit the chroot by hitting Ctrl+D first.

Now you may want access to AUR
Or install a Desktop enviornment like Gnome or KDE.