1

I installed Ubuntu 14.04 LTS using a bootable USB pen drive, creating a dual boot with Windows 10. Windows and the EFI partition are on a disk, Ubuntu and its swap partition are on another disk. During the installation I chose as destination for Ubuntu's bootloader the EFI partition (I also tried in a precedent installation to choose not the EFI partition, sda2, but the whole sda disk, resulting however in the following problem).

After the installation, if I try to boot without the pen drive plugged in, the Grub console comes up and I can't go on. The only way I can boot normally is plugging in the pen drive, in this way the OS selection screen in showed and I can go in with the boot.

I tried executing the boot-repair tool, both from the installed version of Ubuntu and from the Live USB, it goes up to the end normally and says that the boot procedure has been repaired but if the I try to boot without the pen drive plugged in, Grub comes up again.

1 Answers1

1

Yours is a common problem, and your question is a duplicate, although I've been unable to find a relevant duplicate through a web search.

Ubuntu installs GRUB in EFI mode in a crazy way, with parts scattered across two partitions:

  • The EFI System Partition (ESP) holds the grubx64.efi binary and one or two other related files. In your case, this is on the hard disk.
  • The GRUB configuration file is stored in the Ubuntu /boot directory, which in your case is on the USB flash drive. The GRUB configuration file defines the boot menu you normally see, so if it's inaccessible, you get an unhelpful grub> prompt (or something similar).

There are a number of solutions, including:

  • Create a /boot partition on your internal disk -- This will put all the critical GRUB files there, so GRUB will continue to work.
  • Install another boot manager, such as my rEFInd boot manager -- rEFInd doesn't rely on cross-partition configuration files for basic functionality, so if you install it to your internal disk's ESP and make rEFInd the default, you'll be able to boot Windows when the USB drive is unplugged or either OS when the USB drive is plugged in. With the right options set in /boot/efi/EFI/refind/refind.conf, you'll be able to boot straight to Windows when the USB drive is unplugged and straight to Ubuntu when the USB drive is plugged in.
  • Install a customized GRUB -- It's possible to configure GRUB to rely on a configuration file on the ESP rather than in /boot. This requires considerable expertise to set up. See this page for some coverage of this topic. (Note that the page includes a notice that it's outdated and to refer to another page, but the newer page lacks the relevant details.)
  • Rely on the computer's built-in boot manager -- Usually, hitting Esc, Enter, F8, or some other function key brings up a boot manager that will let you select between Ubuntu and Windows. You can use this to control the boot process and bypass GRUB when the USB drive is unplugged.

EDIT:* I've just filed a bug report about this problem:

https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1567534

Rod Smith
  • 44,284
  • 7
  • 63
  • 105
  • Thank you for the answer and the bug report. I would like to apply the first of your proposed solutions since it seems the less drastic and would work as I want, so I followed this guide: https://help.ubuntu.com/community/BootPartition . However, boot-repair gets stuck during the procedure, I waited almost 45 minutes but it didn't continue. In addition to that, now Ubuntu has booting problems even with the pen drive plugged in, probably because the bad execution of boot-repair caused some troubles. Am I doing something wrong? Can it be done in a different way? – NeutronsCollision Apr 07 '16 at 17:18
  • Parts of that procedure contain BIOS-mode assumptions. It's unclear to me what state your computer is in, so it's hard to recommend a path to fixing it. (I don't know what files are on your new /boot partition or how it's configured, for instance.) If you can't boot to Ubuntu at all, though, you could try putting rEFInd on a USB flash drive and boot with it, at least temporarily. That should get you up and running well enough to try to fix your problem. – Rod Smith Apr 07 '16 at 18:31
  • Don't worry about those problems, I can format everything but I need to be able to have Ubuntu correctly installed in dual boot with Win10 at the end. With the procedure shown in that guide, using boot-repair, I can't complete the creation of the /boot partition because it always gets stuck. Is there any other way in which I can try to do it? – NeutronsCollision Apr 07 '16 at 20:26
  • If you're willing to re-install, you can always delete your Ubuntu partitions and re-install from scratch. You'll need to use the "Something Else" partitioning option and clearly identify the /boot partition on your internal disk as such. See here (or many other questions/answers) for more on "Something Else" partitioning. – Rod Smith Apr 08 '16 at 12:55
  • I did re-install Ubuntu this some hours ago and I think I've been able to fix the problem. I've re-installed Ubuntu choosing the option which automatically deleted the previous installation and reinstalled the system. I noticed that, differently from the first installation, now in "the following partitions are going to be modified" list there were 3 partitions (the new /boot partition was included). However even in this way the Grub console was coming up if the pen drive wasn't plugged in. (1/2) – NeutronsCollision Apr 08 '16 at 15:03
  • I pugged it in, started Ubuntu and installed Grub from the terminal (it said that it wasn't installed when I gave the "grub" command). After that, Ubuntu seems to be booting normally even without the pen drive plugged in. How can I check if the boot partition is now being used, in a way that if it is not I'll use that space in a different way? (2/2) – NeutronsCollision Apr 08 '16 at 15:04
  • Type df -h to see a list of partitions and mount points. Pay attention to the root (/) filesystem and /boot. If you did it right, root (/) will be on your USB drive (probably /dev/sdb) and /boot will be on the internal disk (/dev/sda). The automatic options are highly unlikely to do what you want; using "Something Else" is almost certain to be required. – Rod Smith Apr 08 '16 at 18:16