Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Booting fails with dm-crypt partitions.
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
romana
n00b
n00b


Joined: 25 Mar 2016
Posts: 5

PostPosted: Fri Mar 25, 2016 6:57 am    Post subject: Booting fails with dm-crypt partitions. Reply with quote

Hello. I have installed gentoo a few times in the past with encryption, but I have never gotten this error. When I attempt to boot I get through grub but then it gives me
Code:
 "/dev/mapper/root: invalid root device"
and then tells me to give it a proper block device or kick me into an ash shell. I am not using LVM. What should I do about this?

Relevent files:
/etc/fstab
Code:

/dev/mapper/root        /               ext4            defaults,noatime,errors=remount-ro,discard      0 1
/dev/mapper/home        /home           ext4            defaults,noatime,discard0 2
/dev/sdb1               /boot           ext4            defaults,noatime,discard0 2

/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 ###
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 [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
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-/dev/mapper/root' {
        load_video
        if [ "x$grub_platform" = xefi ]; then
                set gfxpayload=keep
        fi
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd1,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  9ff15bdc-cfc8-4764-a8ba-a401aa41fd1d
        else
          search --no-floppy --fs-uuid --set=root 9ff15bdc-cfc8-4764-a8ba-a401aa41fd1d
        fi
        echo    'Loading Linux x86_64-4.5.0-gentoo ...'
        linux   /kernel-genkernel-x86_64-4.5.0-gentoo root=/dev/mapper/root ro 
        echo    'Loading initial ramdisk ...'
        initrd  /initramfs-genkernel-x86_64-4.5.0-gentoo
}
submenu 'Advanced options for Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-/dev/mapper/root' {
        menuentry 'Gentoo GNU/Linux, with Linux x86_64-4.5.0-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-x86_64-4.5.0-gentoo-advanced-/dev/mapper/root' {
                load_video
                if [ "x$grub_platform" = xefi ]; then
                        set gfxpayload=keep
                fi
                insmod gzio
                insmod part_msdos
                insmod ext2
                set root='hd1,msdos1'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  9ff15bdc-cfc8-4764-a8ba-a401aa41fd1d
                else
                  search --no-floppy --fs-uuid --set=root 9ff15bdc-cfc8-4764-a8ba-a401aa41fd1d
                fi
                echo    'Loading Linux x86_64-4.5.0-gentoo ...'
                linux   /kernel-genkernel-x86_64-4.5.0-gentoo root=/dev/mapper/root ro 
                echo    'Loading initial ramdisk ...'
                initrd  /initramfs-genkernel-x86_64-4.5.0-gentoo
        }
        menuentry 'Gentoo GNU/Linux, with Linux x86_64-4.5.0-gentoo (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-x86_64-4.5.0-gentoo-recovery-/dev/mapper/root' {
                load_video
                if [ "x$grub_platform" = xefi ]; then
                        set gfxpayload=keep
                fi
                insmod gzio
                insmod part_msdos
                insmod ext2
                set root='hd1,msdos1'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  9ff15bdc-cfc8-4764-a8ba-a401aa41fd1d
                else
                  search --no-floppy --fs-uuid --set=root 9ff15bdc-cfc8-4764-a8ba-a401aa41fd1d
                fi
                echo    'Loading Linux x86_64-4.5.0-gentoo ...'
                linux   /kernel-genkernel-x86_64-4.5.0-gentoo root=/dev/mapper/root ro single
                echo    'Loading initial ramdisk ...'
                initrd  /initramfs-genkernel-x86_64-4.5.0-gentoo
        }
}

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


I added
Code:
 cryptdevice=UUID=7fdb51b4-0387-4a9e-a76d-5bed9e1b107a:root root=/dev/mapper/root
to the end of /etc/default/grub so grub2-mkconfig recognizes the fact that I have a dm-crypt encrypted partition.

I compiled the kernel with genkernal-next using
Code:
 genkernel --luks --lvm all
and make the initramfs with
Code:
 genkernel --luks --lvm initramfs
.

Whenever I run
Code:
 grub2-mkconfig -o /boot/grub/grub.cfg
it gives me:
Code:

 /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  Volume group "root" not found
  Cannot process volume group root
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  Volume group "root" not found
  Cannot process volume group root
/usr/sbin/grub2-probe: error: disk `lvm/root' not found.

despite the fact that I am not using LVM and still finishes.

If you need anymore information tell me. Thank you for your time.
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2970
Location: Germany

PostPosted: Fri Mar 25, 2016 10:18 am    Post subject: Reply with quote

Since you're not using LVM, what happens when you don't use --lvm either?

Do you have a /etc/conf.d/dmcrypt with definitions for your LUKS devices?

In the running system `dmsetup table` has those crypt devices named root, home?
Back to top
View user's profile Send private message
romana
n00b
n00b


Joined: 25 Mar 2016
Posts: 5

PostPosted: Fri Mar 25, 2016 7:50 pm    Post subject: Reply with quote

Thanks for getting to me.
frostschutz wrote:
Since you're not using LVM, what happens when you don't use --lvm either?

Do you have a /etc/conf.d/dmcrypt with definitions for your LUKS devices?



Recompiled without --lvm and added
Code:

target=crypt-home
source='/dev/sda1'

target=crypt-root
source='/dev/sdb2'

to /etc/conf.d/dmcrypt and it gave me the same error upon bootup.

frostschutz wrote:

In the running system `dmsetup table` has those crypt devices named root, home?


Yes there is.
Code:

home: 0 1953517568 crypt twofish-xts-plain:wd256 0000000000000000000000000000000000000000000000000000000000000000 0 8:1 4096
root: 0 234183696 crypt twofish-xts-plain:wd256 0000000000000000000000000000000000000000000000000000000000000000 0 8:18 4096
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2970
Location: Germany

PostPosted: Fri Mar 25, 2016 9:42 pm    Post subject: Reply with quote

Are you running inside a chroot, did you mount --bind /dev /mnt/chroot/dev (and same for /dev/pts, /proc, /sys, ...?)

Not sure why it fails if all the devices are there as they should be. Hopefully someone who knows grub2-mkconfig better will chip in. I'm using handwritten grub config...

maybe show your /etc/default/grub in full?
Back to top
View user's profile Send private message
romana
n00b
n00b


Joined: 25 Mar 2016
Posts: 5

PostPosted: Fri Mar 25, 2016 9:48 pm    Post subject: Reply with quote

frostschutz wrote:
Are you running inside a chroot, did you mount --bind /dev /mnt/chroot/dev (and same for /dev/pts, /proc, /sys, ...?)


I am in a chroot and yes I did mount all of those.

frostschutz wrote:

maybe show your /etc/default/grub in full?

I don't know if this is ever different from gentoo to gentoo but here it is:

Code:

# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
#
# 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"

# Default menu entry
#GRUB_DEFAULT=0

# Boot the default entry this many seconds after the menu is displayed
#GRUB_TIMEOUT=5
#GRUB_TIMEOUT_STYLE=menu

# Append parameters to the linux kernel command line
#GRUB_CMDLINE_LINUX=""
#
# Examples:
#
# Boot with network interface renaming disabled
# GRUB_CMDLINE_LINUX="net.ifnames=0"
#
# Boot with systemd instead of sysvinit (openrc)
# GRUB_CMDLINE_LINUX="init=/usr/lib/systemd/systemd"

# 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

# Set to 'text' to force the Linux kernel to boot in normal text
# mode, 'keep' to preserve the graphics mode set using
# 'GRUB_GFXMODE', 'WIDTHxHEIGHT'['xDEPTH'] to set a particular
# graphics mode, or a sequence of these separated by commas or
# semicolons to try several modes in sequence.
#GRUB_GFXPAYLOAD_LINUX=

# 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

# Uncomment to disable generation of the submenu and put all choices on
# the top-level menu.
# Besides the visual affect of no sub menu, this makes navigation of the
# menu easier for a user who can't see the screen.
#GRUB_DISABLE_SUBMENU=y

# Uncomment to play a tone when the main menu is displayed.
# This is useful, for example, to allow users who can't see the screen
# to know when they can make a choice on the menu.
#GRUB_INIT_TUNE="60 800 1"

cryptdevice=UUID=7fdb51b4-0387-4a9e-a76d-5bed9e1b107a:root root=/dev/mapper/root


EDIT: I just realized I placed the cryptdevice line outside of the GRUB_CMDLINE_LINUX where I believe it's supposed to be actually. Going to place it there and test this out. Nope didn't work, same error.
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2970
Location: Germany

PostPosted: Sat Mar 26, 2016 12:54 am    Post subject: Reply with quote

Regarding your @EDIT: you should definitely fix that.

Also I notice just now, your crypttab / dmcrypt specifies names crypt-root and crypt-home, but according to your dmsetup table they're named plain home, root instead. Maybe try to make those names match 100%

Other than that I'm out of ideas, hopefully someone will be able to chip in.
Back to top
View user's profile Send private message
romana
n00b
n00b


Joined: 25 Mar 2016
Posts: 5

PostPosted: Sat Mar 26, 2016 1:24 am    Post subject: Reply with quote

frostschutz wrote:
Regarding your @EDIT: you should definitely fix that.

Also I notice just now, your crypttab / dmcrypt specifies names crypt-root and crypt-home, but according to your dmsetup table they're named plain home, root instead. Maybe try to make those names match 100%

Other than that I'm out of ideas, hopefully someone will be able to chip in.


Changed them to target=root and target=home, recompiled and generated new config, still didn't boot.

EDIT: Actually I accidentally left the - before root and home, let me see what happens when I remove those. Nope, no good.
Back to top
View user's profile Send private message
romana
n00b
n00b


Joined: 25 Mar 2016
Posts: 5

PostPosted: Mon Mar 28, 2016 9:00 pm    Post subject: Reply with quote

Solved!

The UUID I put in the /etc/grub/default file was the UUID to /dev/mapper/root. I put the UUId of /dev/sdb2 (root partition) and it went! Thank you all for your help.
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