LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 09-16-2012, 08:15 AM   #1
funboy
Member
 
Registered: Jul 2011
Posts: 49

Rep: Reputation: Disabled
Crypted root on LVM does not boot


Hello guys,

I encrypted my hdd leaving only one partition unencrypted for /boot - the other partition is for LVM. In it I create some logical volumes (one for root).
I configured lilo and everything looks great lilo starts but I've received an error that the system is unable to mount root fs - kernel panic. After short investigation I found - the volume group in which is the logical volume for root fs is not activated during boot time!
I thinks that this is the major reason that my slack doesn't start. In addition the fs on the logival volumes is ext4.

Any ideas how to force the volume group to be activated during boot time or the issue is somewhere else ?

Last edited by funboy; 09-16-2012 at 08:17 AM.
 
Old 09-16-2012, 08:48 AM   #2
mrascii
Member
 
Registered: Jun 2012
Location: on the Net
Distribution: Slackware
Posts: 100

Rep: Reputation: Disabled
Your /etc/fstab file should look like this:

Code:
/dev/cryptvg/swap swap             swap        defaults         0   0
/dev/cryptvg/root /                ext4        defaults         1   1
/dev/cryptvg/home /home            ext4        defaults         1   2
/dev/sda1        /boot            ext4        defaults         1   2
Make sure lilo.conf shows the correct root partition to boot. Also, make sure you run the mkinitrd command in README_CRYPT.TXT and not the one in UPGRADE.TXT. Follow the instructions in the crypt readme and you should have no problems.

DNA
AKA mrascii

Last edited by mrascii; 09-16-2012 at 03:31 PM. Reason: Editted for clarity.
 
Old 09-16-2012, 12:21 PM   #3
Slackovado
Member
 
Registered: Mar 2005
Location: Burnaby, BC, Canada
Distribution: Slackware 14 32bit, Debian, Arch
Posts: 213

Rep: Reputation: 27
Are you loading the module for ext4 in your mkinitrd?
 
Old 09-16-2012, 07:04 PM   #4
TommyC7
Member
 
Registered: Mar 2012
Distribution: Slackware, CentOS, OpenBSD, FreeBSD
Posts: 436

Rep: Reputation: Disabled
Make sure your initrd has the modules that it requires for accessing your root partition. The important keyword is "module" here. If the ext4 module is built-in as the huge kernel has, then you cannot access the root partition. It must be built as a module in order to allow your initrd to use it.
 
Old 09-16-2012, 07:40 PM   #5
fdeak
LQ Newbie
 
Registered: Jan 2007
Distribution: Slackware-14.0, Slackware-current
Posts: 21

Rep: Reputation: 2
Quote:
Originally Posted by TommyC7 View Post
Make sure your initrd has the modules that it requires for accessing your root partition. The important keyword is "module" here. If the ext4 module is built-in as the huge kernel has, then you cannot access the root partition. It must be built as a module in order to allow your initrd to use it.
It's false, ext4 could be built-in to the kernel (not module), I have root (/) on a LUKS+LVM setup and it can be booted with slackware's huge kernel. But generally true you need the appropriate modules in the initrd.

Try to use '/usr/share/mkinitrd/mkinitrd_command_generator.sh' to create a good initrd. Try to use the interactive mode with the '-i' option first!

Feel free to ask, if you have no success, I use this kind of setup on my machines.

fdeak
 
Old 09-16-2012, 07:48 PM   #6
fdeak
LQ Newbie
 
Registered: Jan 2007
Distribution: Slackware-14.0, Slackware-current
Posts: 21

Rep: Reputation: 2
By the way, have you read the file README_CRYPT.TXT? This is on the root of the install CD/DVD.
Read at least from 'Combining LUKS and LVM' (somewhere around line 361 in slack-13.37).

fdeak
 
Old 09-17-2012, 02:57 PM   #7
funboy
Member
 
Registered: Jul 2011
Posts: 49

Original Poster
Rep: Reputation: Disabled
Yes, I've read the Combining LUKS and LVM section of this document. Actually I did:
mkinitrd -c -k 2.6.37.6-smp -m ext4 -f ext4 -r /dev/cryptvg/root -C
I mounted the crypted volume and correct the settings without reinstalling.
Which are the needed modules for the kernel at the boot time to detect this?
 
Old 09-17-2012, 03:01 PM   #8
TommyC7
Member
 
Registered: Mar 2012
Distribution: Slackware, CentOS, OpenBSD, FreeBSD
Posts: 436

Rep: Reputation: Disabled
Try using:
Code:
/usr/share/mkinitrd/mkinitrd_command_generator.sh -i
That will take you step by step for what options you need or want.
 
1 members found this post helpful.
Old 09-17-2012, 03:02 PM   #9
BlackRider
Member
 
Registered: Aug 2011
Distribution: Slackware
Posts: 261

Rep: Reputation: 82
You need to append the device list you want to unlock after the "-C" parameter.

You also forgot the -L option to load LVM.

Read the man page of mkinitrd for details.

Last edited by BlackRider; 09-17-2012 at 03:12 PM.
 
Old 09-17-2012, 03:43 PM   #10
funboy
Member
 
Registered: Jul 2011
Posts: 49

Original Poster
Rep: Reputation: Disabled
###Update
I've used /usr/share/mkinitrd/mkinitrd_command_generator.sh with -i but with no success. Still I can't boot.
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block.
 
Old 09-17-2012, 03:47 PM   #11
funboy
Member
 
Registered: Jul 2011
Posts: 49

Original Poster
Rep: Reputation: Disabled
This is the command from previous post:
mkinitrd -c -k 2.6.33.4-smp -m ext4 -f ext4 -r /dev/cryptvg/root -C /dev/sda2 -L
When I executed the script it show me -m and there is module for ext4 fs. When it make initrd.gz I copied into /dev/sda1
Is it neccesary to copy initrd-tree and the map file or only the initrd.gz to /dev/sda1 ?
 
Old 09-17-2012, 05:07 PM   #12
TommyC7
Member
 
Registered: Mar 2012
Distribution: Slackware, CentOS, OpenBSD, FreeBSD
Posts: 436

Rep: Reputation: Disabled
Are you sure you used:
Code:
/usr/share/mkinitrd/mkinitrd -i
I ask because it comes with a -o option for output which is usually /boot/initrd-whatever.gz.
 
Old 09-17-2012, 05:31 PM   #13
BlackRider
Member
 
Registered: Aug 2011
Distribution: Slackware
Posts: 261

Rep: Reputation: 82
Quote:
Is it neccesary to copy initrd-tree and the map file or only the initrd.gz to /dev/sda1 ?
The initrd-tree is not required, as it is only a side product of the creation of the initrd (in fact, what mkinitrd does is to build a little boot OS in initrd-tree and then compress it to initrd.gz, so it can be decompressed at boot).

Ensure your / filesystem is sane by running fsck from rescue media. I don't think the problem is there, but who knows.

Ensure you use the default mount options for / in /etc/fstab (some weird options can render the / filesystem unbootable in practice)

Ensure "/dev/cryptvg/root" is the device where / is hosted in fact (i.e: you haven't made a typo.)

Then try with "mkinitrd -c -k 2.6.33.4-smp -m ext4 -f ext4 -C /dev/sda2 -r /dev/sda2 -L"

Ensure LILO loads the initrd, or the system will halt at boot (you have added an initrd entry, don't you?)

Notes: hibernation will be surely disabled in your system unless further changes are made to Lilo or the initrd.

Last edited by BlackRider; 09-17-2012 at 05:35 PM.
 
Old 09-17-2012, 06:20 PM   #14
funboy
Member
 
Registered: Jul 2011
Posts: 49

Original Poster
Rep: Reputation: Disabled
Root partition is on volume group: cryptvg
LV Name /dev/cryptvg/root
at /etc/lilo.conf

image = /boot/vmlinuz
root = /dev/cryptvg/root
label = Slackbox
read-only

When the script ask me for the LUKS root device - I said that this is my crypted partition (dev/sda2) - here I have some doubts
the modules are default jbd2:mbcache:ext4
Also I'm using UDEV in the initrd for device configuration.
The output from the script is:

mkinitrd -c -k 2.6.37.6-smp -f ext4 -r /dev/cryptvg/root -m jbd2:mbcache:ext4 -C /dev/sda2 -L -u -w 10 -o /boot/initrd.gz

Because I chroot-ed the my /mnt/cryptslack I copied the generated initrd.gz to the first unencripted partition - /dev/sda1 - where is actually my lilo bootloader.
When I run lilo I recieve one:
Fatal: Linux experimental device 0x04x needs to be defined

And when it crash when boot it hates me with:
Please append a correct "root= " boot option; here are the available partitions:
<partitions> and then Kernel Panic - Unable to mount root fs
 
Old 09-17-2012, 07:13 PM   #15
mrascii
Member
 
Registered: Jun 2012
Location: on the Net
Distribution: Slackware
Posts: 100

Rep: Reputation: Disabled
Quote:
Originally Posted by funboy View Post
This is the command from previous post:
mkinitrd -c -k 2.6.33.4-smp -m ext4 -f ext4 -r /dev/cryptvg/root -C /dev/sda2 -L
When I executed the script it show me -m and there is module for ext4 fs. When it make initrd.gz I copied into /dev/sda1
Is it neccesary to copy initrd-tree and the map file or only the initrd.gz to /dev/sda1 ?
I've installed Slackware following the instructions in README_CRYPT.TXT dozens of times. If you follow the instructions for creating the LUKS partition and the LVM volumes you will be successful. HOWEVER, you need to edit the mkinitrd command and substitute the kernel version you are running. For example, the current kernel is 3.2.28 so that would replace 2.6.33.4-smp in the command above. Run uname -r after chrooting in to /mnt to check which kernel you have.

If you did the full install as recommended you will have everything you need to built initrd.gz. This initrd.gz will work for the huge as well as the generic kernel. Booting the huge kernel will show a couple of harmless (well, mostly harmless ) errors when it tries to load duplicate modules.

DNA
AKA mrascii

Last edited by mrascii; 09-17-2012 at 07:15 PM. Reason: Minor correction
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
extend crypted lvm volume imitis Linux - General 4 06-12-2010 06:55 AM
vmware slackware13 guest with lvm root -> no boot :-( cosmonate Slackware 2 11-17-2009 06:04 AM
Setup slack13 over 2 dm-crypted lvm hdds carlitoco Slackware 4 09-24-2009 02:18 PM
Problem with crypted LVM after Debian installation setkos Linux - Newbie 7 12-28-2008 06:30 AM
dm-crypted root with filesystem checking /y0shi Slackware 3 02-16-2008 06:55 AM


All times are GMT -5. The time now is 07:39 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration