Find the answer to your Linux question:
Results 1 to 5 of 5
Hello, I have to install Debian amd64 (crypted + RAID5 + LVM2) on a computer with 4 3TB hard drives. For that I mainly followed a howto (tjworld.net/wiki/linux/ubuntu/hardyraid5encryptedlvm). I found ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2011
    Posts
    18

    Installing RAID5 + Crypt + LVM: issue installing Grub chrooted


    Hello,

    I have to install Debian amd64 (crypted + RAID5 + LVM2) on a computer with 4 3TB hard drives.

    For that I mainly followed a howto (tjworld.net/wiki/linux/ubuntu/hardyraid5encryptedlvm). I found several issues with Debian live distro not mentioned in the tutorial which I could fix, but I cannot install Grub chrooted.

    The relevant steps followed when installing are the following:

    The system is booted from the latest debian live distribution amd64, downloaded straight from debian.org

    First step: partition the 4 hard drives the same.

    Code:
    # One partition /boot with 10 GB, primary, bootable, type fd
    # One partition SWAP with at least 2 x RAM = 64GB (we choose 128 GB), primary, non-bootable, type fd
    # One partition with 1900 GB, primary, non-bootable, type fd
    Second step: create the Raid arrays (+format ext4).

    Code:
    # mdadm --create /dev/md0 --level=1 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
    # mdadm --create /dev/md1 --level=1 --raid-devices=4 /dev/sda2 /dev/sdb2 /dev/sdc2 /dev/sdd2
    # mdadm --create /dev/md2 --level=5 --raid-devices=4 /dev/sda3 /dev/sdb3 /dev/sdc3 /dev/sdd3
    Third step: crypt and name.

    Code:
    # cryptsetup --hash sha512 --key-size 256 --cipher aes-cbc-essiv:sha256 luksFormat /dev/md2 /mnt/key.jpg
    # cryptsetup --key-file /mnt/key.jpg luksOpen /dev/md2 md2encrypted
    Fourth step: create the VGroup.

    Code:
    # pvcreate /dev/mapper/md2encrypted
    # vgcreate v VGraid5 /dev/mapper/md2encrypted
    Fifth step: create the logical volumes.

    Code:
    # export GB=1000000000
    # export MiB=104857
    # export PES_BYTES=$(echo "$(vgdisplay VGraid5 | sed -n 's/.*PE Size *\([0-9\.]*\) .*/\1/p') * $MiB" | bc)
    # EXTENTS=$(echo "20 * $GB / $PES_BYTES" | bc)
    # lvcreate -l $EXTENTS -n root VGraid5
    # EXTENTS=$(echo "10 * $GB / $PES_BYTES" | bc)
    # lvcreate -l $EXTENTS -n var VGraid5
    # lvcreate -l 75%FREE -n home VGraid5
    Sixth step: launch Debian installer

    Code:
    # Select manual partition
    # Select /dev/md0 as /boot
    # Select /dev/md1 as swap
    # Select /dev/mapper/VGraid5-home as /home, new partition, primary partition, ext4, format
    # Select /dev/mapper/VGraid5-root as /, new partition, primary partition, ext4, format
    # Select /dev/mapper/VGraid5-var as /var, new partition, primary partition, ext4, format
    # Commit changes
    # Do not allow the boot loader to install
    # Do not allow the system to reboot
    Seventh step: prepare for installation using chroot.

    Code:
    # mkdir /mnt/target
    # mount /dev/mapper/VGraid5-root /mnt/target
    # mount /dev/mapper/VGraid5-var /mnt/target/var
    # mount /dev/mapper/VGraid5-home /mnt/target/home
    # mount /dev/md0 /mnt/target/boot
    # mount -o bind /proc /mnt/target/proc
    # mount -o bind /dev /mnt/target/dev
    Eighth step: install grub (that's where all this stops and I do not understand why).

    Code:
    # chroot /mnt/target /bin/bash -c "apt-get install grub"
    The systems tells me there's no such package, even though it is referenced by other packages:

    Code:
    Reading package list... Done
    Building dependency tree
    Reading state information... Done
    Package grub is not available, but is referred to by other package.
    This may mean that the package is missing, or has been obsoleted, or
    is only available from another source
    
    E: Package grub has no installation candidate
    I can install grub directly from the live cd (without chroot) and the network connection works. I have updated /mnt/target/apt/sources.list to include the standard repositories but to no avail. Tried different little things for hours

    Could anyone let me know what is wrong with this command?

    Thank you in advance

  2. #2
    Just Joined!
    Join Date
    Apr 2012
    Posts
    2
    IIRC, the package is called grub-pc (not on a debian box right now). I'd do a "apt-cache search grub" to make sure and go from there.

  3. #3
    Just Joined!
    Join Date
    Jul 2011
    Posts
    18
    Hello Claudecat,

    Thank you for your reply. I had also tried with grub-pc and the answer was that this package does not exist.

    When I try it without any chroot, the command:

    Code:
    # apt-get install grub
    works flawlessly, as works

    Code:
    # apt-get install grub-pc
    Any other idea?

  4. #4
    Just Joined!
    Join Date
    Jan 2009
    Posts
    30
    Have you tried update the list of packages after modifying sources.list? I would expect it in /mnt/target/etc/apt/sources.list not in /mnt/target/apt/sources.list. You may chroot to the new installation and investigate the problem there, not just running a particular commands using chroot:
    Code:
    $ mkdir /mnt/target
    $ mount /dev/mapper/VGraid5-root /mnt/target
    $ mount /dev/mapper/VGraid5-var /mnt/target/var
    $ mount /dev/mapper/VGraid5-home /mnt/target/home
    $ mount /dev/md0 /mnt/target/boot
    $ mount -o bind /proc /mnt/target/proc
    $ mount -o bind /dev /mnt/target/dev
    $ mount -o bind /sys /mnt/target/sys     # not sure if sys is also necessary
    $ chroot /mnt/target /bin/bash
    (chroot)$ apt-get update
    (chroot)$ apt-get install grub-pc
    (chroot)$ ...
    (chroot)$ exit

  5. #5
    Just Joined!
    Join Date
    Jul 2011
    Posts
    18
    Hello Balda,

    Indeed, the sources.list is located in /mnt/target/etc/apt/, my mistake. And yes, a

    Code:
    $ chroot /mnt/target /bin/bash
    (chroot)$ apt-get update
    did it, thank you. When I changed the sources, I needed an update, otherwise apt-get used the former sources.

    I am having further issues, but this one is solved. Thanks to all who read this post and especially to those who gave their input.

Posting Permissions

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