1

I have a VirtualBox with Debian Jessie. After some point I decided to create new virtual drive, encrypt it with LUKS, and copy old system to it without reinstalling. I've used several guides (1,2,3,4) to do this, but something goes wrong - when I'm trying to boot from the second drive, I'm getting black screen with cursor (not even sure if it blinks). Looks like that is some kind of a grub related problem.

What was before is just a system on a single partiton:

Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors
Device     Boot    Start      End  Sectors  Size Id Type
/dev/sda1  *        2048 40136703 40134656 19,1G 83 Linux
/dev/sda2       40138750 41940991  1802242  880M  5 Extended
/dev/sda5       40138752 41940991  1802240  880M 82 Linux swap / Solaris

New disk is /dev/sdb 40Gb. I've prepared this drive as in 1, then mounted this drives and copy everything from old system:

# mount /dev/mapper/vg-root /mnt/
# mount /dev/mapper/vg-home /mnt/home
# cp -a cp -a /bin /boot /etc /home /lib /root /sbin /usr /var /mnt

Then chrooted to "new" system:

# mount -t proc none /mnt/proc
# mount -t sysfs none /mnt/sys
# mount --bind /dev /mnt/dev
# chroot /mnt

Modified fstab:

/dev/mapper/vg-root     /               ext4    errors=remount-ro 0       1
/dev/mapper/vg-home     /home               ext4    errors=remount-ro 0       1
/dev/mapper/vg-swap     none            swap    sw              0       0

Added changes to crypttab, initramfs and grub:

# echo 'lvm /dev/sda2 none luks' >> /etc/crypttab
# echo 'lvm2
  dmcrypt' >> /etc/initramfs-tools/modules
# update-initramfs -k all -u

Added options to /et/default/grub:

GRUB_CMDLINE_LINUX="cryptdevice=UUID=3bd9c402-92aa-4bf8-9644-7c7a079e1cf6:lvm"
GRUB_ENABLE_CRYPTODISK=y

then installed grub # dpkg-reconfigure grub-pc and verified /boot/grub/grub.cfg (pastebin)


After trying to boot from this second drive I'm getting black screen with cursor. No errors, not texts of any kind. I think that even grub wasn't started...

Any ideas except to reinstall?

0

I've fixed this. Looks like either # dpkg-reconfigure grub-pc works somewhat different comparing to "grub-mkconfig - grub-install" way or I've used it wrong.

Anyway, I've installed it by executing

# grub-mkconfig -o /boot/grub/grub.cfg
# grub-install /dev/sdb

just as Pavel Kogan wrote and now grub boots.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.