Cobbled together from the following resources:
- Full Disk Encryption - Linode
- Encrypting an entire system - Arch Wiki
- Install from existing linux - Arch Wiki
- Installation guide - Arch Wiki
- Gettys on Serial Consoles
Create a new Linode.
Create three new disk images.
- name "boot", type "unformatted / raw", size = 256 MB
- name "swap", type "unformatted / raw", size = swap size
- name "root", type "unformatted / raw", size = rest
Create a new configuration profile.
- label whatever
- kernel "pv-grub-x86_64"
- /dev/xvda "boot"
- /dev/xvdb "swap"
- /dev/xvdc "root"
- xenify distro "no"
- disable updatedb "no"
- modules.dep helper "no"
- automount devtmpfs "no"
Go to the Rescue tab, and click Reboot into Rescue Mode.
Connect via LISH.
Encrypt and open the root partition.
cryptsetup luksFormat /dev/xvdccryptsetup luksOpen /dev/xvdc crypt-xvdc
Create the filesystems for the boot and root partitions.
mkfs -t ext2 /dev/xvdamkfs -t ext4 /dev/mapper/xvdc
Create the encrypted swap partition.
cryptsetup -d /dev/urandom create crypt-swap /dev/xvdbmkswap /dev/mapper/crypt-swapswapon /dev/mapper/crypt-swap
Bootstrap an Arch chroot environment.
cd /tmpwget https://mirrors.kernel.org/archlinux/iso/2014.09.03/archlinux-bootstrap-2014.09.03-x86_64.tar.gztar xf archlinux-bootstrap-2014.09.03-x86_64.tar.gzsed -i 's?#Server = https://mirrors.kernel.org/archlinux/$repo/os/$arch?Server = https://mirrors.kernel.org/archlinux/$repo/os/$arch?' root.x86_64/etc/pacman.d/mirrorlistroot.x86_64/bin/arch-chroot /tmp/root.x86_64
Prep the Arch chroot environment for installing the base system.
mkdir /run/shmcd /tmpcurl -O https://mirrors.kernel.org/archlinux/extra/os/x86_64/haveged-1.9.1-1-x86_64.pkg.tar.xzpacman -U haveged-1.9.1-1-x86_64.pkg.tar.xzhaveged -w 1024pacman-key --initpacman-key --populate archlinux
Mount the root and boot filesystems (in that order) under /mnt.
mount /dev/mapper/crypt-xvdc /mntmkdir /mnt/bootmount /dev/xvda /mnt/boot
Install the base system, generate the fstab, and chroot into it.
pacstrap /mnt base base-develgenfstab -p /mnt >> /mnt/etc/fstabarch-chroot /mnt /bin/bash
Configure the system.
sed -i 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gensed -i 's/#en_US ISO-8859-1/en_US ISO-8859-1/' /etc/locale.genlocale-genecho LANG=en_US.UTF-8 > /etc/locale.confexport LANG=en_US.UTF-8ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtimeecho my.hostname.com > /etc/hostnamesystemctl enable [email protected]
Configure the initial ramdisk.
- Add
encryptto theHOOKSline in/etc/mkinitcpio.confbeforefilesystems. mkinitcpio -p linux
Add this line /etc/crypttab to mount the encrypted swap partition on boot.
crypt-swap /dev/xvdb /dev/urandom swap
Configure passwords and a user account.
passwduseradd -m -g users -G wheel -s /bin/bash youruserpasswd youruservisudo- Uncomment line
%wheel ALL=(ALL) ALL.
Build the grub-legacy bootloader from the AUR.
- Uncomment the
multilibrepo from/etc/pacman.conf. pacman -Sy gcc-multilibsu yourusercdcurl -O https://aur.archlinux.org/packages/gr/grub-legacy/grub-legacy.tar.gztar xf grub-legacy.tar.gzcd grub-legacymakepkg -ssudo pacman -U grub-legacy-0.97-25-x86_64.pk.tar.xzcd ..rm -rf grub-legacy grub-legacy.tar.gzexit
Edit /boot/grub/menu.lst.
root (hd0)kernel /vmlinuz-linux root=/dev/mapper/crypt-xvdc cryptdevice=/dev/xvdc:crypt-xvdc console=hvc0 ro
Symlink the grub directory so pv-grub can find it.
cd /bootmkdir bootcd bootln -s ../grub .
Leave chroots, unmount partitions, and reboot.
exitumount -R /mntexitpkill havegedumount /tmp/root.x86_64/devumount /tmp/root.x86_64- Shutdown from Linode Manager
- Boot from Linode Manager
Every time you boot the machine, you'll need to connect to LISH and type in your password to unlock the root partition.
How do you do this today?
Would have thought this process would be easier today... Has it been updated recently? I see it is still pulling the 2014 arch bootstrap.
curl -O https://mirrors.edge.kernel.org/archlinux/extra/os/x86_64/haveged-1.9.4-3-x86_64.pkg.tar.xz
^^ fails ^^ I'm stuck here.
EDIT: I figured it out... Seems for this setup, curl must use '-o' & specify an output file to work.
Now stuck on: where is grub-install?
I also think "mkfs -t ext4 /dev/mapper/xvdc" should be "mkfs -t ext4 /dev/mapper/crypt-xvdc"