I have a 1Gb HDD image (created using bximage for Bochs), onto which I wish to install Grub 2.

I understand that a Grub installation consists of 3 parts:

  • The boot.img image, which occupies the first sector
  • The core.img image, which occupies space following the first sector up until the start of the next track
  • And the /boot/grub/ directory, in which the grub.cfg and other modules are located.

First I use a boot.img image that from within my own Linux /boot/grub/ directory.

Following this, I generate my core.img image using the following command:

sudo grub-mkimage -v --format=i386-pc -o core.img -p\(hd0,msdos1\)/boot/grub ls ext2 part_msdos

And to install them onto the final disk image, I use the following commands:

  • sudo dd if=boot.img of=/dev/loop0 bs=446 count=1 the 446 blocksize is used so as to not overwrite The partition data that resides within the MBR
  • sudo dd if=core.img of=/dev/loop0 bs=512 seek=1 and here, seek=1 is so as to not overwrite the MBR that was just written.

The disk, starting from sector 2048 until the last, is formatted with an ext2 partition, and contains a boot/grub/ directory containing a grub.cfg (with a single bogus menuentry which doesn't load anything), and modules in the /boot/grub/i386-pc/ directory.

Bochs successfully boots this installation of grub all the way to the grub> prompt. As This Ubuntu guide points out, this behaviour indicates that grub.cfg was not found.

Upon invoking ls, I am faced with an interesting problem - I apparently have no devices connected at all!

To further elaborate on the nature of the problem, I observed that when booting a grub-mkrescue image from a slave drive, invoking ls displayed its own rescue drive, and the previously 'non-existant' primary disk drive, along with the ext2 partition. I verified that /boot/grub.cfg could indeed be accessed.

From this observation I would assume that my own core.img is missing some fundamental module or functionality. But which, and how would I amend this?

I also conducted this exercise on a physical machine using a USB stick, and the exact same thing happened, so I can confirm that the problem is not with Bochs.

2 Answers 2


As it turns out, I was indeed missing a module, more specifically a disk driver, namely biosdisk:

From OSDev Wiki:

biosdisk -  This module is required for GRUB 2 to be able to boot from a LiveCD.

Even though the original author has found a reason for the failure in his case and shared it with the rest of community I found another issue which causes exactly the same behaviour:

ls invoked in grub rescue shell yields no devices.

If for any reason *.mod files are stripped of vital symbol information then grub-install silently builds core.img but that core.img cannot use any modules packed along.

Even such "harmless" stripping option as --strip-unneeded results in loss of two important symbols grub_mod_init and grub_mod_fini. Without these symbols grub modules are loaded but not initialized and so are unusable.

If you really want to strip grub's modules then you should add -K grub_mod_init -K grub_mod_fini to strip's command line.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .