Results 1 to 8 of 8

Thread: Problems rescuing LVM+LUKS encrypted drive from LiveCD.

Hybrid View

  1. #1
    Join Date
    Dec 2004
    Beans
    10

    Problems rescuing LVM+LUKS encrypted drive from LiveCD.

    I munged my GRUB when I installed 9.10 from a LiveCD onto a USB hard drive. After ejecting the LiveCD and disconnecting the hard drive, I can no longer boot my machine. GRUB tells me something to the effect that the disc isn't found. My guess is that installing onto an external USB drive modified my GRUB settings on my internal hard drive. The problem is that my internal drive is encrypted via LVM+LUKS. My plan is to boot into the LiveCD, unlock my internal drive, mount my internal drive, chroot into my internal drive's Ubuntu 9.10 installation, fix GRUB, and live happily ever after. Unfortunately, I'm stuck at decrypting my internal drive. From everything I've gathered (e.g. http://ubuntuforums.org/showthread.php?t=611165), the steps I need to do this are:

    1) sudo su
    2) aptitude install lvm2 cryptsetup
    3) modprobe dm-crypt
    4) cryptsetup luksOpen /dev/sda5 crypt1

    The last step gives me this error, which doesn't seem to be explained in any of the threads I've seen on the subject:
    Command failed: Can not access device

    Which is strange, because "cryptsetup isLuks /dev/sda5" returns true and looking at fdisk -l reveals:

    Disk /dev/sda: 250.1 GB, 250059350016 bytes
    255 heads, 63 sectors/track, 30401 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0xDEADBEEF

    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 12 96358+ 83 Linux
    /dev/sda2 13 30401 244099642+ 5 Extended
    /dev/sda5 13 30401 244099611 83 Linux

    Any suggestions?

    Thanks,
    TM

  2. #2
    Join Date
    Dec 2004
    Beans
    10

    Re: Problems rescuing LVM+LUKS encrypted drive from LiveCD.

    As it turns out, booting from the USB drive instead of the Live CD solves the problem of not being able to unlock my encrypted internal drive. Now I have a different problem. Here's what I've done so far, all successfully:

    1. Boot from USB drive.
    2. sudo aptitude install lvm2 cryptsetup
    3. sudo modprobe dm-crypt
    4. sudo cryptsetup luksOpen /dev/sda5 crypt1
    5. sudo vgscan --mknodes
    6. sudo vgchange -ay
    7. sudo mkdir /media/crypt_root
    8. sudo mount /dev/vg1/lvroot /media/crypt_root
    9. sudo mount -o bind /proc /media/crypt_root/proc
    10. sudo mount -o bind /dev /media/crypt_root/dev
    11. sudo chroot /media/crypt_root /bin/bash
    12. update-grub
      This command results in:
      Generating grub.cfg ...
      Cannot find list of partitions!
      done
    13. grub-install hd0
      This command results in:
      grub-probe: error: no mapping exists for 'vg1-lvroot'
      Auto-detection of filesystem module failed.
      Please specify the module with the option `--modules' explicitly.


    The last two steps are where I'm stuck. The /boot/grub/device.map on my internal drive is:

    (hd0) /dev/sda
    (hd1) /dev/sdb

    Looking at /boot/grub/grub.cfg, I see that root is set to (hd1,1). I would like it to be set to wherever vg1-lvroot is. Should I manually change grub.cfg? How can I get steps 12 and 13 working?

    Thanks,
    TM

  3. #3
    Join Date
    Dec 2004
    Beans
    10

    Re: Problems rescuing LVM+LUKS encrypted drive from LiveCD.

    I ended up running update-grub without first chrooting to the internal drive. In so doing, the kernels on the internal drive were discovered and are now listed as boot options when booting from the USB drive. I rebooted with the USB drive still connected, selected a boot option on /dev/mapper/vg1-lvroot, disconnected the USB drive after booting, ran update-grub again with no errors, and ran grub-install hd0 with the following error:

    # grub-install hd0
    grub-probe: error: Cannot stat `hd0'
    Invalid device `hd0'.
    Try ``grub-setup --help'' for more information.

    Instead, I tried:

    # grub-install "(hd0,1)"
    grub-setup: warn: Attempting to install GRUB to a partition instead of the MBR. This is a BAD idea.
    grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and its use is discouraged.
    Installation finished. No error reported.
    This is the contents of the device map /boot/grub/device.map.
    Check if this is correct or not. If any of the lines is incorrect,
    fix it and re-run the script `grub-install'.

    (hd0) /dev/sda

    I didn't like those warnings, so then I ran this:

    # grub-install --root-directory=/ /dev/sda
    Installation finished. No error reported.
    This is the contents of the device map //boot/grub/device.map.
    Check if this is correct or not. If any of the lines is incorrect,
    fix it and re-run the script `grub-install'.

    (hd0) /dev/sda

    I'll reboot and report back soon.

  4. #4
    Join Date
    Dec 2004
    Beans
    10

    Re: Problems rescuing LVM+LUKS encrypted drive from LiveCD.

    The steps in my previous post fixed the problem. My system now boots normally.

    Cheers,
    TM

  5. #5
    Join Date
    Jul 2009
    Beans
    10

    Re: Problems rescuing LVM+LUKS encrypted drive from LiveCD.

    Help I have a issue with my UBUNTU Lucid Install.

    I did a install Of SUSE on a external and attempted to re-use my UBUNTU system folders set in separate partitions as:
    /home on partition /dev/sda5

    /usr set on partition /dev/sda6

    /var set on partition /dev/sda7

    /tmp set on partition /dev/sda8

    they can no longer be mounted in Grub??

    please someone Help me?

    well, I did an array of scans and lvm checks according to this website: http://linuxwave.blogspot.com/2007/1...tu-livecd.html

    first I did:

    fdisk -lu then pvscan then vgscan then vgchange -a y then lv scan, snd thats as far as I got on vgchange -a y
    it shows:

    0 logical volume(s) in volume group "tmp" now active
    0 logical volume(s) in volume group "var" now active
    0 logical volume(s) in volume group "usr" now active
    0 logical volume(s) in volume group "home" now active

    opposed to what I expected 1 logical volumes in each active.
    Last edited by jasonsmr; March 20th, 2010 at 01:08 AM.

  6. #6
    Join Date
    Dec 2004
    Beans
    10

    Re: Problems rescuing LVM+LUKS encrypted drive from LiveCD.

    Hi jasonsmr,

    That's a lot of information! I don't quite follow what you're actually asking, but I'll try to answer as best I can. Can you reformulate your questions to make them more concrete?

    Yes, dm-mod should be compiled into the kernel you're using. I'm not sure about the inner workings of LVM.

    Cheers,
    TM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •