I'm trying to setup a full encrypted disk with a separate /boot
partition and I'm having some troubles.
I'll write down the procedure I've been following on a Ubuntu 15.04 Live DVD session.
Fill the disk with 'random data'
sudo dd if=/dev/urandom of=/dev/sda1 bs=4096 #ok
Create the partitions (using gparted)
- Create Partition Table - gpt
2.
- /dev/sda1 ext2 1.5GB #boot
- /dev/sda2 linux-swap 4GB #swap
- /dev/sda3 ext4 15 GB #root
- /dev/sda4 ext4 FREESPACE #home
- Create Partition Table - gpt
2.
Encrypt volumes
cryptsetup luksFormat --cipher twofish-xts-plain64 --key-size 512 --hash sha512 --iter-time 3000 /dev/sda1 cryptsetup luksFormat --cipher twofish-xts-plain64 --key-size 512 --hash sha512 --iter-time 3000 /dev/sda2 cryptsetup luksFormat --cipher twofish-xts-plain64 --key-size 512 --hash sha512 --iter-time 3000 /dev/sda3 cryptsetup luksFormat --cipher twofish-xts-plain64 --key-size 512 --hash sha512 --iter-time 5000 /dev/sda4
Open cryptovolume
cryptsetup luksOpen /dev/sda1 boot cryptsetup luksOpen /dev/sda2 swap cryptsetup luksOpen /dev/sda3 root cryptsetup luksOpen /dev/sda4 home
Format
mkfs.ext2 /dev/mapper/boot mkswap /dev/mapper/swap mkfs.ext4 /dev/mapper/root mkfs.ext2 /dev/mapper/home
Install (using Ubiquity)
- boot loader on /dev/sda
- /dev/sda1 - use as ext2 - mount point /boot
- /dev/sda2 - use as ext2 - mount point /boot
- /dev/sda3 - use as ext2 - mount point /boot
- /dev/sda4 - use as ext2 - mount point /boot
At the end the installer warns that grub-install failed (because the boot volume is encrypted), so choose 'continue without bootloader'.
Clean boot volume
mkfs.ext2 /dev/mapper/boot
Mount volume
mkdir /mnt/root mount /dev/mapper/root /mnt/root mount /dev/mapper/boot /mnt/root/boot
Update fstab and crypttab
sudo blkid [/dev/sr0: UUID="2015-10-21-16-17-40-00" LABEL="Ubuntu 15.10 amd64" TYPE="iso9660" PTUUID="429817b4" PTTYPE="dos" /dev/sda1: UUID="...#1" TYPE="crypto_LUKS" PARTUUID="..." /dev/sda2: UUID="...#2" TYPE="crypto_LUKS" PARTUUID="..." /dev/sda3: UUID="...#3" TYPE="crypto_LUKS" PARTUUID="..." /dev/sda4: UUID="...#4" TYPE="crypto_LUKS" PARTUUID="..." /dev/mapper/boot: UUID="..." TYPE="ext2" /dev/mapper/swap: UUID="..." TYPE="swap" /dev/mapper/root: UUID="..." TYPE="ext4" /dev/mapper/home: UUID="..." TYPE="ext4"]
fstab
#<file system> <mount point> <type> <options> <dump> <pass> UUID=#1 /boot ext2 defaults 0 2 UUID=#2 none swap sw 0 0 UUID=#3 / ext4 errors=remount-ro 0 1 UUID=#4 /home ext4 defaults 0 2
crypttab
boot UUID=#1 luks,cipher=twofish-xts-plain64,size=512, hash=whirlpool, time=3000 swap UUID=#2 luks,swap,cipher=twofish-xts-plain64,size=512, hash=whirlpool,time=3000 root UUID=#3 luks,cipher=twofish-xts-plain64,size=512, hash=whirlpool,time=3000 home UUID=#4 luks,cipher=twofish-xts-plain64,size=512, hash=whirlpool,time=5000
Update initramfs image
cd /mnt sudo chroot root mount -t proc proc /proc mount -t sysfs sys /sys mount -t devpts devpts /dev/pts update-initramfs -u #ok
Configure bootloader (
/etc/default/grub
)GRUB_ENABLE_CRYPTODISK=y GRUB_PRELOAD_MODULES="luks cryptodisk" GRUB_CMDLINE_LINUX="cryptdevice=UUID#3:root root=/dev/mapper/root resume=/dev/mapper/swap crypto=whirlpool:twofish-xts-plain64:512:0:"
create config file
$ grub-mkconfig -o /boot/grub/grub.cfg [/usr/sbin/grub-probe: error: failed to get canonical path of `/dev/mapper/root'.]
try outside
$ exit $ grub-mkconfig -o /boot/grub/grub.cfg [/usr/sbin/grub-probe: error: failed to get canonical path of `/cow'.]
Did I make any mistake before this? How can I continue to configure and install grub correctly?
grub
+ your title. I suppose you found your procedure for encrypting at pavelkogan.com/2014/05/23/luks-full-disk-encryption (which is the first google search on this topic). if not, maybe that will help. Good Question! and Good Luck! – shellter Feb 6 '16 at 2:01/boot
as the mount point for everything. I'm hoping that's a typo. 2. You did not mount/dev
while chrooting, but you did mount devpts. O.o – muru May 15 '16 at 19:29