Installing RAID5 + Crypt + LVM: issue installing Grub chrooted
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.
Second step: create the Raid arrays (+format ext4).
# 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
Third step: crypt and name.
# 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
Fourth step: create the VGroup.
# 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
Fifth step: create the logical volumes.
# pvcreate /dev/mapper/md2encrypted
# vgcreate –v VGraid5 /dev/mapper/md2encrypted
Sixth step: launch Debian installer
# 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
Seventh step: prepare for installation using chroot.
# 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
Eighth step: install grub (that's where all this stops and I do not understand why).
# 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
The systems tells me there's no such package, even though it is referenced by other packages:
# chroot /mnt/target /bin/bash -c "apt-get install grub"
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 :cry:
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
Could anyone let me know what is wrong with this command?
Thank you in advance