First let me tell about my system, it is Linux Mint system and there is no GRUB Loader congired as such, it directly boots the Linux Mint. And whatever I did it, is with qemu by referring google. And I haven't configured my UEFI boot also I'm unaware of UEFI boot completely.
I have created a qemu image file as a step one with the following command,-
qemu-img create -f qcow2 ubuntu_stdio_drive.qcow2 64G
And then I have loaded my linuux .iso file and installed my VM with the following command,-
qemu-system-x86_64 -machine accel=kvm -cpu host -smp 4 -m 12G \
-drive file=ubuntu_stdio_drive.qcow2,format=qcow2 \
-cdrom ../ubuntustudio-24.04.3-dvd-amd64.iso \
-boot d \
-net nic -net user \
-vga std -display gtk
In order to boot my qcow2 qemu image I am using virt-manager with the help of underlying libvirtd daemon
But I wanted this image to be added in my GRUB Loader during my machine boot up. For this I had followed these steps,-
sudo modprobe nbd max_part=8
sudo qemu-nbd --connect=/dev/nbd0 ubuntu_stdio_drive.qcow2
lsblk
(output that I've got concerning the qcow2 image mount)
nbd0 43:0 0 64G 0 disk
├─nbd0p1 43:1 0 1M 0 part
└─nbd0p2 43:2 0 64G 0 part
# My Local Bash commands which I tried
# 1. Mount the root filesystem
sudo mount /dev/nbd0p2 /mnt
# 2. Mount the boot/EFI partition (if applicable, e.g., for UEFI)
anand@inc:~/ISO/qemu-images$ sudo mount /dev/nbd0p1 /mnt/boot/efi
mount: /mnt/boot/efi: wrong fs type, bad option, bad superblock on /dev/nbd0p1, missing codepage or helper program, or other error.
dmesg(1) may have more information after failed mount system call.
anand@inc:~/ISO/qemu-images$ sudo grub-install --boot-directory=/mnt/boot /dev/nbd0
Installing for i386-pc platform.
Installation finished. No error reported.
So I wanted to know whether I can configure my linux VM in my GRUB Loader