2

I need to reconfigure grub to use a different install device. Other threads indicate that there will be a screen that prompts me to select a device:

However, no such screen exists. It exits after the 2nd one.

How do I select the boot device?

Screen 1 enter image description here

Screen 2

enter image description here

After Screen 2

enter image description here

  • You appear to want grub-install , but your start of description asking for reconfigure (which won't do what you appear to want) has me a little confused of what you want; grub-install installs to different devices/drives – guiverc Feb 23 '20 at 21:36
  • With UEFI you have to have an ESP. And Ubuntu's versions only install to first ESP it finds. Grub install also default to first drive, but you can specify another ESP, but must only have one ESP per drive. See also: man grub-install. https://askubuntu.com/questions/617045/how-do-i-install-two-independent-ubuntu-installations-on-a-single-hard-drive-wit – oldfred Feb 23 '20 at 21:49
  • 1
    @guiverc: no, OP is right - dpkg-reconfigure grub-pc should be the right thing to do here. grub-install will install GRUB once manually, and never update it again. dpkg-reconfigure grub-pc on the other hand will store the devices you've chosen in debconf, and then run grub-install on these devices on every GRUB/kernel update. Why it sometimes just won't ask I haven't been able to figure out myself yet, debconf sometimes is just super finicky :( – Martin von Wittich Jul 06 '20 at 16:22
  • @OP: try upgrade-from-grub-legacy and then running dpkg-reconfigure grub-pc; the former resets the configuration stored in debconf, and should force dpkg-reconfigure to ask again. No idea though why it won't just work. – Martin von Wittich Jul 06 '20 at 16:24
  • Ah, I think I've figured it out. Apparently I did debconf wrong, because it's actually grub-pc's postinst which decides whether to ask or not. It will always ask when /boot/grub/i386-pc/core.img exists, and never if it does not. /boot/grub/i386-pc/core.img should normally exist, and if it doesn't, something went wrong in the past. upgrade-from-grub-legacy is in fact the correct solution, because it will create the required core.img. – Martin von Wittich Jul 06 '20 at 17:18

2 Answers2

3

This appears to be due to a change introduced to avoid potential corrupted systems. I've filed a bug report about this as this just bit me during a RAID failure.

Update: The bug has been confirmed and triaged as high priority against basically all supported versions of Ubuntu.

Update #2: Fix has been released for Focal and Groovy! I'm hoping someone on the Ubuntu team is tracking Bionic.

Update #3: Fix has been released for Bionic!

Brian Turek
  • 1,826
0

grub-pc's postinst decides whether to ask this question. In my case, I've tracked it down to the following condition:

        elif test -z "$2" || test -e /boot/grub/core.img || \
             test -e /boot/grub/i386-pc/core.img || \
             test "$UPGRADE_FROM_GRUB_LEGACY" || test "$wubi_device"; then

So if /boot/grub/i386-pc/core.img exists, it will always show the prompt. If it doesn't, it'll (practically) never show it.

/boot/grub/i386-pc/core.img should exist under normal circumstances, so chances are, something went wrong in the past to cause this issue. To resolve the situation, run the following command:

upgrade-from-grub-legacy

This should create the required core.img and reset the installed devices debconf configuration, and afterwards dpkg-reconfigure grub-pc should work as expected.

You might be getting the following error, which is caused by a bug:

dpkg-maintscript-helper: error: environment variable DPKG_MAINTSCRIPT_NAME is required

In this case, the following command should work:

DPKG_MAINTSCRIPT_NAME=postinst DPKG_MAINTSCRIPT_PACKAGE=grub-pc upgrade-from-grub-legacy
  • 2
    Didn't work for me. Ubuntu 18.04. Even though core.img exists, upgrade-from-grub-legacy always says it doesn't and tries to create it. And dpkg-reconfigure still won't show the third screen. – Larsen Aug 03 '20 at 08:45