Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Please help, luks + lvm, device not found at startup
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Lexar
n00b
n00b


Joined: 23 Jul 2012
Posts: 2

PostPosted: Mon Jul 23, 2012 7:26 pm    Post subject: Please help, luks + lvm, device not found at startup Reply with quote

Hi! I'm new in this forum! First of all, sorry about my english, I don't speak english. I will talk as good as possible.

Let's get straight with my problem: I was trying to install gentoo encrypting my root, I have the next partition scheme

/dev/sda3 --> /boot
/dev/sda4 --> dm_crypt --> /dev/mapper/genluks

/dev/mapper/genluks --> pvcreate --> vgcreate --> /dev/mapper/gencrypt (LVM)

dev/mapper/gencrypt
|
--------> /dev/mapper/gencrypt-root --> /
--------> /dev/mapper/gencrypt-swap --> swap

The problem that I have is that when I want to start the machine I get an error, something like "can not mount device in read-only", an after that I get a beautiful kernel panic. Here is my init:

Code:

#!/bin/sh

mount -t proc none /proc
CMDLINE=`cat /proc/cmdline`
mount -t sysfs none /sys
sleep 4

#rescue function
rescata() {
        echo "Shell al cante"
   busybox --install -s
   exec /bin/sh
}

loadkmap < /etc/kmap-es


/bin/cryptsetup luksOpen /dev/sda4 genluks || rescata()
/bin/lvm vgscan
/bin/lvm vgchange -ay gencrypt

mount -r /dev/mapper/gencrypt-root /newroot

umount /sys
umount /proc

exec /bin/busybox switch_root /newroot /sbin/init ${CMDLINE}


At first I thought that it was a problem calling cryptsetup, because I din't get any prompot asking for a password, so I decided to put a rescue funtion and I dindn't get any error. I don't know what is happening, so PLEASE HELP!

Here is my kernel (gentoo-hardenerd-3.4.2-r1) .config:
http://pastebin.com/YHRd50CZ

lspci -n:
Code:

00:00.0 0600: 8086:0044 (rev 02)
00:01.0 0604: 8086:0045 (rev 02)
00:16.0 0780: 8086:3b64 (rev 06)
00:1a.0 0c03: 8086:3b3c (rev 05)
00:1b.0 0403: 8086:3b56 (rev 05)
00:1c.0 0604: 8086:3b42 (rev 05)
00:1c.1 0604: 8086:3b44 (rev 05)
00:1c.2 0604: 8086:3b46 (rev 05)
00:1c.3 0604: 8086:3b48 (rev 05)
00:1c.4 0604: 8086:3b4a (rev 05)
00:1c.5 0604: 8086:3b4c (rev 05)
00:1d.0 0c03: 8086:3b34 (rev 05)
00:1e.0 0604: 8086:2448 (rev a5)
00:1f.0 0601: 8086:3b09 (rev 05)
00:1f.2 0106: 8086:3b29 (rev 05)
00:1f.3 0c05: 8086:3b30 (rev 05)
01:00.0 0300: 10de:0a29 (rev a2)
01:00.1 0403: 10de:0be2 (rev a1)
07:00.0 0280: 10ec:8172 (rev 10)
0c:00.0 0200: 10ec:8168 (rev 03)
16:00.0 0880: 197b:2382 (rev 20)
16:00.2 0805: 197b:2381 (rev 20)
16:00.3 0880: 197b:2383 (rev 20)
16:00.4 0880: 197b:2384 (rev 20)
ff:00.0 0600: 8086:2c62 (rev 02)
ff:00.1 0600: 8086:2d01 (rev 02)
ff:02.0 0600: 8086:2d10 (rev 02)
ff:02.1 0600: 8086:2d11 (rev 02)
ff:02.2 0600: 8086:2d12 (rev 02)
ff:02.3 0600: 8086:2d13 (rev 02)


!PLEASE HELP!
_________________
--Error 404: Democracy Not Found
Back to top
View user's profile Send private message
djdunn
l33t
l33t


Joined: 26 Dec 2004
Posts: 780
Location: Arrakis

PostPosted: Mon Jul 23, 2012 8:30 pm    Post subject: Reply with quote

here is how i do it with grub version < 2

I would suggest you use genkernel. you will probably need to change some useflags to use genkernel add some statics to them but it will tell you if you need to.

you would want to do first mount /boot if you need to then

Code:
genkernel --luks --lvm --keymap --mdadm --install initramfs


that will provide you with a good initramfs

then you need to edit grub.conf

here is what mine looks like

Code:
title Gentoo Linux
root (hd0,0)
kernel /boot/vmlinuz init=/linuxrc crypt_root=/dev/md127 real_root=/dev/mapper/vg-root rootfstype=ext4 dolvm domdadm keymap=dvorak
initrd /boot/initramfs

_________________
A process cannot be understood by stopping it. Understanding must move with the flow of the process, must join it and flow with it.

-The First Law of Mentat


Last edited by djdunn on Mon Jul 23, 2012 8:39 pm; edited 1 time in total
Back to top
View user's profile Send private message
olek
Apprentice
Apprentice


Joined: 22 Oct 2011
Posts: 173

PostPosted: Mon Jul 23, 2012 8:37 pm    Post subject: Reply with quote

Maybe, your naming-scheme is different on boot than it was when creating the partition-scheme, so sda refers not to the right disk.
Are the tools in your initramfs built with USE="static"?
_________________
https://plaintext.blog
Back to top
View user's profile Send private message
cach0rr0
Bodhisattva
Bodhisattva


Joined: 13 Nov 2008
Posts: 4123
Location: Houston, Republic of Texas

PostPosted: Tue Jul 24, 2012 5:20 am    Post subject: Reply with quote

did you copy the device node for sda4 into the initramfs structure?

Code:

# CONFIG_DEVTMPFS is not set


I would *highly* recommend you enable devtmpfs, and either also enable the automount feature in the kernel, or, put a line into 'init' that does a devtmpfs mount. That should give you the device nodes you need in order to luksOpen. You could simply be missing device nodes. From there, vgscan should pick up your luks volume

genkernel or other automated tools should not necessarily be necessary.

You seem to have most of the bits covered off, but I put this together which might be worth a look (if this link is broken, my apologies, i have a dying hard disk!)
_________________
Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash
Back to top
View user's profile Send private message
Lexar
n00b
n00b


Joined: 23 Jul 2012
Posts: 2

PostPosted: Fri Jul 27, 2012 6:39 pm    Post subject: Reply with quote

olek: Thank you for answering, but the naming scheme is the same, I sure of that an yes y used the "static" flag

djdunn: That would maybe work but I prefer to do everything by my own, without using genkernel, and I would like to know what I've done bad. One question, is mdamd necessary, whitout using RAID? I think that:
Code:

genkernel --luks --lvm --keymap --install initramfs

will just work. Thank you too for answering all the ways :)

cach0rr0: Yes, I copied. I set CONFIG_DEVTMPFS=y, and I recompiled my kernel (ohh I have just remembered that I dind't enable CONFIG_AUTOFS4_FS, ups :( hahaha ). I took a look at your guide (which I recommend to everyone who was trying to do the same as me) and I think I'm doing everything fine, but it still not working. I don't know what is happening, I also think that the problem is related with the device nodes, because it's obvious that cryptsetup can't find /dev/sda4. I will try to make a fresh installetion, because I must have missed something. I will tell you :)

And thank you everyone.
_________________
--Error 404: Democracy Not Found
Back to top
View user's profile Send private message
cach0rr0
Bodhisattva
Bodhisattva


Joined: 13 Nov 2008
Posts: 4123
Location: Houston, Republic of Texas

PostPosted: Sat Jul 28, 2012 4:12 am    Post subject: Reply with quote

Lexar wrote:

cach0rr0: Yes, I copied. I set CONFIG_DEVTMPFS=y, and I recompiled my kernel (ohh I have just remembered that I dind't enable CONFIG_AUTOFS4_FS, ups :( hahaha ). .


after you made this change to the kernel, did you edit 'init' and add a 'mount' line to mount the devtmpfs? After doing this you will have needed to recreate your initramfs (to include the new/modified init), copied the new initramfs to /boot, copied the new kernel to /boot, and so forth

the line in init would be before you luksOpen or anything

Code:

mount -t devtmpfs none /dev


so your modified init would be something like:

Code:

#!/bin/sh

mount -t proc none /proc
CMDLINE=`cat /proc/cmdline`
mount -t sysfs none /sys
mount -t devtmpfs none /dev
sleep 4

#rescue function
rescata() {
        echo "Shell al cante"
   busybox --install -s
   exec /bin/sh
}

loadkmap < /etc/kmap-es


/bin/cryptsetup luksOpen /dev/sda4 genluks || rescata()
/bin/lvm vgscan
/bin/lvm vgchange -ay gencrypt

mount -r /dev/mapper/gencrypt-root /newroot

umount /sys
umount /proc

exec /bin/busybox switch_root /newroot /sbin/init ${CMDLINE}


note line 6 above.
_________________
Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum