You are not logged in.

#1 2013-07-19 19:01:45

Registered: 2013-03-24
Posts: 8

UEFI boot on GPT with LVM2 on LUKS.

so i have installed arch many times and tinkered around with it. i love it. but i cannot seem to get the base setup that i want. i have read through wikis and combed through the forums but cannot seem to find answers that i am looking for.

first things first, the hardware that i am using:
Gigabyte Z77x-UD5H
Intel i7 3770k
Corsair RAM
2x Gigabyte 7970 Ref
Samsung 840 Pro 128GB SSD

what i am trying to achieve is a UEFI boot on GPT with LVM2 on LUKS. i tried many times to do this with grub2 but i had issues and i ended up reading that grub2 doesnt play that well with UEFI, or so what i understood from what i read. so i would like to do an EFIstub boot.

i have gone through the wiki pages on these and wrote down the steps that i think i need to take. please let me know if i am missing something, if things are out of order, if i have written something i dont need, or just suggestions in general.

(after boot into UEFI mode)
# ls -1 /sys/firmware/efi (double check that the firmware is available.)
# ping -c 3
# cgdisk /dev/sda
(create a boot partition on 1024MB, for enough room)
(create an LVM partition for the rest)
# mkfs.vfat -F32 /dev/sda1
# cryptsetup luksFormat /dev/sda2 (enter password)
# cryptsetup luksOpen /dev/sda2 lvm
# pvcreate dataalignment 1m /dev/mapper/lvm
# pvdisplay (to check the volume creation)
# vgcreate LVM /dev/mapper/lvm(?)
# vgdisplay (double check the volume creation)
# lvcreate -L 20G LVM -n root
# lvcreate -L 12G LVM -n var
# lvcreate -l +100% LVM -n home
# mkfs.btrfs /dev/mapper/LVM-root
# mkfs.reiserfs /dev/mapper/LVM-var
# mkfs.ext4 /dev/mapper/LVM-home
# mount /dev/mapper/LVM-root /mnt
# mkdir /mnt/boot
# mkdir /mnt/var
# mkdir /mnt/home
# mount /dev/sda1 /mnt/boot
# mount /dev/mapper/LVM-var /mnt/var
# mount /dev/mapper/LVM-home /mnt/home
# nano /etc/mkinitcpio.conf (insert LVM2)
# lsblk (make sure things are listed properly)
# nano /etc/pacman.d/mirrorlist (edit my mirror)
# pacstrap /mnt base base-devel zsh
# gen fstab -L -p /mnt >> /mnt/etc/fstab
# nano /mnt/etc/fstab (double check everything)
# arch-chroot /mnt
# nano /etc/locale.gen (edit)
# locale-gen
# ln -s /usr/share/zoneinfo/America/New_York
# hwclock --systohc --utc
# echo Arch > /etc/hostname
# systemctl enable dhcpcd.service
# mkinitcpio -p linux
# passwd (create root passwd)
# useradd -m -g users -G wheel -s /bin/zsh user
# passwd user
# pacman -S efistub
# efibootmgr -c -L "Arch Linux" -l /vmlinuz-linux -u "root=/dev/mapper/LVM-root ro initrd=/initramfs-linux.img"

Last edited by L_and_P21 (2013-07-19 19:44:26)


#2 2013-07-19 19:37:03

Forum Fellow
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 17,243

Re: UEFI boot on GPT with LVM2 on LUKS.

L_and_P21 wrote:

what i am trying to achieve is a UEFI boot on GPT with LVM2 on LUKS.

Then put something along those lines in the title please.

(Edit: thanks for the new title.  Unfortunately I can't help with the problem at hand, but now those who can will more likely notice this thread).

Last edited by Trilby (2013-07-19 20:24:05)


#3 2013-07-19 22:43:38

From: Woonsocket, RI
Registered: 2012-11-06
Posts: 719

Re: UEFI boot on GPT with LVM2 on LUKS.

You haven't specified the most important detail: What is not working?

Absent that information, the main thing I notice is that you haven't given partitioning details, such as the output of "gdisk -l /dev/sda" or "parted /dev/sda list". Most importantly, it's not clear that /dev/sda1 is properly marked as an EFI System Partition (ESP).

Another comment: Directly using an EFI stub loader as you're doing is the hardest way to do it. Launching the stub loader via rEFInd or gummiboot is almost always easier.


#4 2013-07-19 22:55:05

From: Stalowa Wola, Poland
Registered: 2009-12-22
Posts: 119

Re: UEFI boot on GPT with LVM2 on LUKS.


After mounting root, home, var, and boot, but still before chrooting into /mnt/, you immediately modify mkinitcpio.conf.

# nano /etc/mkinitcpio.conf (insert LVM2)

I guess it is OK but I'd check if mkinitcpio,conf has the lvm2 hook (lowercase letters) after chrooting. You do not check it in your "check list".

Make sure that you also add appropriate modules to mkinitcpio.conf (in the /mnt/ mounted system), like dm_mod, and vfat (for the /boot partition), reiserfs, and modules for Luks (dm_crypt and aes_86x64 in my case). Perhaps you don't need dm_mod, I did need that when I made a similar installation plus raid 5 on a virtual machine.

The command

# pacman -S efistub

is a riddle to me. What do you install exactly? I suggest installing gumiboot or refind-efi. At first I installed refind-efi but then changed to gummiboot, and my virtual machine stopped dropping into "efi-shell" every time I started arch linux in it. Perhaps that bad behaviour has been fixed for virtual machines now, but I remember that installing gummiboot so;ved that problem (but I'm digressing, sorry).


#5 2013-07-20 01:07:10

From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: UEFI boot on GPT with LVM2 on LUKS.

@dif, dm_mod will correctly be pulled in by any of the dm_mod requiring hooks these days.  Also, the filesystems hook will take care of vfat for you as well.


#6 2013-07-20 23:18:59

From: Cymru
Registered: 2011-11-27
Posts: 5,750

Re: UEFI boot on GPT with LVM2 on LUKS.

What they collectively said.

Plus your kernel command line must specify cryptdevice. You must include the encrypt hook in mkinitcpio.conf as well as lvm2. And your locale symbolic link will end up wherever you happen to be when you execute the command and will be called New_York which is probably neither what nor where you want it.

Do you need to enable dhcpcd.service directly? Why that particularly? If you do, are you sure you don't need dhcpcd@<interface>.service instead?

Last edited by cfr (2013-07-20 23:20:38)

How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Corporation Wireless 8265 / 8275 | US keyboard with Euro | 512G NVMe INTEL SSDPEKKF512G7L


Board footer

Powered by FluxBB