You are not logged in.

#1 2015-09-01 02:17:15

YaourtYogurt
Member
Registered: 2015-09-01
Posts: 11

Boot issues with LVM on LUKS and GRUB2

Hello all!  I recently switched to Arch Linux and I'm wondering why I didn't switch sooner.

I'm trying to resolve a boot issue.  I configured my Arch install according to the instructions on https://wiki.archlinux.org/index.php/Dm … VM_on_LUKS,
so I have two physical partitions on /dev/sda:

Model: ATA SAMSUNG SSD PM85 (scsi)
Disk /dev/sda: 256GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End    Size   File system  Name  Flags
1      1049kB  513MB  512MB  fat32              boot, esp
2      513MB   256GB  256GB

where /dev/sda1 is the boot partition and has GRUB 2 installed on it,
and /dev/sda2 is a LUKS volume containing an LVM with a root, home, and swap volume.

Whenever I try to boot to Arch, I am greeted by this:

ERROR: device 'UUID=1d3b056f-cf26-46ce-8c6e-e730456152b0' not found.  Skipping fsck.
ERROR: Unable to find root device 'UUID=1d3b056f-cf26-46ce-8c6e-e730456152b0'.
You are being dropped to a recovery shell.
    Type 'exit' to try and continue booting.
sh: can't access tty: job control turned off
[rootfs /]#

at which point I do:

[rootfs /]# cryptsetup open --type luks /dev/sda2 lvm
Enter passphrase for /dev/sda2:
[rootfs /]# exit

at which point my system boots successfully.

Since dropping to the recovery shell is annoying and wastes precious seconds, how do I correctly configure GRUB to try opening /dev/sda2 and prompting me for a password?

Last edited by YaourtYogurt (2015-09-01 02:18:00)

Offline

#2 2015-09-01 06:53:28

Algernop
Member
Registered: 2014-01-17
Posts: 33

Re: Boot issues with LVM on LUKS and GRUB2

Is that UUID actually the right one? What does your grub configuration look like? If that is on the level, which hooks have you selected in /etc/mkinitcpio.conf?

Last edited by Algernop (2015-09-01 06:59:51)

Offline

#3 2015-09-01 07:37:37

bmorris22
Member
Registered: 2015-08-31
Posts: 1

Re: Boot issues with LVM on LUKS and GRUB2

Maybe try updating the grub.cfg. GRUB may not recognize the UUID of /dev/sda2.

taken from: https://bbs.archlinux.org/viewtopic.php … 4#p1294604

Pop in your Arch live media (cd/dvd/usb/whathaveyou)

mount /dev/sda1 /mnt
arch-chroot /mnt
grub-mkconfig -o /boot/grub/grub.cfg
exit
umount /mnt
reboot

Last edited by bmorris22 (2015-09-01 07:38:44)

Offline

#4 2015-09-01 16:33:09

YaourtYogurt
Member
Registered: 2015-09-01
Posts: 11

Re: Boot issues with LVM on LUKS and GRUB2

Here's my /etc/default/grub:

GRUB_DEFAULT=0
GRUB_TIMEOUT=2
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable Hidden Menu, and optionally hide the timeout count
#GRUB_HIDDEN_TIMEOUT=5
#GRUB_HIDDEN_TIMEOUT_QUIET=true

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=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=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
#GRUB_COLOR_NORMAL="light-blue/black"
#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/path/to/wallpaper"
#GRUB_THEME="/path/to/gfxtheme"

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

#GRUB_SAVEDEFAULT="true"

# Parameters added to accomodate root, swap, and home encryption.
# These were set based on the guide at https://wiki.archlinux.org/index.php/Dm … filesystem
# as of 2015-08-28;12:08:00
cryptdevice=/dev/sda2:MyStorage root=/dev/mapper/MyStorage-rootvol resume=/dev/mapper/MyStorage-swapvol

Here's my /boot/grub/grub.cfg:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
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_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=2
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=2
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-1d3b056f-cf26-46ce-8c6e-e730456152b0' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_gpt
    insmod fat
    set root='hd0,gpt1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  AAB4-060D
    else
      search --no-floppy --fs-uuid --set=root AAB4-060D
    fi
    echo    'Loading Linux linux ...'
    linux    /vmlinuz-linux root=UUID=1d3b056f-cf26-46ce-8c6e-e730456152b0 rw  quiet
    echo    'Loading initial ramdisk ...'
    initrd     /initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-1d3b056f-cf26-46ce-8c6e-e730456152b0' {
    menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-1d3b056f-cf26-46ce-8c6e-e730456152b0' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod fat
        set root='hd0,gpt1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  AAB4-060D
        else
          search --no-floppy --fs-uuid --set=root AAB4-060D
        fi
        echo    'Loading Linux linux ...'
        linux    /vmlinuz-linux root=UUID=1d3b056f-cf26-46ce-8c6e-e730456152b0 rw  quiet
        echo    'Loading initial ramdisk ...'
        initrd     /initramfs-linux.img
    }
    menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-1d3b056f-cf26-46ce-8c6e-e730456152b0' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod fat
        set root='hd0,gpt1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  AAB4-060D
        else
          search --no-floppy --fs-uuid --set=root AAB4-060D
        fi
        echo    'Loading Linux linux ...'
        linux    /vmlinuz-linux root=UUID=1d3b056f-cf26-46ce-8c6e-e730456152b0 rw  quiet
        echo    'Loading initial ramdisk ...'
        initrd     /initramfs-linux-fallback.img
    }
}

### 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 ###

### BEGIN /etc/grub.d/60_memtest86+ ###
### END /etc/grub.d/60_memtest86+ ###

Here's my /etc/mkinitcpio.conf:

# vim:set ft=sh
# MODULES
# The following modules are loaded before any boot hooks are
# run.  Advanced users may wish to specify all system modules
# in this array.  For instance:
#     MODULES="piix ide_disk reiserfs"
MODULES=""

# BINARIES
# This setting includes any additional binaries a given user may
# wish into the CPIO image.  This is run last, so it may be used to
# override the actual binaries included by a given hook
# BINARIES are dependency parsed, so you may safely ignore libraries
BINARIES=""

# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in any way.  This is useful for config files.
FILES=""

# HOOKS
# This is the most important setting in this file.  The HOOKS control the
# modules and scripts added to the image, and what happens at boot time.
# Order is important, and it is recommended that you do not change the
# order in which HOOKS are added.  Run 'mkinitcpio -H <hook name>' for
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
# 'udev' is _required_ in order to automatically load modules
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
##   This setup specifies all modules in the MODULES setting above.
##   No raid, lvm2, or encrypted root is needed.
#    HOOKS="base"
#
##   This setup will autodetect all modules for your system and should
##   work as a sane default
#    HOOKS="base udev autodetect block filesystems"
#
##   This setup will generate a 'full' image which supports most systems.
##   No autodetection is done.
#    HOOKS="base udev block filesystems"
#
##   This setup assembles a pata mdadm array with an encrypted root FS.
##   Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
#    HOOKS="base udev block mdadm encrypt filesystems"
#
##   This setup loads an lvm2 volume group on a usb device.
#    HOOKS="base udev block lvm2 filesystems"
#
##   NOTE: If you have /usr on a separate partition, you MUST include the
#    usr, fsck and shutdown hooks.
HOOKS="base udev encrypt lvm2 autodetect modconf block filesystems keyboard fsck"

# COMPRESSION
# Use this to compress the initramfs image. By default, gzip compression
# is used. Use 'cat' to create an uncompressed image.
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
#COMPRESSION="xz"
#COMPRESSION="lzop"
#COMPRESSION="lz4"

# COMPRESSION_OPTIONS
# Additional options for the compressor
#COMPRESSION_OPTIONS=""

Here's /etc/fstab;

# /dev/mapper/MyStorage-rootvol
UUID=1d3b056f-cf26-46ce-8c6e-e730456152b0    /             ext4          rw,relatime,data=ordered0 1

# /dev/mapper/MyStorage-homevol
UUID=167280a4-937a-4546-9abc-1831faee5aae    /home         ext4          rw,relatime,data=ordered0 2

# /dev/sda1
UUID=AAB4-060D          /boot         vfat          rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro    0 2

# /dev/mapper/MyStorage-swapvol
UUID=008399d2-ec36-4384-a16c-b0159c1466f4    none          swap          defaults      0 0

and /etc/crypttab:

# crypttab: mappings for encrypted partitions
#
# Each mapped device will be created in /dev/mapper, so your /etc/fstab
# should use the /dev/mapper/<name> paths for encrypted devices.
#
# The Arch specific syntax has been deprecated, see crypttab(5) for the
# new supported syntax.
#
# NOTE: Do not list your root (/) partition here, it must be set up
#       beforehand by the initramfs (/etc/mkinitcpio.conf).

# <name>       <device>                                     <password>              <options>
# home         UUID=b8ad5c18-f445-495d-9095-c9ec4f9d2f37    /etc/mypassword1
# data1        /dev/sda3                                    /etc/mypassword2
# data2        /dev/sda5                                    /etc/cryptfs.key
# swap         /dev/sdx4                                    /dev/urandom            swap,cipher=aes-cbc-essiv:sha256,size=256
# vol          /dev/sdb7                                    none

Offline

#5 2015-09-01 16:55:26

Elderon
Member
Registered: 2013-08-20
Posts: 14

Re: Boot issues with LVM on LUKS and GRUB2

You didn't configure the bootloader (https://wiki.archlinux.org/index.php/Dm … oot_loader at all and have unnecessary /etc/crypttab entries for home and swap if I understand your configuration correctly.

Edit:
I've just notice that you actually  tried to configure the bootloader but in wrong way, read the following link to see where you should add your kernel parameters:
https://wiki.archlinux.org/index.php/GR … _partition

Last edited by Elderon (2015-09-01 17:10:51)

Offline

#6 2015-09-01 17:25:13

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: Boot issues with LVM on LUKS and GRUB2

Welcome to the forums YaourtYogurt. Please use [ code ] tags instead of quotes for sharing the content of config. Thanks, and good luck. smile


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#7 2015-09-01 18:59:31

boban_dj
Member
Registered: 2015-03-17
Posts: 150

Re: Boot issues with LVM on LUKS and GRUB2

Maybe this thread will be of help https://bbs.archlinux.org/viewtopic.php?id=201147

Offline

#8 2015-09-02 01:26:11

YaourtYogurt
Member
Registered: 2015-09-01
Posts: 11

Re: Boot issues with LVM on LUKS and GRUB2

Elderon's suggestion worked.  Thank you for the help!

Now I'm going to edit the Wiki page to prevent others from making the same mistake.

Offline

Board footer

Powered by FluxBB