# cryptomount fails on boot with dm-crypt volume

## th0th696

I've followed this wiki page:

http://en.gentoo-wiki.com/wiki/Root_filesystem_over_LVM2,_DM-Crypt_and_RAID

However I am not using RAID, the section on grub2 appears to be incomplete, as the wiki page for grub2 here:

http://wiki.gentoo.org/wiki/GRUB2#Booting_from_LUKS_Physical_Volume

implies that you must have:

```
    insmod gzio

   insmod part_gpt

   insmod cryptodisk

   insmod luks

   insmod gcry_twofish

   insmod gcry_sha256

        cryptomount -u <uuid>

   insmod lvm

   insmod ext2

   set root='lvm/<VG>-<LV>'
```

in your menuentry for luks to work, so i've added a file 01_mygrub2 into /etc/grub.d in which I've put:

http://bpaste.net/show/52375/

However, when booting it tells me that cryptomount device is missing, I have double-checked the UUID it is correct, any idea what I can do to please cryptomount?

EDIT:  of note I tried setting cryptomount to 

```

cryptomount (hd0,msdos3)
```

as well using the autocomplete from grub2's edit mode, but pretty much same error:

```
Error: disk (hd0,msdos3) not found
```

but as I said I used the autocomplete so it should be there.  blkid certainly shows it there:

```
/dev/sda3: UUID="6a3603e9-xxxxxx" TYPE="crypto_LUKS" 
```

here is how I enter the crypt using another bootable partition (linux mint):

http://bpaste.net/show/52374/

and the environment is certainly fine there, I can emerge fine and all of that.

Here is the script I used to create the crypt and lvm before hand:

http://bpaste.net/show/52373/

here's the script I used to create the initramfs:

http://bpaste.net/show/52372/

my 'init' can be found here:

http://bpaste.net/show/52371/

emerge --info:

http://bpaste.net/show/52464/

kernel config:

http://bpaste.net/show/52465/

----------

## ribx

just a guess:

/dev/sda3 = (hd0,msdos2)

[EDIT] no, that was wrong sorry! I forgot that I have a /boot partition, but I know remember why  :Wink:  I also tried luks once, but at the end the conclusion was, that its not worth the work for everything outside /home (for me of course).[/EDIT]

----------

## th0th696

Just in case I tried:

cryptomount (hd0,msdos2)

and 

cryptomount (hd0,msdos1)

same odd error about the partition not being found.

Here are the flags I currently have built in grub:

custom-cflags debug device-mapper doc efiemu nls sdl static truetype

and the full eix:

[I] sys-boot/grub

     Available versions:  

	(0)	*0.92-r1 0.94-r1 0.96-r1 0.96-r2 (~)0.96-r3 (~)0.97 0.97-r2 0.97-r3 0.97-r4 0.97-r5 0.97-r6 (~)0.97-r8 0.97-r9 0.97-r10 (~)0.97-r11 0.97-r12 (~)0.97-r13

	(2)	**1.99-r2 **2.00_beta6 (~)2.00-r1 **9999

	{{custom-cflags debug device-mapper doc efiemu libzfs mount ncurses netboot nls sdl static truetype GRUB_PLATFORMS="coreboot efi-32 efi-64 emu ieee1275 multiboot pc qemu qemu-mips yeeloong"}}

     Installed versions:  2.00-r1(2)(09:31:55 10/24/12)(custom-cflags debug device-mapper doc efiemu nls sdl static truetype -libzfs -mount GRUB_PLATFORMS="-coreboot -efi-32 -efi-64 -emu -ieee1275 -multiboot -pc -qemu -qemu-mips -yeeloong")

     Homepage:            http://www.gnu.org/software/grub/

     Description:         GNU GRUB boot loader

I am still stumped here, I have tried everything I can think of, it seems cryptomount is the problem, but I am not certain of that.  Anyone have any suggestions?

----------

## TakChun

I have similar problems.

What might help you is to use no brackets:

grub> cryptomount (hd0,msdos6)

Error: disk (hd0,msdos6) not found

grub> cryptomount hd0,msdos6

Attempting to decrypt master key ...

(Works also from within grub.cfg)

----------

## th0th696

woohoo, getting rid of the parantheses did work at least for cryptomount:

```
cryptomount hd0,msdos3 

Attempting to decrypt master key ... 
```

however, it does bork right after that with:

```
error invalid file name: root=/dev/mapper/vg-root
```

which is I'm assuming the linux kernel line firing off:

```
root=/dev/mapper/vg-root
```

perhaps it's the earlier line in grub.cfg that is obfuscating this issue by not loading the lvm properly:

```
set root='lvm/vg-root'
```

I'm going to try altering those with some obvious values, btw so far I've tried 

```
set root='lvm/vg'

set root='lvm/vault'
```

  any suggestions are very welcome.  And thanks again TakChun!!!  good catch, I'll have to fill out a bug report on grub2 as I think the auto-fill was at fault here.

bug:

https://savannah.gnu.org/bugs/index.php?37644

btw: vg is the name of the VG as it appears in vgdisplay:

http://bpaste.net/show/54095/

----------

