You are not logged in.

#1 2013-07-18 15:22:29

spotshot6544
Member
Registered: 2013-07-18
Posts: 9

[solved] LVM on LUKS tutorial (GPT) / grub problems

Eventually, I have no idea how, I solved it with https://wiki.archlinux.org/index.php/Encrypted_LVM

It might have been because I used 3 partitions? I have no idea.


(I would have deleted this thread if I knew how)




Can anyone recommend a tutorial for a newb for installing arch with Luks on an LVM? I am working in Virtualbox at the moment, but that is only temporary. The ones I have tried end up not working, or failing due to changes in the way Arch installs.

I think the problem is with grub. Things seem to install fine, but then I get stuck at grub while booting.

I've been aiming to use GPT since it seems newer.

I have lost count of the number of times I have attempted to install.

Generally speaking I have made /dev/sda1 for booting and created /dev/sda2 for everything else. I then setup the encryption on /dev/sda2, then setup the lvm on the mapped encryption. I Mount the root lvm to /mnt/ and the lvm home to /mnt/home/ then mount /dev/sda1 to /mnt/boot. Pacstrap to /mnt, install grub, reboot. (does not include all steps).

I'm sort of at a loss for words at this point. I don't even know everything that I have tried at this point.

Various sources I have consulted thus far
* http://suddenkernelpanic.blogspot.ca/20 … style.html
* http://www.saltiresable.com/articles/ar … tion-2012/
* https://plus.google.com/103155108926231 … k1oKEUR6zB
* https://wiki.archlinux.org/index.php/Encrypted_LVM
* https://wiki.archlinux.org/index.php/Grub
* https://wiki.archlinux.org/index.php/Dm-crypt_with_LUKS
* http://pteradigm.com/2012/09/16/install … ith-grub2/
* https://wiki.archlinux.org/index.php/Beginners'_Guide
* http://blog.philippbeck.net/linux/archl … s-grub2-69
* http://www.pindarsign.de/webblog/?p=767
* http://vimeo.com/40694871
* http://blog.philippbeck.net/linux/archl … s-grub2-69

and probably more.

Last edited by spotshot6544 (2013-07-18 16:09:29)

Offline

#2 2013-07-18 16:54:54

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [solved] LVM on LUKS tutorial (GPT) / grub problems

If you think grub is the problem, don't use grub. syslinux is braindead simple and Just Works™.

crypto and LVM is, on its own, a trivial setup.

spotshot6544 wrote:

I've been aiming to use GPT since it seems newer.

A lousy reason to decide to use something...

Last edited by falconindy (2013-07-18 17:27:38)

Offline

#3 2013-07-18 23:32:04

spotshot6544
Member
Registered: 2013-07-18
Posts: 9

Re: [solved] LVM on LUKS tutorial (GPT) / grub problems

falconindy wrote:

If you think grub is the problem, don't use grub. syslinux is braindead simple and Just Works™.

crypto and LVM is, on its own, a trivial setup.

spotshot6544 wrote:

I've been aiming to use GPT since it seems newer.

A lousy reason to decide to use something...

In a fight between a lousy reason and no reason at all, a lousy reason wins in my books.

Offline

#4 2013-07-26 21:47:30

Gregosky
Member
From: UK
Registered: 2013-07-26
Posts: 173

Re: [solved] LVM on LUKS tutorial (GPT) / grub problems

I am facing the same problem. I don't want to create new thread to keep forum clean - I described my problem here.

In short words - my grub does not seem to load at all and unfortunately I'm limited to grub as I want to load this virtualbox disk images to linode. I would appreciate any help, thanks!

Offline

#5 2013-07-26 22:30:30

spotshot6544
Member
Registered: 2013-07-18
Posts: 9

Re: [solved] LVM on LUKS tutorial (GPT) / grub problems

So, I am not an expert, I'm barely a beginner, long time linux user, brand new Arch user, but I kept detailed notes on how I finally got it to work. I never posted them because they are notes written by a newb and I don't stand by their quality. But, for what it is worth I will post them here. The notes are also localized for me, some things will be changed depending on where you live etc.

# using archlinux-2013.07.01-dual.iso

pacman -Syy
pacman -S gdisk
# answer y
gdisk /dev/sda
	o
	#answer y
	n
	# enter
	# enter
	+2M
	EF02
	n
	# enter
	# enter
	+200M
	# enter
	n
	# enter
	# enter
	# enter
	# enter
	w
	y
cryptsetup luksFormat /dev/sda3
	YES
	# enter passphrase
	# re-enter passphrase
cryptsetup luksOpen /dev/sda3 lvm
	# enter passphrase
pvcreate /dev/mapper/lvm
vgcreate MyStorage /dev/mapper/lvm
lvcreate -L 7G MyStorage -n rootvol
lvcreate -L 500M MyStorage -n swap
lvcreate -l 100%FREE MyStorage -n homevol
mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/mapper/MyStorage-rootvol
mkfs.ext4 /dev/mapper/MyStorage-homevol
# ignoring swap at the moment
mount /dev/MyStorage/rootvol /mnt
mkdir /mnt/home
mount /dev/MyStorage/homevol /mnt/home
mkdir /mnt/boot
mount /dev/sda2 /mnt/boot
vi /etc/pacman.d/mirrorlist
	/waterloo
	yy
	# mash page up key to the top
	p
	# escape key
	:wq
pacstrap /mnt base
genfstab -U -p /mnt >> /mnt/etc/fstab
arch-chroot /mnt
vi /etc/locale.gen
	/en_CA
	h
	x
	# escape key
	:wq
locale-gen	
echo LANG=en_CA.UTF-8 > /etc/locale.conf
export LANG=en_CA.UTF-8
ln -s /usr/share/zoneinfo/Canada/Eastern /etc/localtime
hwclock --systohc --utc
echo arch > /etc/hostname
ip addr
	# note the network device, in my case it is "enp0s3", it is often "eth0" it is not "lo"
systemctl enable dhcpd@enp0s3.service # enp0s3 from above
vi /etc/mkinitcpio.conf  #make sure this didn't delete the S off HOOKS
	/^HOOKS
	/filesystems
	h
	i
	#spcae
	keymap encrypt lvm2
	#escape key
	:wq
pacman -S grub	
	y
vi /etc/default/grub
	/GRUB_CMDLINE_LINUX=""
	$
	i
	cryptdevice=/dev/sda3:MyStorage
	# escape key
	:wq
grub-install --recheck /dev/sda
mkinitcpio -p linux
grub-mkconfig -o /boot/grub/grub.cfg
	# bunch of warnings about lvmetad, but, I shall ignore
passwd
	# enter password
	# re-enter password
exit
umount /mnt/home /mnt/boot /mnt
reboot

Am not running this "on-the-metal" and I used pretty much the same commands. Though there were a few bumps a long the way. One I remember was with the networking.

Offline

#6 2013-07-26 22:44:46

Gregosky
Member
From: UK
Registered: 2013-07-26
Posts: 173

Re: [solved] LVM on LUKS tutorial (GPT) / grub problems

Great job posting that here! Mine is the same (except lvm) and yet grub hangs on 'Booting...' forever..

Offline

#7 2013-12-08 06:08:00

webdawg
Member
Registered: 2010-12-28
Posts: 62

Re: [solved] LVM on LUKS tutorial (GPT) / grub problems

spotshot6544 wrote:

So, I am not an expert, I'm barely a beginner, long time linux user, brand new Arch user, but I kept detailed notes on how I finally got it to work. I never posted them because they are notes written by a newb and I don't stand by their quality. But, for what it is worth I will post them here. The notes are also localized for me, some things will be changed depending on where you live etc.

I had to log in to say.  Thanks.  Saved me a bit of work.  The wiki is so confusing sometimes anymore.  The set of commands you posted where simple and strait forward and if you understand what you are doing it is all you need to know.

Offline

#8 2014-05-01 23:12:56

tirip
Member
From: Victoria, BC
Registered: 2014-05-01
Posts: 1

Re: [solved] LVM on LUKS tutorial (GPT) / grub problems

I have been tinkering a while with this and that's how it worked for me - firts time Arch install with GPT partition and LVM on LUKS. Btw, its a good idea to also open the two arch webpages mentionned below.

Stup arch with GPT partition and full disk encryption
## Type: LVM on LUKS
## used: archlinux-2014.04.01-dual.iso on USB stick
## https://wiki.archlinux.org/index.php/Beginners%27_Guide
## https://wiki.archlinux.org/index.php/Dm … VM_on_LUKS

sgdisk --zap-all /dev/sda
cgdisk /dev/sda

## create 2 partitions (sda1 with 200mib and 8300 flag and rest of disk sda2 with 8300 flag) and add the ef02 flag to the first 1007 kib
## in all, there should be 3 partitions. Part 3 is the 1mb boot-partition (ef02) for GPT

## Here: sda2 is LUKS encrypted root partition

cryptsetup luksFormat /dev/sda2
cryptsetup open --type luks /dev/sda2 lvm
pvcreate /dev/mapper/lvm
vgcreate MyStorage /dev/mapper/lvm

lvcreate -L 35GB -n rootvol MyStorage
lvcreate -L 2GB -n swapvol MyStorage
lvcreate -l 100%FREE -n homevol MyStorage

mkfs.ext4 /dev/mapper/MyStorage-rootvol
mkfs.ext4 /dev/mapper/MyStorage-homevol
mkswap /dev/mapper/MyStorage-swapvol

mount /dev/MyStorage/rootvol /mnt
mkdir /mnt/home
mount /dev/MyStorage/homevol /mnt/home

## Preparing the boot partition:

mkfs.ext2 /dev/sda1
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot

## back to beginners guide:
## check wireless device

iw dev 
wifi-menu wlp1s0

## run pacstrap script to install base and base-devel system

pacstrap /mnt base base-devel
pacstrap /mnt grub-bios 
genfstab -U -p /mnt > /mnt/etc/fstab

## sanity check

nano /mnt/etc/fstab
arch-chroot /mnt /bin/bash

## remove comment # at language line, e.g., at en_US.UTF-8

nano /etc/locale.gen
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8

## set timezone

ln -s /usr/share/zoneinfo/America/Vancouver /etc/localtime

## set hardware clock

hwclock --systohc --utc
echo archmini > /etc/hostname

## add hostname after second entry

nano /etc/hosts

## insert 'encrypt' and 'lvm2' in hooks before filesystem

nano /etc/mkinitcpio.conf
mkinitcpio -p linux

## change root pw

passwd

## install grub on sda

pacman -S grub
grub-install --target=i386-pc --recheck /dev/sda

## In /etc/default/grub edit the line GRUB_CMDLINE_LINUX_DEFAULT=
## "cryptdevice=/dev/sda2:MyStorage root=/dev/mapper/MyStorage-rootvol quiet"

grub-mkconfig -o /boot/grub/grub.cfg

## Note: Install wireless packages before rebooting: iw wpa_supplicant

pacman -S iw wpa_supplicant
exit
umount -R /mnt
reboot

## you might be greeted by multiple Arch linux grub entries initially (https://bugs.archlinux.org/task/38455?project=1)
## can be resolved with

sudo chmod -x /etc/grub.d/10_archlinux
sudo grub-mkconfig -o /boot/grub/grub.cfg

## or, wait for latest grub which should resolve this issue.

Last edited by tirip (2014-05-05 21:28:02)

Offline

#9 2014-05-02 10:01:11

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [solved] LVM on LUKS tutorial (GPT) / grub problems

When posting configs, code or command output, please use [ code ] tags https://bbs.archlinux.org/help.php#bbcode

like this

It makes the code more readable and - in case of longer listings - more convenient to scroll through.

Offline

Board footer

Powered by FluxBB