View previous topic :: View next topic |
Author |
Message |
kwesadilo n00b
Joined: 12 Jul 2010 Posts: 68 Location: United States
|
Posted: Sun Apr 20, 2014 10:14 pm Post subject: Root FS on LVM over LUKS, no intramfs, hangs on boot[solved] |
|
|
I'm trying to set up a new install where my root filesystem is on LVM on top of LUKS, and I don't have a separate boot. I'm using GRUB2 as my bootloader. I don't have an initramfs right now, and it seems like it's really close to working. I'm wondering whether I can get away without an initramfs or whether I will still need one.
Here is my storage device/virtual device layout (apologies for the ugly formatting):
Code: | _ SSD
|_ ESP
| |_ /boot/efi
|
|_ dmcrypt
|_ LVM (vgssd-rootfs)
|_ /
_ HDD
|_ dmcrypt
|_ LVM (vghdd-home)
|_ /home
| If you couldn't tell, I'm using UEFI.
Although documentation on how to use GRUB2 with /boot on LVM or LUKS is scarce (nevermind documentation on booting from both of them together), it was ultimately fairly simple to get grub2-install to be happy and install in my ESP without complaining that it couldn't talk to UEFI or that it wouldn't be able to boot from my LUKS/LVM root partition. My current situation is that when I boot, GRUB prompts me for my LUKS passphrase, and then shows me the boot menu. I select my Gentoo setup. GRUB prints out
Code: | Loading Linux 3.12.3-gentoo ... | and then my computer becomes unresponsive. The last line in my grub.cfg before that printout is
Code: | linux /boot/kernel-3.12.3-gentoo root=/dev/mapper/vgssd-root ro | If I interrupt GRUB after entering my passphrase and go into the GRUB shell, I can step through the commands for this menu entry up until this point. I give the linux command and then the boot command and then hang as before. While still in the GRUB2 shell, I can see that my rootfs is mounted, and I can see, for instance, my kernel at /boot/kernel-3.12.3-gentoo. However, /dev only has the default files. In particular, /dev/mapper/vgssd-root is absent.
My intuition is that the root parameter has to actually exist when I boot linux. But I have already mounted that filesystem in GRUB. Is there any way that Linux can just work off of that until it gets far enough along in init to handle its own mounts? Can GRUB make use of udev or something to populate /dev? Or do I have to break down and make an initramfs to map my virtual devices for the kernel before it starts?
If it helps, here are my /etc/default/grub: Code: | # Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/files/grub.default-2,v 1.4 2013/09/21 18:10:55 floppym Exp $
#
# To populate all changes in this file you need to regenerate your
# grub configuration file afterwards:
# 'grub2-mkconfig -o /boot/grub/grub.cfg'
#
# See the grub info page for documentation on possible variables and
# their associated values.
GRUB_DISTRIBUTOR="Gentoo"
GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
# Append parameters to the linux kernel command line
# GRUB_CMDLINE_LINUX=""
# Append parameters to the linux kernel command line for non-recovery entries
#GRUB_CMDLINE_LINUX_DEFAULT=""
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
# The resolution used on graphical terminal.
# Note that you can use only modes which your graphic card supports via VBE.
# You can see them in real GRUB with the command `vbeinfo'.
#GRUB_GFXMODE=640x480
# Path to theme spec txt file.
# The starfield is by default provided with use truetype.
# NOTE: when enabling custom theme, ensure you have required font/etc.
#GRUB_THEME="/boot/grub/themes/starfield/theme.txt"
# Background image used on graphical terminal.
# Can be in various bitmap formats.
#GRUB_BACKGROUND="/boot/grub/mybackground.png"
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY=true
GRUB_PRELOAD_MODULES=lvm
GRUB_CRYPTODISK_ENABLE=y | and /boot/grub/grub.cfg: Code: | #
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
insmod lvm
if [ -s $prefix/grubenv ]; then
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="0"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
if loadfont unicode ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_US
insmod gettext
fi
terminal_output gfxterm
if sleep --interruptible 0 ; then
set timeout=10
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-517b41ec-7cb4-4fcd-8755-b3e5226a7432' {
load_video
insmod gzio
insmod part_gpt
insmod cryptodisk
insmod luks
insmod gcry_rijndael
insmod gcry_rijndael
insmod gcry_sha1
insmod gcry_sha256
insmod lvm
insmod ext2
set root='lvm/vgssd-root'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='lvm/vgssd-root' 517b41ec-7cb4-4fcd-8755-b3e5226a7432
else
search --no-floppy --fs-uuid --set=root 517b41ec-7cb4-4fcd-8755-b3e5226a7432
fi
echo 'Loading Linux 3.12.3-gentoo ...'
linux /boot/kernel-3.12.3-gentoo root=/dev/mapper/vgssd-root ro
}
submenu 'Advanced options for Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-517b41ec-7cb4-4fcd-8755-b3e5226a7432' {
menuentry 'Gentoo GNU/Linux, with Linux 3.12.3-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.12.3-gentoo-advanced-517b41ec-7cb4-4fcd-8755-b3e5226a7432' {
load_video
insmod gzio
insmod part_gpt
insmod cryptodisk
insmod luks
insmod gcry_rijndael
insmod gcry_rijndael
insmod gcry_sha1
insmod gcry_sha256
insmod lvm
insmod ext2
set root='lvm/vgssd-root'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='lvm/vgssd-root' 517b41ec-7cb4-4fcd-8755-b3e5226a7432
else
search --no-floppy --fs-uuid --set=root 517b41ec-7cb4-4fcd-8755-b3e5226a7432
fi
echo 'Loading Linux 3.12.3-gentoo ...'
linux /boot/kernel-3.12.3-gentoo root=/dev/mapper/vgssd-root ro
}
menuentry 'Gentoo GNU/Linux, with Linux 3.12.3-gentoo (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.12.3-gentoo-recovery-517b41ec-7cb4-4fcd-8755-b3e5226a7432' {
load_video
insmod gzio
insmod part_gpt
insmod cryptodisk
insmod luks
insmod gcry_rijndael
insmod gcry_rijndael
insmod gcry_sha1
insmod gcry_sha256
insmod lvm
insmod ext2
set root='lvm/vgssd-root'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='lvm/vgssd-root' 517b41ec-7cb4-4fcd-8755-b3e5226a7432
else
search --no-floppy --fs-uuid --set=root 517b41ec-7cb4-4fcd-8755-b3e5226a7432
fi
echo 'Loading Linux 3.12.3-gentoo ...'
linux /boot/kernel-3.12.3-gentoo root=/dev/mapper/vgssd-root ro single
}
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ### |
Last edited by kwesadilo on Sun Apr 20, 2014 10:28 pm; edited 1 time in total |
|
Back to top |
|
|
kwesadilo n00b
Joined: 12 Jul 2010 Posts: 68 Location: United States
|
Posted: Sun Apr 20, 2014 10:28 pm Post subject: D'oh! |
|
|
OK, so I just found this guy with my exact same situation, and the response to him was that he needed an initramfs. So I guess I'll do that. Sorry to bother you guys.
I'm still curious, though: If I need an initramfs in this situation, why don't I need one (I think) if my root is just a normal partition (not LVM or LUKS)? How does the kernel get to (say) /dev/sda1 if /dev isn't mounted? |
|
Back to top |
|
|
|
|
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
|
|