3

I'm installing ubuntu on my computer at the office. Since I never installed ubuntu alongside with an existing windows on a UEFI system, I want to avoid all possible problems. I already read all the available documentation but still have a short question. In my computer I have two SSDs, one for windows 7, the other will be entirely dedicated to ubuntu. If I want to be sure to be able to get back to the initial state, can I just create a new EFI partition on the second disk and set this disk as boot priority? Will then be windows 7 automatically found by GRUB? And, if I'm running into problems, can I just switch boot priority in my setup and I will boot windows?

10
  • 3
    Before installing anything on your office computer, make sure your IT department is on board; you could be terminated for computer tampering if you install anything without authorization.
    – Zeiss Ikon
    Feb 28, 2017 at 12:19
  • I have authorization. They just do not have time for supporting linux
    – David
    Feb 28, 2017 at 12:21
  • 2
    OK then. Yes, it can be done and has the advantage of being able to boot that drive standalone even in a different UEFI enabled machine later on. But there's no problem in using the default installation that will add the Ubuntu entries to the ESP of the first drive regardless of where Ubuntu is installed. That can be easily "reset" if/when you decide to remove the second drive/Ubuntu, directly from Windows or the UEFI itself.
    – user589808
    Feb 28, 2017 at 12:27
  • @CelticWarrior Ok, thank you! So actually there should be anything to worry about choosing as booting partition the EFI partition of the Windows disk. If I decide to create a new partition in the second disk (this still remains my favourite, since so I could just remove the disk and all will be just like before) the Windows partition should be found without problems by the grub, right?
    – David
    Feb 28, 2017 at 12:34
  • 1
    Yes, it should but sometimes it doesn't (this is irrespective of the method). Just disable Fast Startup in Windows and shutdown (reboot often reverses the changes). Then boot Ubuntu and run sudo update-grub.
    – user589808
    Feb 28, 2017 at 12:43

1 Answer 1

1

The last I heard, there was a bug in the Ubuntu installer that caused it to always place GRUB on the EFI System Partition (ESP) on the first disk (usually /dev/sda), even if you tried to force it onto another ESP (say, one on /dev/sdb). This fact can make separating your Windows and Ubuntu installations a little trickier than you might like. Also, the way Ubuntu configures GRUB, it's reliant on both files on the ESP and a grub.cfg configuration file in the Ubuntu /boot/grub directory, which is not on the ESP. Thus, if you install Ubuntu and then delete it by deleting the Ubuntu partition(s), GRUB will remain behind, but with its grub.cfg file gone, the computer will hang at a grub> prompt when you boot. This problem can be overcome by manually deleting the GRUB files from the ESP or by tweaking the boot order using efibootmgr in Ubuntu or EasyUEFI in Windows before deleting the Ubuntu partitions.

Alternatively, you could follow this procedure to install Ubuntu:

  1. Download the USB flash drive or CD-R version of my rEFInd boot manager.
  2. Write the rEFInd image to a USB flash drive or CD-R, as appropriate.
  3. Boot the Ubuntu installer in its "try before installing" mode. This results in a normal Ubuntu desktop.
  4. Open a Terminal window.
  5. Type ubiquity -b. This launches the installer, but the -b option tells it to not install GRUB.
  6. In the installer (or before you run the installer, if you prefer), set up your partitions, and be sure to include an ESP on the second disk (the one to which you're installing Ubuntu).
  7. When you're done with the installation, reboot using the rEFInd disk. You should see the rEFInd menu appear. (A caveat: The rEFInd disk images I distribute do not support Secure Boot. Thus, if Secure Boot is active, you'll need to either disable it or modify the rEFInd image to include Shim. You can re-enable Secure Boot later, but you may need to jump through some extra hoops at that time. Windows 7 does not support Secure Boot, so you shouldn't run into this problem. I mention it in case somebody wants to do something similar with a Windows 8 or later installation.)
  8. Using the rEFInd menu, boot Ubuntu. (A caveat: If you use a separate /boot partition, you'll need to hit F2 or Insert twice and add a ro root={rootfs} option, where {rootfs} is a pointer to the root (/) filesystem, such as /dev/mapper/lvm-root. This is normally only necessary if you use LVM or software RAID.)
  9. In Ubuntu, check and, if necessary, alter /etc/fstab so that it mounts the ESP in Ubuntu's directory tree at /boot/efi. If you need to change this detail, be sure to unmount anything that's already mounted there and mount the Ubuntu disk's ESP at /boot/efi before proceeding.
  10. Install your preferred boot loader.
    • If you want to use GRUB 2, install the grub-efi package. You may also need to run sudo grub-install and/or sudo update-grub.
    • If you want to use rEFInd, install the rEFInd Debian package or PPA. If you're asked if you want to copy rEFInd to the ESP, be sure to respond affirmatively.

At this point, when you reboot you should see GRUB or rEFInd appear and you should be able to boot either Windows or Ubuntu. If you want to go back to a stock factory installation, you can wipe all the partitions from the Ubuntu disk, including the ESP, and the computer should skip over the now-invalid entry for GRUB or rEFInd and go straight to booting Windows. (If you use rEFInd, it should continue booting Windows even if you delete all the Ubuntu partitions but leave the ESP on which rEFInd resides intact.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .