I am getting this error grub-probe: error: failed to get canonical path of ``/dev/loop0p1" when I try to install grub on a partition of a loop device. I perform the following steps to create a partition on the loop device and install grub
1. Create a raw qemu image qemu-img create /anroot/.packages/.build/disk.img 112G 2. Create a loop device with the newly created raw image /sbin/losetup /dev/loop0 /anroot/.packages/.build/disk.img 3. Create multiple partitions on the loop device using fdisk # Running:/sbin/fdisk -l /dev/loop0 Disk /dev/loop0: 112 GiB, 120259084288 bytes, 234881024 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x34628252 Device Boot Start End Sectors Size Id Type /dev/loop0p1 * 2048 4196351 4194304 2G 83 Linux /dev/loop0p2 4196352 130025471 125829120 60G 5 Extended /dev/loop0p3 130025472 192940031 62914560 30G 83 Linux /dev/loop0p4 192940032 234881023 41940992 20G 83 Linux /dev/loop0p5 4198400 46141439 41943040 20G 83 Linux /dev/loop0p6 46143488 88086527 41943040 20G 83 Linux /dev/loop0p7 88088576 130025471 41936896 20G 83 Linux 4. Format the partition to install grub on /sbin/mkfs -F -t ext2 /dev/loop0p1 5. Mount the partition to install grub on /bin/mount -v -t ext2 /dev/loop0p1 /tmp/loop1 6. Install grub on the mounted loop partition /usr/sbin/chroot /tmp/loop1 apt-get install -y grub-imageboot root@build-qemu:/anroot/.packages# /usr/sbin/chroot /tmp/loop1 apt-get install -y grub-imageboot Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: libc6-i386 Use 'apt autoremove' to remove it. The following additional packages will be installed: grub-pc grub-pc-bin syslinux-common Suggested packages: desktop-base The following NEW packages will be installed: grub-imageboot grub-pc grub-pc-bin syslinux-common 0 upgraded, 4 newly installed, 0 to remove and 30 not upgraded. Need to get 2,273 kB of archives. After this operation, 7,154 kB of additional disk space will be used. Get:1 http://10.1.1.176/aff_v1.38_debian buster/main amd64 grub-pc-bin amd64 2.02+dfsg1-20 [901 kB] Get:2 http://10.1.1.176/aff_v1.38_debian buster/main amd64 grub-pc amd64 2.02+dfsg1-20 [131 kB] Get:3 http://10.1.1.176/aff_v1.38_debian buster/main amd64 syslinux-common all 3:6.04~git20190206.bf6db5b4+dfsg1-1 [1,237 kB] Get:4 http://10.1.1.176/aff_v1.38_debian buster/main amd64 grub-imageboot all 0.6 [4,354 B] Fetched 2,273 kB in 0s (14.3 MB/s) debconf: delaying package configuration, since apt-utils is not installed Selecting previously unselected package grub-pc-bin. (Reading database ... 35255 files and directories currently installed.) Preparing to unpack .../grub-pc-bin_2.02+dfsg1-20_amd64.deb ... Unpacking grub-pc-bin (2.02+dfsg1-20) ... Selecting previously unselected package grub-pc. Preparing to unpack .../grub-pc_2.02+dfsg1-20_amd64.deb ... Unpacking grub-pc (2.02+dfsg1-20) ... Selecting previously unselected package syslinux-common. Preparing to unpack .../syslinux-common_3%3a6.04~git20190206.bf6db5b4+dfsg1-1_all.deb ... Unpacking syslinux-common (3:6.04~git20190206.bf6db5b4+dfsg1-1) ... Selecting previously unselected package grub-imageboot. Preparing to unpack .../grub-imageboot_0.6_all.deb ... Unpacking grub-imageboot (0.6) ... Setting up syslinux-common (3:6.04~git20190206.bf6db5b4+dfsg1-1) ... Setting up grub-pc-bin (2.02+dfsg1-20) ... Setting up grub-pc (2.02+dfsg1-20) ... debconf: unable to initialize frontend: Dialog debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.) debconf: falling back to frontend: Readline Creating config file /etc/default/grub with new version grub-probe: error: failed to get canonical path of `/dev/loop0p1'. grub-probe: error: failed to get canonical path of `/dev/loop0p1'. grub-probe: error: failed to get canonical path of `/dev/loop0p1'. What am I doing wrong and how to fix it? Thanks.