I have googled a lot for this problem. I found this, but it didn't solve my problem. Other solutions suggest me to reinstall grub (run grub-install), which didn't work either.
Here is what I am doing: (my grub version is 2.02)
- I use grub2-mkrescue to make my X.iso
- I boot a VMWareWorkstation virtual machine, which has a 1.0GB SATA disk, from X.iso
- I install X.iso on disk, the details are:
3.1. erase /dev/sda in case there are old partitions on it: dd if=/dev/zero of=/dev/sda bs=1M count=1
3.2. Create 3 primary partitions on /dev/sda as dev/sda1,sda2,sda3 (the size is 100M, 30M and 70M), and toggle sda1 to be bootable
Disk /dev/sda: 1024 MB, 1073741824 bytes, 2097152 sectors 130 cylinders, 255 heads, 63 sectors/track Units: sectors of 1 * 512 = 512 bytes Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type /dev/sda1 * 0,1,1 12,191,50 63 204862 204800 100M 83 Linux /dev/sda2 12,191,51 16,147,2 204863 266302 61440 30.0M 83 Linux /dev/sda3 16,147,3 25,127,37 266303 409662 143360 70.0M 83 Linux 3.3. Format the 3 partitions as ext2, and mount /dev/sda1
mkfs.ext2 /dev/sda1 mkfs.ext2 /dev/sda2 mkfs.ext2 /dev/sda3 ROOTFS_PATH=/var/.rootfs mkdir $ROOTFS_PATH mount /dev/sda1 $ROOTFS_PATH 3.4 copy files...
for i in bzImage initrd.img vmlinuz-*; do cp -rf /boot/$i $ROOTFS_PATH/boot done cp -f /boot/grub/device.map $ROOTFS_PATH/boot/grub/device.map for i in init linuxrc; do cp -rf /$i $ROOTFS_PATH done for i in bin etc lib sbin share usr; do cp -a /$i $ROOTFS_PATH done for i in dev var proc sys tmp data log; do mkdir -p $ROOTFS_PATH/$i done 3.5 Install grub and make grub config file
chroot $ROOTFS_PATH <<EOF mount -a mdev -s grub-install $tdisk grub-install --recheck $tdisk grub-mkconfig -o /boot/grub/grub.cfg exit EOF - reboot
It says:
. error: disk 'hd0,msdos1' not found Entering rescue mode... grub rescue> And the most strange thing is that ls command shows nothing in grub-rescue cli ---- as someone says, it should show disk list.
