Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Can't boot kernel.[SOLVED]
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
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 777
Location: Tokyo, Japan

PostPosted: Sun Oct 21, 2012 8:05 am    Post subject: Can't boot kernel.[SOLVED] Reply with quote

I installed Gentoo on a amd64 laptop using the Gentoo guide, http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?full=1, and information from the thread https://forums.gentoo.org/viewtopic-t-929064-highlight-.html.

There is the added level of complexity because I am using LVM2 and a Luks encrypted volume.

I initially used Grub as outlined in the guide but later changed to Grub2. However both Grub and Grub2 generate the same errors.

Quote:
Filesystem Type unknown, partition type 0x83
kernel /boot/kernel-genkernel-86_64-3.4.9-gentoo real_root=/dev/mapper/vg-root crypt_root=/dev/sda7 dolvm ro
Error 17: Cannot mount selected partition.


My partions are as follow:

Code:
=====================>>> fsarchiver probe simple <<<=====================
[======DISK======] [=============NAME==============] [====SIZE====] [MAJ] [MIN]
[sda             ] [ST1000LM024 HN-M               ] [   931.51 GB] [  8] [  0]
[sdb             ] [SanDisk iSSD P4                ] [     7.46 GB] [  8] [ 16]
[sdc             ] [USB Flash Memory               ] [   956.00 MB] [  8] [ 32]

[=====DEVICE=====] [==FILESYS==] [======LABEL======] [====SIZE====] [MAJ] [MIN]
[loop0           ] [squashfs   ] [<unknown>        ] [   255.07 MB] [  7] [  0]
[sda1            ] [ntfs       ] [SYSTEM           ] [   100.00 MB] [  8] [  1]
[sda2            ] [ntfs       ] [<unknown>        ] [   101.00 GB] [  8] [  2]
[sda4            ] [ntfs       ] [SAMSUNG_REC      ] [    21.37 GB] [  8] [  4]
[sda5            ] [ntfs       ] [<unknown>        ] [     9.04 GB] [  8] [  5]
[sda6            ] [ext2       ] [<unknown>        ] [   200.00 MB] [  8] [  6]
[sda7            ] [crypto_LUKS] [<unknown>        ] [   799.80 GB] [  8] [  7]
[sdb1            ] [<unknown>  ] [<unknown>        ] [     7.46 GB] [  8] [ 17]
[sdc1            ] [vfat       ] [SYSRESCCD        ] [   955.95 MB] [  8] [ 33]
[dm-0            ] [LVM2_member] [<unknown>        ] [   799.80 GB] [253] [  0]
[dm-1            ] [ext4       ] [<unknown>        ] [    20.00 GB] [253] [  1]
[dm-2            ] [swap       ] [<unknown>        ] [     9.80 GB] [253] [  2]
[dm-3            ] [ext4       ] [<unknown>        ] [    10.00 GB] [253] [  3]
[dm-4            ] [ext4       ] [<unknown>        ] [   760.00 GB] [253] [  4]


I have a separate boot partition on sda6 and sda7 is my encrypted volume. It has root, swap, var, and home on it.

This is my fstab:

Code:
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.
#

# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
#/dev/BOOT              /boot           ext2            noauto,noatime  1 2
#/dev/ROOT              /               ext3            noatime         0 1
#/dev/SWAP              none            swap            sw              0 0
/dev/cdrom              /mnt/cdrom      auto            noauto,ro       0 0
/dev/fd0                /mnt/floppy     auto            noauto          0 0

/dev/sda6               /boot           ext2            noauto,noatime  1 2
/dev/mapper/vg-root     /               ext4            noatime         0 1
/dev/mapper/vg-swap     none            swap            sw              0 0
/dev/mapper/vg-var      /var            ext4            noatime         0 1
/dev/mapper/vg-home     /home           ext4            noatime         0 1


and this is my Grub2 config:

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
set default="0"

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-/dev/mapper/vg-root' {
        load_video
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  beaee9bb-c7c7-4d63-b674-ccc36aba01f7
        else
          search --no-floppy --fs-uuid --set=root beaee9bb-c7c7-4d63-b674-ccc36aba01f7
        fi
        echo    'Loading Linux x86_64-3.4.9-gentoo ...'
        linux   /kernel-genkernel-x86_64-3.4.9-gentoo root=/dev/mapper/vg-root ro 
        echo    'Loading initial ramdisk ...'
        initrd  /initramfs-genkernel-x86_64-3.4.9-gentoo
}
submenu 'Advanced options for Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-/dev/mapper/vg-root' {
        menuentry 'Gentoo GNU/Linux, with Linux x86_64-3.4.9-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-x86_64-3.4.9-gentoo-advanced-/dev/mapper/vg-root' {
                load_video
                insmod gzio
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos6'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  beaee9bb-c7c7-4d63-b674-ccc36aba01f7
                else
                  search --no-floppy --fs-uuid --set=root beaee9bb-c7c7-4d63-b674-ccc36aba01f7
                fi
                echo    'Loading Linux x86_64-3.4.9-gentoo ...'
                linux   /kernel-genkernel-x86_64-3.4.9-gentoo root=/dev/mapper/vg-root ro 
                echo    'Loading initial ramdisk ...'
                initrd  /initramfs-genkernel-x86_64-3.4.9-gentoo
        }
        menuentry 'Gentoo GNU/Linux, with Linux x86_64-3.4.9-gentoo (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-x86_64-3.4.9-gentoo-recovery-/dev/mapper/vg-root' {

load_video
                insmod gzio
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos6'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  beaee9bb-c7c7-4d63-b674-ccc36aba01f7
                else
                  search --no-floppy --fs-uuid --set=root beaee9bb-c7c7-4d63-b674-ccc36aba01f7
                fi
                echo    'Loading Linux x86_64-3.4.9-gentoo ...'
                linux   /kernel-genkernel-x86_64-3.4.9-gentoo root=/dev/mapper/vg-root ro single
                echo    'Loading initial ramdisk ...'
                initrd  /initramfs-genkernel-x86_64-3.4.9-gentoo
        }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/11_Windows ###
menuentry “Windows 7″ {
set root=(hd0,1)
chainloader +1
}
### END /etc/grub.d/11_Windows ###

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


Any ideas where I am going wrong. I have been banging my ahead against a wall for a week trying to sort this out.


Last edited by Budoka on Mon Sep 16, 2013 5:30 am; edited 1 time in total
Back to top
View user's profile Send private message
BitJam
Advocate
Advocate


Joined: 12 Aug 2003
Posts: 2506
Location: Silver City, NM

PostPosted: Sun Oct 21, 2012 9:15 am    Post subject: Reply with quote

I think you need to create an initramfs in order to mount your encrypted root partition. Here is how to do it using genkernel:
Quote:
After days and days of trying to create my own initramfs and writing my own linuxrc files it really comes down to passing using genkernel to build the kernel and initramfs with luks support by passing genkernel –luks!

Here are instructions for doing it all yourself.
Back to top
View user's profile Send private message
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 777
Location: Tokyo, Japan

PostPosted: Sun Oct 21, 2012 10:37 am    Post subject: Reply with quote

BitJam wrote:
I think you need to create an initramfs in order to mount your encrypted root partition. Here is how to do it using genkernel:
Quote:
After days and days of trying to create my own initramfs and writing my own linuxrc files it really comes down to passing using genkernel to build the kernel and initramfs with luks support by passing genkernel –luks!

Here are instructions for doing it all yourself.


Thanks for the reply. I did add the luks parasmeter to genkernel. This is what I used:
Code:
genkernel  --lvm --luks --menuconfig all


My understanding is that this will automatically generate the iniramfs and when I checked boot I see it is there.

Quote:
(chroot) sysresccd boot # ls
boot initramfs-genkernel-x86_64-3.4.9-gentoo
grub kernel-genkernel-x86_64-3.4.9-gentoo
grub2 lost+found
grub_backup System.map-genkernel-x86_64-3.4.9-gentoo


Is it necessary to add the --crypt flag in addition to --luks to genkernel as well?

This is the exact error message grub2 kicks out:
Quote:
!!Block device /dev/mapper/vg-root is not a valid root device...
!!!Could not find the root block device in .
Back to top
View user's profile Send private message
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 777
Location: Tokyo, Japan

PostPosted: Mon Nov 05, 2012 12:46 pm    Post subject: Reply with quote

Anyone??? I am really stuck and don't know how to solve this problem. I saw another thread with something similar, https://forums.gentoo.org/viewtopic-t-919252-start-0.html, but can't find anything in it that would help me since I am using grub2.

I really want to make this work but may be forced to go with another distro if I can't sort it out. Help please.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21431

PostPosted: Tue Nov 06, 2012 2:28 am    Post subject: Reply with quote

Budoka wrote:
This is the exact error message grub2 kicks out:
Quote:
!!Block device /dev/mapper/vg-root is not a valid root device...
!!!Could not find the root block device in .
This is not a grub2 message. This is a Linux message, probably from the initramfs. Are you using the genkernel-created initramfs or a handmade one?
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 Nov 06, 2012 4:44 am    Post subject: Reply with quote

a few bits of commentary:

-genkernel is a PITA for this sort of thing
-grub2 is supposed to not be a PITA for this sort of thing. But it is


My suggestion? Roll your own kernel using Pappy's Kernel Seeds. It's not as tricky as it may sound.
And roll your own small simple initramfs.

I wrote this, which should explain it fairly clearly. The only real deviation from that guide, is that you use luks atop LVM, so you would need to:

a)copy the requisite LVM2 binaries into their appropriate location within the initramfs structure
b)add a line to your 'init' script that, before the luksOpen, prepares your LVM volume

It's more "manual", but much greater simplicity when it comes down to it
_________________
Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash
Back to top
View user's profile Send private message
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 777
Location: Tokyo, Japan

PostPosted: Tue Nov 06, 2012 5:29 am    Post subject: Reply with quote

Hu wrote:
Budoka wrote:
This is the exact error message grub2 kicks out:
Quote:
!!Block device /dev/mapper/vg-root is not a valid root device...
!!!Could not find the root block device in .
This is not a grub2 message. This is a Linux message, probably from the initramfs. Are you using the genkernel-created initramfs or a handmade one?


Using the genkernel created initramfs.
Back to top
View user's profile Send private message
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 777
Location: Tokyo, Japan

PostPosted: Tue Nov 06, 2012 5:32 am    Post subject: Reply with quote

cach0rr0 wrote:
a few bits of commentary:

-genkernel is a PITA for this sort of thing
-grub2 is supposed to not be a PITA for this sort of thing. But it is


My suggestion? Roll your own kernel using Pappy's Kernel Seeds. It's not as tricky as it may sound.
And roll your own small simple initramfs.

I wrote this, which should explain it fairly clearly. The only real deviation from that guide, is that you use luks atop LVM, so you would need to:

a)copy the requisite LVM2 binaries into their appropriate location within the initramfs structure
b)add a line to your 'init' script that, before the luksOpen, prepares your LVM volume

It's more "manual", but much greater simplicity when it comes down to it


Thanks. I'll take a look. I was using genkernel because it is my first Gentoo install and I have the added layer of complexity of luks on LVM. I thought genkernel was just suppose to "work".
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 Nov 06, 2012 6:43 am    Post subject: Reply with quote

Budoka wrote:

I thought genkernel was just suppose to "work".


It's supposed to. And it's gotten better. But sometimes it takes a kick in the pants to get it to behave, enough effort to the point that by the time you're done troubleshooting genkernel you could have expended the same effort on "rolling your own" and gotten more enjoyable results.

bonus: it's much easier to troubleshoot your own kernel/initramfs than it is trying to decipher wtf genkernel has done
_________________
Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash
Back to top
View user's profile Send private message
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 777
Location: Tokyo, Japan

PostPosted: Tue Nov 06, 2012 2:42 pm    Post subject: Reply with quote

OK. After much trial and error, and banging my head against the wall, I discovered that I need grub2 to have "real_root=/dev/mapper/vg-root crypt_root=/dev/sda2 dolvm ro " but I am not sure how to pass that to grub2 config.

If I manually edit the boot at boot it will work. After that i emcointer another problem but I'll save that for another thread. How do I add it permanently to my grub2 config file? The header in grub2 config states "don't edit this file".
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Tue Nov 06, 2012 3:07 pm    Post subject: Reply with quote

From http://dev.gentoo.org/~scarabeus/grub-2-guide.xml
Quote:
Sometimes, if automatic detection of GRUB 2 does not suffice, the file /etc/grub.d/40_custom should be used to store custom entries. Full description how to configure such with examples can be found in grub2 info pages.

Code Listing 2.16: Custom menu entry
menuentry "My Shiny Gentoo Kernel" {
set root=(hd0,1)
search --no-floppy --fs-uuid --set <UUID>
linux /boot/gentookernel-5.3.2-generic root=UUID=<UUID>
initrd /boot/initrd.img-5.3.2
}
Warning: Remember to replace the <UUID> with your device UUID.
Configuring with LVM

GRUB 2 itself detects the LVM correctly, with no additional setup required.

Important: If you placed your root and boot partitions inside LVM make sure that disk you plan to use as booting one has at least few MBs of space before first partition, because GRUB 2 needs more space to store LVM loader. In other words: If you install it with not enough space it will just break your partition.

_________________
Defund the FCC.
Back to top
View user's profile Send private message
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 777
Location: Tokyo, Japan

PostPosted: Wed Nov 07, 2012 3:49 am    Post subject: Reply with quote

Thanks everyone. I edited the /etc/default/grub file and added my required parameters to
Quote:
GRUB_CMDLINE_LINUX=
.

I also had to uncomment the below otherwise the original unbootable parameter kept appearing before my parameters preventing me from booting.

Code:
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true


So now I can boot my kernel and login but it drops me to a console environment with no graphical environment.
Code:
startx
also does now work. Also no splash screen etc.

Anyway, since my original problem of not being able to boot seems to be solved, and unless someone sees a problem with the way I "solved" the issue, I'll mark this as solved. Let me know and thanks.
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