Quick post this — originally on evolve.sbcs but behind a wall there so reposted here — both in case anyone's interested and in case something breaks and we have to remember what we did, exactly (the far more likely scenario) Ubuntu. Everyone loves it - probably the world's easiest dual-boot install going and you get a lot of features out of the box as well. So, for the Windows user who needs Linux features / reliability / configurations but wants to keep a copy of Windows on their system for Office or just build testing, Ubuntu is a great solution. Well, at least, it used to be. Then Microsoft went and released Windows 8. Quite apart from being an even worse resources hog than W7, it also introduced the horror that is UEFI and a whole load of hell was unleashed. That's because UEFI - a seemingly harmless set of 'improvements' to bootloader management (the bit of firmware on your motherboard which locates the OS, introduces it to RAM and disk controllers, and generally makes everything you see happen) — is actually a right pain in the arse. Typically for Microsoft, UEFI isn't just overloaded with features which dilute its core purpose: it actually introduces unpredictable behaviour which makes life for anyone nosing beneath the surface of the operating system (Windows) the machine comes with (not just on those trying to dual boot - although I suspect they were the main targets, as millions of people trying Ubuntu for free and realising what an unstable rip-off Windows 8 is wouldn't play well with shareholders...) Which is all a ranty way to say that the lovable Ubuntu install process I've used for pretty much a decade on Windows 7, XP, Vista and even 98 machines - all of which happily budge up a bit to make room for a dual-boot Ubuntu installation - has been well and truly borked by Windows 8 and their crappy UEFI lock-in. In particular, Hernani, one of our new students, has been issued a shiny new Dell (good for him) with Windows 8 loaded via UEFI (not so good). The install process was markedly more complicated than other Windows / BIOS versions, and while this is a common problem, I couldn't find a single tutorial online able to help our specific problem - so here you go (PS: I / the lab / QMUL disclaim all liability, express or implied, should you attempt the steps below and suffer...):
- Create an Ubuntu Live / bootable install USB
- Shrink your Windows partition
- Back up your files and make a Windows Restore CD / USB
- Access the UEFI bootloader
- Install Ubuntu
- Re-activate UEFI
- Check GRUB
- Install boot-repair
- Check GRUB
- Keep backing up your files!
Create an Ubuntu Live / bootable install USB (or CD)First we need to create a CD or a USB which we'll use to install Ubuntu (and/or run a 'live' session, where you run the OS directly off the disk without installing to the hard drive. This lets you test Ubuntu and verify it works on your machine). This is a very well covered topic, not least from Ubuntu.com themselves, but I'll just note that we installed Ubuntu 12.04 LTS (long-term stable), 64-bit release onto a USB - the machine in question having no optical drive. We used Unetbootin for this.
Shrink your Windows partition to create space on the hard drive for UbuntuTo install Ubuntu we'll need at least 100Gb free disk space. How much of the available space you want to give to Ubuntu is up to you, and probably depends on whether you plan to use your machine mainly in Windows 8 or Ubuntu; Ubuntu can see the Windows partitions, but not the other way round. To do this we need to shrink the existing Windows partition and repartition the existing space. This subject is well covered in this guide (which we started with) but the subsequent steps gave us more trouble (hence this post)...
Back up your files and make a Windows Restore CD / USBThere is a fairly high chance that this will result in a fried filesystem, and you may not even be able to get Windows to boot. You might also lose data if you screw up the disk partitions. So back up all your files. This is very important — not doing so practically guarantees the jinns of Murphy will screw up your hard drive for you. I don't care how you do this, just do it. Equally, since we might bork Windows well-and-truly (possibly a good thing but it would be nice to do so on purpose rather than accidentally) it makes sense to burn a Windows Recovery CD (or USB) at the very least. Again, you can do this easily and there's lots of tutorials out there, so I won't deal with it here, except to say you'll need this to be on a separate USB/CD to the Ubuntu one we just made.
Access the UEFI layer and switch to legacy BIOSThe operating system itself (Windows, OSX, Linux etc) doesn't actually run straight away when you start the computer. This is, in fact, why you can install / upgrade / change / dual-boot various different OSes. Instead, a small piece of software hardcoded onto your motherboard which runs when you hit the power button to start the machine. This is the black screen you glimpse as the machine reboots. Most commonly this software ('firmware' in fact, since it is rarely changed or updated) is called BIOS, but a new standard called EFI has become more common in recent years (Windows' own flavour is the hellish UEFI). Its main job is to find all the various device drivers (monitor, keyboard, hard disks, USB ports), introduce them to the CPU and RAM, and then hand the whole lot over to an operating system on a disk somewhere to make the good stuff happen. Note that I said 'an' operating system, located somewhere on 'a' disc - there's no reason why Windows should be picked, and why the disc should be the hard drive, and not... say... an Ubuntu install USB! :) So, to access this magical BIOS-y, UEFI-y world where we can tinker about with the default OS we need to shut the computer down, then restart it, and in most personal computers until now hitting a setup key on restart (usually something like F2 or F12) repeatedly would stop the BIOS/UEFI from loading and access a special setup screen. Unfortunately, Windows 8 has a 'feature' (read: 'restriction') built in called Secure Boot which normally prevents you from doing this insanely simple procedure. Instead there's a vastly more complicated process which is luckily well explained in this SO thread. Scroll down to 'Windows 8 + Ubuntu' to do this. Once you have rebooted into BIOS/UEFI, the version that shipped with this Dell (an Opteron 9020 ultra-compact) has a screen with an 'advanced boot/UEFI options' submenu and a 'secure boot' submenu. Enter the secure boot menu, disable secure boot and click 'apply' to save changes then enter the UEFI screen. The most important option on this screen selects between bootloader modes: 'UEFI' and 'legacy' (which means BIOS). We'll need the legacy / BIOS mode to install Ubuntu from USB, so select this. The previous set of UEFI options will be replaced by a set of devices. This is the main difference from our point of view - in BIOS mode the computer will try each device for a bootloader file, in the order in which they appear, and the first one found will be run. EFI, on the other hand, is able to look non-sequentially on a device (e.g. a disc) for a specific bootloader. However: we just want to get on with our Ubuntu installation, so make sure the device with your Ubuntu installer (USB or CD) is listed first, click 'apply' then 'exit' (making sure said media is actually inserted!)
Install UbuntuThe process to install Ubuntu itself is actually simple enough, and covered in truly exhaustive (some might say 'tedious') detail elsewhere - but there's a couple of installation points we need to note at this stage for our specific application. Again, if you're doing a complete wipe of Windows you can just to a complete erase and you'll be fine:
- Select 'something else' in the main install options - do not erase Windows if you want to dual-boot.
- There's probably not much point in installing the updates and third-party stuff at this stage - I had to reinstall Ubuntu a few times by trial and error, and the extra packages take a while to download, unpack, and install. Anyway, you can get them later on when the installation's debugged.
- The order and location of your partitions matters, a lot. This process is covered in more detail in this SO thread, but to summarise (you should read the whole SO post though):
- You'll need 50Gb (50000Mb) for the Ubuntu OS itself, formatted as ext4 and mounted as root '/'. On our Dell this is /dev/sda7
- You'll need 16Gb (15999Mb) for swap space (Windows users will know this as 'virtual RAM'. This is technically optional but running without it is very likely to crash frequently from RAM shortages.
- Don't touch the existing (Windows) partitions
- You'll want to partition the remaining disk space as ext4 (probably) and mount it at '/home'
- Make a note of the password you select for Ubuntu! Otherwise you'll have to reinstall...
- Finally - and this is important - although other guides say the bootloader should be written to:
/dev/sdawe found this didn't work with our Dell UEFI. Instead we had to install the bootloader to:
/dev/sda1which worked fine.
Re-activate UEFIThe install process complete, we now need to switch the UEFI back on; this will continue to be the main way you call the bootloader from now on, but hopefully we'll be using GRUB (a linux bootloader) instead of the Windows bootloader. GRUB allows you to pick which OS to boot every time you restart the computer (it defaults to Ubuntu, but you can choose Windows 8 if you want, it won't care!) and should be configured automatically. However, we'll need to turn UEFI back on first: shut the computer down. Wait 5-10 seconds. Now restart it, hitting F2 (or other BIOS / UEFI setup menu hotkey) as soon as you hit the power button to access the UEFI / BIOS screen again. From the BIOS / UEFI, find the advanced boot options, deselect Legacy mode (BIOS) and reselect UEFI. This will put us in UEFI mode again, so we have to configure the UEFI options to choose the GRUB bootloader. You should see that an 'ubuntu' option has appeared in the UEFI list as well as the Windows boot manager. Select this, then click 'view' to see which bootloader file it points to. In our installation, 'ubuntu' pointed to (filesystem FS0): /EFI/boot/shimx64.efi. This will simply load ubuntu directly. If you only plan to use Ubuntu, you can stop here, as this option will find Ubuntu every time you reboot. However, we wanted to use GRUB to pick Ubuntu or Windows, so there's an additional step here: Click 'add boot option' (or 'path', or similar) to create a new UEFI boot option. Give it a name (we went for 'GRUB', logically enough). Then we need to pick the bootloader file itself - this is the file the UEFI will try and find, which will then handle the OS selection and initialisation. In our case, the file we were looking for was (again on filesystem 'FS0'): /EFI/boot/grubx64.efi. This is the file to load GRUB, but while you're poking about in here you may also see a directory for Windows and the bootloaders (there's a few) associated with it. Select this file, save the UEFI option and make sure this is the first boot option in the list (use arrows to move it up) and/or uncheck (don't delete...) the other options ('Windows boot manager' and 'ubuntu' probably). Click 'apply' then 'exit' and the machine will reboot...
Check GRUBIf we were installing next to Windows 7, Vista, XP, NT, 2000, 98 - or almost any other OS - we'd be able to have a cup of tea and a celebratory hobnob at this point, as after rebooting the machine the friendly GRUB boot selection screen would pop up at this point and let us select Ubuntu, Ubuntu recovery mode, memtest or indeed Windows with a simple dialog. We found that GRUB loaded OK, but although all the linux-y options came up, it couldn't show the Windows boot option. Damn you, Windows 8 - in W7 this is no problem at all. We also wouldn't have had to prat about with UEFI settings, either but hey, Windows 8 is shiny and looks a bit like iOS, so it must be better, right... A fair few people have actually managed to get GRUB to function correctly at this stage on W8, but then they're not reading this blog, are they? ;)
Install boot-repairIf the GRUB bootloader works (that is, you see the GRUB selection screen) but the Windows installation you irrationally cherish so much isn't shown, you'll need to edit the GRUB config files to include the location of the Windows bootloader files so that GRUB can display them as an option for you. You can sleuth about the hard drive to find both the GRUB config and Windows .efi files but luckily there's a handy script from YannUbuntu called boot repair which does this for you. I followed instructions from the SO thread we used before (here, section 'REPAIRING THE BOOT'). In their words, "In Ubuntu after it boots, open a Terminal and type the following:
sudo add-apt-repository ppa:yannubuntu/boot-repair sudo apt-get update sudo apt-get install boot-repair
boot-repair"That will bring up the boot-repair script (even has a handy GUI). This is pretty easy to use; the 'recommended repair' will probably fix things for you assuming you've set everything else up OK.