When you want to install Ubuntu in dual boot with Windows 8, you need to take into account that you can encounter some problems. Today I’ll tell you an anecdote and explain how you can fix the following problem: grub doesn’t start on a Ubuntu 14.04 dual boot with Windows 8.1.
A week ago I installed Ubuntu 14.04, codenamed Trusty Tahr, alongside Windows 8.1 on a friend of mine’s computer. I did not install the available updates upon installation, to make it faster. Everything worked well: UEFI did not cause any trouble, both Ubuntu and Windows started as expected. I then installed the Italian locale packages and postponed the updates.
Today I finally found the time to update the installed packages. Once installed, I restarted the computer in order to apply and test the update. And here comes the surprise: grub didn’t start, the pc booted Windows directly.
We have a problem, but fortunately Windows is not compromised. So, let’s go and fix the problem.
If grub doesn’t start, we can’t access Ubuntu directly. Here’s what you need:
Nothing else? Exactly, that’s it.
The first thing you can do is using Boot Repair to reinstall grub with all the options you need. You can find instructions about how to install and use in the Ubuntu Community Help Wiki.
Most probably the first attempt with Boot Repair didn’t solve the problem. But we are Linux users, so we can find a solution by searching in the Web and with a little bit of luck.
Boot into your live Linux distro (from now on we’re going to call it just “Live”) and open GParted or any other partition manager it has. Look for your Ubuntu system partition and write down somewhere its file name (that in the form /dev/sdxn, in my case /dev/sda7) and its filesystem. We’ll call it /dev/sda7, but keep in mind to change it when you type down the commands.
First things first: chroot into your system to execute the actions needed to fix the issue. Open the terminal, login as root and mount Ubuntu. Replace /dev/sda7 with your partition, and ext4 with the filesystem of your partition.
sudo sucd /mount -t ext4 /dev/sda7 /mntmount -t proc proc /mnt/procmount -t sysfs sys /mnt/sysmount -o bind /dev /mnt/dev
If your /boot directory is on a different partition from your /, you’ll also need to mount that partition with the following command (remember to replace ext4 and /dev/sda2:
mount -t ext4 /dev/sda2 /mnt/boot
Now it’s time to move into the mounted system, which is your Ubuntu installation:
chroot /mnt /bin/bash
If it returns the error chroot: cannot run command '/bin/bash': Exec format error, this usually indicates that you booted with one architecture (e.g. 32bit) and are trying to chroot into another (e.g. x86_64), so you need to use a Live that has the same architecture.
At this point it is useful to add a remainder to the prompt:
source /etc/profileexport PS1="(chroot) $PS1"
And make sure /etc/mtab is up to date:
grep -v rootfs /proc/mounts > /etc/mtab
Here the point is to change the order in which UEFI boots the system. First of all, have a look at the current order:
efibootmgr -v
This will output something like this:
BootCurrent: 0005Timeout: 0 secondsBootOrder: 2002,0004,0000,0001,2003,2001Boot0000* ubuntu HD(2,e1800,82000,0a543b96-7861-11e2-8d38-d60b12dec0bc)File(EFIubuntushimx64.efi)Boot0001* Ubuntu HD(2,e1800,82000,0a543b96-7861-11e2-8d38-d60b12dec0bc)File(EFIubuntugrubx64.efi)RCBoot0002* EFI Network 0 for IPv6 (7C-05-07-9C-F6-18) ACPI(a0341d0,0)PCI(1c,2)PCI(0,0)MAC(7c05079cf618,0)030d3c000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000RCBoot0003* EFI Network 0 for IPv4 (7C-05-07-9C-F6-18) ACPI(a0341d0,0)PCI(1c,2)PCI(0,0)MAC(7c05079cf618,0)IPv4(0.0.0.0:00.0.0.0:0,0, 0RCBoot0004* Windows Boot Manager HD(2,e1800,82000,0a543b96-7861-11e2-8d38-d60b12dec0bc)File(EFIMicrosoftBootbootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}................. ...Boot0005* EFI DVD/CDROM (TSSTcorp CDDVDW SN-208DN)ACPI(a0341d0,0)PCI(1f,2)03120a00020000000000CD-ROM(1,11a6,1680)RCBoot2001* EFI USB Device RCBoot2002* EFI DVD/CDROM RCBoot2003* EFI Network RC
Here you can identify the names of the devices and operating systems that are recognized by UEFI. In the example above, we want to prioritize shim, which is the first signed bootloader for Ubuntu, the component responsible for loading grub.
How can we achieve this? By simply typing the following command into our terminal:
efibootmgr -o 0000
We did it! Exit your terminal, reboot the computer. If all went well, you will now be able to see grub at the startup.
If something went wrong, please report it in a comment below.
Sources:
Photo courtesy of
by is licensed under a .
.