3

I installed Ubuntu and while fresh, captured the whole drive with the command

sudo dd if=/dev/sda of=/dev/sdb/image.img

then placed it into

/boot/images/image.img

I want GRUB2 to boot from this image, as Windows does with "native boot" technology from VHDX. I copied memdisk into /boot with

cp /usr/lib/syslinux/memdisk /boot/

And created the new file 50_memdisk

/etc/grub.d/50_memdisk

with this content:

#!/bin/sh 
set -e IMAGES=/boot/images .
/usr/lib/grub/grub-mkconfig_lib 
if test -e /boot/memdisk ; then 
  MEMDISKPATH=$( make_system_path_relative_to_its_root "/boot/memdisk" )
  echo "Found memdisk: $MEMDISKPATH" >&2  find $IMAGES -name "*.img" | sort | while read image; 
  do 
    IMAGEPATH=$( make_system_path_relative_to_its_root "$image" )  
    echo "Found floppy image: $IMAGEPATH" >&2  
    cat << EOF menuentry "Bootable floppy: $(basename $IMAGEPATH | sed s/.img//)" 
    { EOF 
      prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/" 
      cat << EOF  linux16 $MEMDISKPATH bigraw  initrd16 $IMAGEPATH 
    } EOF 
  done 
fi

Then I ran

chmod +x /etc/grub.d/50_memdisk && update-grub

But GRUB2 shows while the boot process is returning

out of memory

What did I do wrong?

1
  • This is the right place, and you provided a well detailed question.
    – K7AAY
    Mar 18, 2020 at 17:25

1 Answer 1

0

The image you generated is too big to fit in RAM so a ramdisk is not viable.

0

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.