The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.

    Linux/windows dual boot setup guide, GPT/UEFI edition

    Discussion in 'Asus' started by nipsen, Aug 18, 2013.

  1. nipsen

    nipsen Notebook Ditty

    Reputations:
    694
    Messages:
    1,686
    Likes Received:
    131
    Trophy Points:
    81
    When I reinstalled my system the last time - http://forum.notebookreview.com/asu...sdd-optional-linux-dual-boot.html#post8694736 - I decided to skip past the UEFI boot altogether and use an old, tried and true MBR setup.

    This was the easiest for me from one perspective, because I knew what to expect on beforehand. And this was the best supported method when using linux loaders and older win7 installs. But on the other hand, it involves a lot of restrictions with the amount of partitions you can use. And in the way the bootloader has to be set up. Some knowledge of bootloader commands and config file strings are usually necessary to know. The bootloader can also be overwritten very easily in an install or a recovery, setting you back to a non-functional system.

    So while it's possible, in many ways a dual-boot MBR setup is somewhat risky. After all, you can lose access to your data if you can't recover it, and it might be difficult to correct any errors.

    Having a system without a gpt/uefi setup also will end up making it impossible to boot a "secure boot", or run an upgrade to win8, etc. And with one, it's technically very easy to install new bootloaders while keeping the old ones intact, in case you would want to temp with a new one, or revert to an older one. So working with a gpt-setup might be a really good idea for all kinds of reasons when having a multi-boot.

    For more general technobabble about UEFI, see point 1 in the other guide linked to above.

    But technically a UEFI boot is technically composed of the following:

    [​IMG]
    Beware, Science! (and dark magic)

    -A gpt partition, identified as a gpt partition according to the UEFI specification. A system can have several gpt-partitions. Each gpt-partition can contain more or less any amount of partitions, that can each be identified specifically by a GUID (globally unique identifier).

    -A boot-partition placed inside one of the gpt-partitions, the same as any other partition, except it's designated as a boot-partition according to the UEFI specification.

    The boot-partition, how to set it up, and how to deal with the bootloaders, is largely what we're going to be looking at. The boot-partition is essentially a partition designated as boot-partition, with a /boot/EFI/ directory. Which contains each of the boot-loaders in a separate directory.

    For example, the windows 7 loader defaults to /Microsoft/Boot/. This directory contains a "bootmgr.efi" file, which is the actual efi shell. And any amount of other files the shell uses for various things. This directory with the .efi file is then registered to the UEFI boot partition table.

    In truth, this is not complicated, and with good tools to edit and configure the boots, this would be pretty easy.

    Unfortunately, the tools you can use to edit and configure the boots aren't all that great. And require some trickery with the command line if you want to install a new bootloader manually.

    But since the commands are well documented, and allow different bootloaders to "coexist", there's no real problem to install several different OSes, let them install their own bootloaders - and then pick a specific bootloader later on. Which is the humanly doable solution we're going to demonstrate in this guide.

    Still, before that.

    Problem nr. 1: How to boot into efi-mode.

    The convention that has been chosen for linux installs and windows installs in the end is that if you boot into efi mode when running the install, the default partition setup will be a gpt partition config. And the new bootloader entry will be placed in the efi boot-partition.

    However, if the computer defaults to bios mode, the default partition setup will be a normal setup with a primary partition, a number of extended partitions, and create an mbr entry (potentially overwriting the one already in place).

    (Circumventing this for a default windows install - when you already have primary partitions from earlier installs - is possible via the "rescue console", but not recommended, and might not always give the expected results. Google "convert mbr" and find the syntax for the windows gpt-partition tools if you wish to attempt it).

    Most bioses (like the ami-bios used on a number of different laptop brands) allow you to easily detect which type of boot you want, though. When booting the computer and entering the bios screen -> boot options. Or when simply hitting "esc", the escape, key at the first title screen, you will list the available choices on a standard ami-bios. Other variants that look similar exist.

    When installing via a dvd that contains an efi boot, the entries listed then will be the device (dvd-rw such and such), two times, headed off by "UEFI:" on one of the entries. Picking the UEFI one boots into efi mode.

    If the bios is configured to boot into a uefi mode if available, this boot will be chosen.

    Linux boots work in the same way. As long as you boot into efi mode, setting the partitions and the boot entries in the uefi boot will not be an issue, and will be done automatically.

    Edit: update for windows 8 - for some reason, Windows 8 refuses to accept a fat16 partitioned efi boot partition(and the install actually fails to continue with a fat16 marked boot-partition). So when creating a new efi boot partition, or carrying over a boot partition from an earlier install, make sure you reformat it as a fat32 partition. Note that all you need is a normal partition (at say, 150mb), formatted as fat32 and marked with a boot-flag. Insert previous bootloaders or refind, etc., into a "EFI" directory on that partition.

    Problem 2: Reserve space for the second (and third, etc.) OS.

    During install, reserve an amount of unpartitioned space. Windows setups will allow you to do this by specifying the size of the new partitions. A typical default windows setup will be one user-partition. And Windows will then create two other partitions, which is the uefi system partition (if not already there), and the actual windows bootloader (which Windows will pretend is a new partition, rather than a sub-directory of the uefi system partition. This partition can be mounted later by the command "mountvol driveletter: /s"). If you have a different OS installed on beforehand, the Windows install will complain that it's bootloader partition is not the "first" in the order - there is no reason why this should make a difference, and by all accounts there are no issues adding this partition in any order.

    Your not so average Debian install (such as Mint or Ubuntu) will default to a setup with a system partition, a swap partition, and a root partition. It's useful in some circumstances to have a swap partition at about the same size as the physical ram on the laptop, while you could also add a separate /home partition, for your user files. Reduce sizes as needed to get the amount of free space needed.

    Suse's install routine will be similar, and allows you to reserve the space needed for other partitions by arranging the partition setup before the install.

    Personally, I vastly prefer using a linux boot to setup the laptop initially, for three reasons. 1. You can boot a live-image very quickly, and get a reasonably good partition tool to set up or delete existing partitions before running the actual install. 2. The install routine when actually installing the OS is fast and easily customisable. And 3. the included uefi bootmanager tools are relatively easy to use.

    ---

    Final Problem: The actual bootloader config.

    Very well. So we've installed windows to a part of the hard-drive, and booted into it a few times. We've then installed a linux boot on the remaining space, and booted into this as well. What happens now is that the last OS installed will add it's bootloader, and then register it as a default boot.

    And since it's virtually impossible to make the windows bootloader boot another OS, what we want is usually to select the linux boot (and it's bootloader). Which in turn can slip-load Windows or any other EFI boots that can be slip-loaded on the computer.

    Note that it's possible now to directly boot each of the boot-loaders directly from bios, as long as they're registered properly (via uefi tools). I.e., hit esc at bootup and choose the entry on the hdd directly. It will be named something like "0003 Windows Boot Manager", and so on.

    But we would change the default behavior by using OpenSuse's bootmanager tools, for example. Or by booting into the linux boot, opening a terminal, becoming root, and typing: efibootmgr
    This lists the installed bootmanager entries, which in my case looked like this:
    Code:
    nipsen # efibootmgr
    BootCurrent: 0001
    Timeout: 0 seconds
    BootOrder: 0001,0000,0003,0006,0004
    Boot0000* opensuse
    Boot0001* linuxmint
    Boot0003* Windows Boot Manager
    Boot0004* CD/DVD Drive
    Boot0006* Hard Drive 
    If I wanted to make Suse the first boot, I would run something like "efibootmgr -o 0". (The tool, with a switch -o for "order", and boot-entry nr. 0).

    Just for fun we're going to install another bootmanager called rEFInd. Which is just another efi boot shell, but with a larger range of options when slip-loading other efi-boots on the system.

    This is fairly simple to do. As mentioned earlier, it's three steps.

    1. Mount the system partition, if it's not mounted already. In linux, you would find it under /boot/efi. In Windows, it can be mounted by something like "mountvol z: /s".
    2. Copy the bootloader files to a new directory in the efi bootmanager set. Follow the directions here: The rEFInd Boot Manager: Installing rEFInd But essentially create a new directory(for this example, "refind", under /boot/efi/EFI/refind, extract the files, rename config files, and remove any superfluous modules, as explained at the linked page.
    3. Register the new bootloader. Which in linux would be something like this:
    Code:
    efibootmgr -c -l /EFI/refind/refind_x64.efi -L rEFInd
    (the command, -c for create new entry, -l for specify bootloader, and -L for the label we're going to place in the bootmenu. Note that syntax now allows foreslashes for the directory names. Double backslashes also work.)

    (edit: after going through all this, it turns out that on rEFInd's sourceforge page, very easily installable deb and rpm packages with scripts are actually available. So you can install all of this with just a few clicks. Have to say - it's useful to know what you're actually installing, though.)

    The last step can be replicated in windows with bcedit, but I have literally no idea how. There is also the problem that setting bootloaders from windows may not jive with quick-boot options and resume boots, as discussed briefly at the refind page.

    Now if all goes well, you would have the option to set refind as the default boot. And then use rEFInd to slip-load any of the other efi-boots on the system.

    Or, to pick another bootloader that also detects windows efi boots, and allows you to slip-load it (i.e., Suse and Ubuntu will do this by default).

    And that's that.. simplez! And much safer than all that mbr bootloader hoopla.

    But good luck anyway.