Author Topic: Install GRUB2 to a virtualbox vdi image  (Read 8878 times)

Offline kara

  • Newbie
  • *
  • Posts: 1
Install GRUB2 to a virtualbox vdi image
« on: 2012/07/18, 16:58:33 pm »
Hi!
I tried to install grub2 to a mounted virtual box vdi image, but when I started the virtual machine it didn't work.
I used the following commands for compile and installation:
(in decompressed folder:)
./configure --prefix=/mnt/ --exec-prefix=/mnt/
make
make install
(in /mnt/sbin folder:)
./grub-install --boot-directory=/mnt/boot /dev/nbd0

 The error massage was: „no such device: xxx”

The grub.cfg file doesn't load.

Please someone help me what should I do.

Offline adrian15

  • Administrator
  • Hero Member
  • *****
  • Posts: 833
  • Please test Rescatux and report back feedback...
    • El blog de adrian15
Re: Install GRUB2 to a virtualbox vdi image
« Reply #1 on: 2013/01/19, 11:36:21 am »
Quite strange setup there.

I suppose you have mounted a partition and not the full hard disk.

Although Grub or Grub2 can be installed to a partition what you usually need is to install it to the MBR.

And you're not going to be able to do so if you mount the partition.

Not sure if you can convert the virtual hard disk as a loop device which you can treat as a hard disk and then mount a partition device inside it so that you can then chroot and install Grub or Grub2 from inside it.
If you have liked this piece of advice please consider donating to the Super Grub Disk project.