I think this behavior is raised by the grub search command in memdisk:

1. in the reproducing step 8, press e and then press F2 to make ourselves to be 
dropped into the grub shell
2. cat (memdisk)/grub.cfg, shows
   grub shell> cat (memdisk)/grub.cfg
   if ! search --file --set=root /.disk/info: then
        search --file --set=root /.disk/minu-info
   fi
   set prefix=($root)/boot/grub
   if [ -e $prefix/x86_64-efi/grub.cfg ]; then
        source $prefix/x86_64-efi/grub.cfg
   else
        source $prefix/grub.cfg
   fi

3. investigate the search behavior, 
it seems that grub iterates hd before cd always.

grub-core/disk/efi/efidisk.c

static int
grub_efidisk_iterate (int (*hook) (const char *name))
{
  struct grub_efidisk_data *d;
  char buf[16];
  int count;

  for (d = fd_devices, count = 0; d; d = d->next, count++)
    {
      grub_snprintf (buf, sizeof (buf), "fd%d", count);
      grub_dprintf ("efidisk", "iterating %s\n", buf);
      if (hook (buf))
>.......return 1;
    }

  for (d = hd_devices, count = 0; d; d = d->next, count++)
    {
      grub_snprintf (buf, sizeof (buf), "hd%d", count);
      grub_dprintf ("efidisk", "iterating %s\n", buf);
      if (hook (buf))
>.......return 1;
    }

  for (d = cd_devices, count = 0; d; d = d->next, count++)
    {
      grub_snprintf (buf, sizeof (buf), "cd%d", count);
      grub_dprintf ("efidisk", "iterating %s\n", buf);
      if (hook (buf))
>.......return 1;
    }

  return 0;
}

4.  usb will be regarded as hd device, so the search command always set
the variable root as usb (more precisely, any other hard disk devices
with .disk/info) instead of our selection, DVD

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1198846

Title:
  [efi boot to unexpected media] plug in live usb and DVD at the same
  time, try to boot from DVD but it comes to usb

To manage notifications about this bug go to:
https://bugs.launchpad.net/oem-priority/+bug/1198846/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to