Can't create a bootable disk by doing image creation on a loop device

Bug #1824245 reported by Neal Gompa on 2019-04-10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)

Bug Description

I'm trying to create a bootable disk image using an image file mounted as a loop device with partx.

While the grub-install succeeds, when I attempt to boot in KVM or VMware, it fails with the following error:

error: no such device: 92136917-76ff-4115-9eed-9caa20529682.
Entering rescue mode...
grub rescue> _

The grub boot configuration entry my process creates is pretty simple:
menuentry 'Ubuntu LTS (v16.04)' {
  search --set=root --no-floppy --fs-uuid 92136917-76ff-4115-9eed-9caa20529682
  loopback loop /images/16.04.img
  linux (loop)/vmlinuz root=UUID=92136917-76ff-4115-9eed-9caa20529682 rootdelay=120 rw quiet panic=5 vga=791 consoleblank=0 max_loop=256 splash loop=/images/16.04.img net.ifnames=0 nomdmonisw nomdmonddf bootdegraded=true audit=1
  initrd (loop)/initrd.img


I think it's because this commit is missing from Ubuntu 16.04's grub2 package:

Could this get fixed in some way?

I'm using Ubuntu 16.04.6. The current grub2 package version is "2.02~beta2-36ubuntu3.21".

Neal Gompa (ngompa13) wrote :

I'll also note that it sometimes works with UEFI, but I've never gotten it to work with BIOS...

Neal Gompa (ngompa13) wrote :

I'll note that this configuration is loop images on a disk that was created as a disk image file mounted as a loop.

Neal Gompa (ngompa13) wrote :

I've verified locally that this does fix my issue when I patch grub myself.

Changed in grub2 (Ubuntu Bionic):
status: New → Fix Released
Changed in grub2 (Ubuntu):
status: New → Fix Released
Changed in grub2 (Ubuntu Xenial):
status: New → Triaged
importance: Undecided → Medium
Neal Gompa (ngompa13) wrote :

Bump? What about Ubuntu 16.04?

Neal Gompa (ngompa13) wrote :

cyphermox, could you please backport the fix for Ubuntu 16.04?

Neal Gompa (ngompa13) wrote :

cyphermox, if this helps, I've created a patch that directly applies on top of the existing grub2 sources reconstructed with `dpkg-source -x` that I've tested locally to work.

Colin Watson (cjwatson) wrote :

The /sbin change there is wrong; please cherry-pick instead.

Neal Gompa (ngompa13) wrote :

cjwatson, I've updated the patch accordingly...

Timo Aaltonen (tjaalton) wrote :

The bug description should follow the SRU style:

An upload of grub2 to xenial-proposed has been rejected from the upload queue for the following reason: "SRU information not provided.".

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers