Boot encrypted partions

Issues Related to Hardware (Sound, Video, Printers, Scanners, Webcams, Touchpads, Keyboards, Sensors, Drives, GRUB, etc.)

Moderator: Moderators

Boot encrypted partions

Postby kxp » Tue Mar 12, 2013 7:49

Hey

Last week i formatted my pc and put windows 8 and sabayon, but the windows 8 got really stupid and i got tired of it, so i put win xp and everything ok. or i thought so, i put sabayon in a pendrive run the partial installation, i mean i use it to recover grub, and in the end when i was booting sabayon e got an error of partions.The problem is i had the logical volume and /home encrypted, i know its kinda useless encrypt it twice.
Resuming, I have the linux installed in 3 partions, swap, /, /home, this 3 are in a lv volume, and i have /boot in a normal partion like xp.
What can i do to fix this? i can't lose those files and also i dont have that time time install and configure everything the way i like it.

Please help me
Thanks

Ps: before formating i had troubles with the speakers, after some update, i think they never worked again, but they work in windows and also with headphones, but leave it for later...
kxp
Simple Hen
 
Posts: 55
Joined: Wed Apr 06, 2011 11:37
Location: Portugal

Re: Boot encrypted partions

Postby kxp » Thu Mar 14, 2013 0:32

I finally manage to mount the drive with a live pen, but still nothing qith grub2.
This is the error that i got:
http://img201.imageshack.us/img201/1024 ... 104305.jpg
kxp
Simple Hen
 
Posts: 55
Joined: Wed Apr 06, 2011 11:37
Location: Portugal

Re: Boot encrypted partions

Postby colock » Thu Mar 14, 2013 23:53

you need to add another parameter to the kernel append line (/etc/default/sabayon-grub):
Code: Select all
dolvm


then run again:
Code: Select all
grub2-mkconfig
colock
Simple Hen
 
Posts: 56
Joined: Mon Feb 25, 2013 12:01

Re: Boot encrypted partions

Postby kxp » Sat Mar 16, 2013 14:02

this time i coulnd't mount the devices but the location that u specify will not be linked to the to the live cd?
Anywat I edit the grub.cfg and add those lines and other stuff that migth help, here is the configuration:
Code: Select all
#
# 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_fonts ###
### END /etc/grub.d/00_fonts ###

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="${saved_entry}"

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 [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod ext2
set root='hd0,msdos2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  8b829721-643d-4515-a1b2-54a47a67a640
else
  search --no-floppy --fs-uuid --set=root 8b829721-643d-4515-a1b2-54a47a67a640
fi
    font="/grub/unifont.pf2"
fi

if loadfont $font ; then
  set gfxmode=1024x768
  load_video
  # vga= is deprecated, grub2 handles this just fine
  # making grub2 res == linux fb res
  set gfxpayload=keep
  insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='hd0,msdos2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  8b829721-643d-4515-a1b2-54a47a67a640
else
  search --no-floppy --fs-uuid --set=root 8b829721-643d-4515-a1b2-54a47a67a640
fi
insmod png
background_image -m stretch /grub/default-splash.png
if sleep --interruptible 0 ; then
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Sabayon GNU/Linux' --class sabayon --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-d43dc5d5-061b-41b6-b900-66a8f6750d5c' {
   load_video
   insmod gzio
   insmod part_msdos
   insmod part_gpt
   insmod btrfs
   insmod lvm
   insmod ext2
   set root='hd0,msdos2'
   if [ x$feature_platform_search_hint = xy ]; then
     search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  8b829721-643d-4515-a1b2-54a47a67a640
   else
     search --no-floppy --fs-uuid --set=root 8b829721-643d-4515-a1b2-54a47a67a640
   fi
   echo   'Loading Linux x86-3.7.0-sabayon ...'
   linux   /kernel-genkernel-x86-3.7.0-sabayon ro  init=/linuxrc splash=silent,theme:sabayon video=vesafb:ywrap,mtrr:3 vga=791 gfxpayload=1024x768x16 console=tty1 quiet dokeymap keymap=pt dolvm domdadm resume=swap:/dev/mapper/vg_klap-lv_swap real_resume=/dev/mapper/vg_klap-lv_swap dolvm root=/dev/mapper/vg_klap-lv_root docrypt rootfstype=btrfs
   echo   'Loading initial ramdisk ...'
   initrd   /initramfs-genkernel-x86-3.7.0-sabayon
}
submenu 'Advanced options for Sabayon GNU/Linux' $menuentry_id_option 'gnulinux-advanced-d43dc5d5-061b-41b6-b900-66a8f6750d5c' {
   menuentry 'Sabayon GNU/Linux, with Linux x86-3.7.0-sabayon' --class sabayon --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-x86-3.7.0-sabayon-advanced-d43dc5d5-061b-41b6-b900-66a8f6750d5c' {
      load_video
      insmod gzio
      insmod part_msdos
      insmod part_gpt
           insmod btrfs
           insmod lvm
      insmod ext2
      set root='hd0,msdos2'
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  8b829721-643d-4515-a1b2-54a47a67a640
      else
        search --no-floppy --fs-uuid --set=root 8b829721-643d-4515-a1b2-54a47a67a640
      fi
      echo   'Loading Linux x86-3.7.0-sabayon ...'
      linux   /kernel-genkernel-x86-3.7.0-sabayon ro  init=/linuxrc splash=silent,theme:sabayon video=vesafb:ywrap,mtrr:3 vga=791 gfxpayload=1024x768x16 console=tty1 quiet dokeymap keymap=pt dolvm domdadm resume=swap:/dev/mapper/vg_klap-lv_swap real_resume=/dev/mapper/vg_klap-lv_swap dolvm root=/dev/mapper/vg_klap-lv_root docrypt rootfstype=btrfs
      echo   'Loading initial ramdisk ...'
      initrd   /initramfs-genkernel-x86-3.7.0-sabayon
   }
   menuentry 'Sabayon GNU/Linux, with Linux x86-3.7.0-sabayon (recovery mode)' --class sabayon --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-x86-3.7.0-sabayon-recovery-d43dc5d5-061b-41b6-b900-66a8f6750d5c' {
      load_video
      insmod gzio
      insmod part_msdos
      insmod ext2
      set root='hd0,msdos2'
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  8b829721-643d-4515-a1b2-54a47a67a640
      else
        search --no-floppy --fs-uuid --set=root 8b829721-643d-4515-a1b2-54a47a67a640
      fi
      echo   'Loading Linux x86-3.7.0-sabayon ...'
      linux   /kernel-genkernel-x86-3.7.0-sabayon ro single init_opts=single  init=/linuxrc splash=verbose,theme:sabayon video=vesafb:ywrap,mtrr:3 vga=791 gfxpayload=1024x768x16 console=tty1 quiet dokeymap keymap=pt domdadm resume=swap:/dev/mapper/vg_klap-lv_swap real_resume=/dev/mapper/vg_klap-lv_swap dolvm root=/dev/mapper/vg_klap-lv_root docrypt
      echo   'Loading initial ramdisk ...'
      initrd   /initramfs-genkernel-x86-3.7.0-sabayon
   }
}

### 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 ###
menuentry 'Microsoft Windows XP Professional (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-1A14386514384653' {
   insmod part_msdos
   insmod ntfs
   set root='hd0,msdos1'
   if [ x$feature_platform_search_hint = xy ]; then
     search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  1A14386514384653
   else
     search --no-floppy --fs-uuid --set=root 1A14386514384653
   fi
   drivemap -s (hd0) ${root}
   chainloader +1
}
### 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 ###
kxp
Simple Hen
 
Posts: 55
Joined: Wed Apr 06, 2011 11:37
Location: Portugal

Re: Boot encrypted partions

Postby kxp » Wed Mar 20, 2013 1:34

No one has more sugestions?
kxp
Simple Hen
 
Posts: 55
Joined: Wed Apr 06, 2011 11:37
Location: Portugal

Re: Boot encrypted partions

Postby colock » Wed Mar 20, 2013 13:33

read the "DO NOT EDIT THIS FILE" disclaimer.

/etc/default/sabayon-grub is not in the livecd. It is created by the installer on the installed system.
colock
Simple Hen
 
Posts: 56
Joined: Mon Feb 25, 2013 12:01

Re: Boot encrypted partions

Postby kxp » Wed Mar 20, 2013 14:09

When things dont work, what i have to loose by changing them?
I didnt install anything, just run the live cd, but i will try it.

thanks
kxp
Simple Hen
 
Posts: 55
Joined: Wed Apr 06, 2011 11:37
Location: Portugal

Re: Boot encrypted partions

Postby colock » Thu Mar 21, 2013 12:44

Now i don't understand what you wanted to do.

From the image i saw a sabayon initrd trying to boot but it couldn't find the logical volume where the rootfs was supposed to be.

The solution to _this_ problem is to tell the initrd to scan for lvm volumes (the "dolvm" parameter) prior to try mounting the rootfs.

But now i re-read your first post and it seems that you are trying to boot another installed distro with the sabayon live kernel/initrd... is that correct?

By the way, one usually encrypts a physical partition (i.e. /dev/sda3) that will then contain an lvm volume group. So if the grub settings were correct, it should try to unlock the partition before trying to mount a logical partition. Ergo, even if you pass the dolvm parameter there is still something wrong anyway.

Maybe my config can hint you:
Code: Select all
/dev/sda3: LUKS encrypted partition
/dev/mapper/main: LVM "main" volume group, on /dev/sda3
/dev/mapper/main-sabayon: LVM "sabayon" logical volume, in "main", mounted on /
/dev/mapper/main-swapvol: LVM "swap" logical volumne, in "main", used as swap


my /etc/default/sabayon-grub then looks like:
Code: Select all
GRUB_CMDLINE_LINUX="dolvm crypt_root=/dev/sda3 real_root=/dev/mapper/main-sabayon ro resume=/dev/mapper/main-swapvol console=tty1 splash=silent,theme:sabayon quiet"
colock
Simple Hen
 
Posts: 56
Joined: Mon Feb 25, 2013 12:01

Re: Boot encrypted partions

Postby kxp » Fri Apr 19, 2013 3:25

just to close the topic, i made a backup of all files, and after that i made a new installation with the same specs, now its everything fine.
Thanks for trying to help me.
kxp
Simple Hen
 
Posts: 55
Joined: Wed Apr 06, 2011 11:37
Location: Portugal


Return to Hardware

Who is online

Users browsing this forum: No registered users and 3 guests