Dual Boot

From OpenELEC
Jump to: navigation, search
20px   installation Dual Boot

File:Ambox content.png

This page is incomplete and may require expansion or cleanup. Please help to improve the article, or discuss the issue on the talk page.


The manual installation onto a multi boot system is fairly similar to installation on a single boot system. A disk partition tool such as GParted or PartedMagic will be required.

In this tutorial we will demonstrate the manual installation of OpenELEC onto a single hard drive, multi boot system.


Partitioning

Combinations of operating systems can be numerous, but here we will focus on a multiboot system using Windows, Ubuntu and OpenELEC: a triple boot system. Just because we can.

If you want to build a triple boot system, it is best to install your OS'es in the following sequence:

 1st Windows XP / Vista / 7
 2nd Ubuntu 12.04+
 3rd OpenELEC

Here we will eventually use the GRUB2 bootloader installed by Ubuntu.

OpenELEC itself requires at least 2 partitions. You can add a third partition for swapmemory. If a partition for swapmemory is already present from the Ubuntu installation, OpenELEC will use that existing partition for swapping memory. A swap partition is only recommended for OpenELEC when using computers with less than 1GB internal memory.

Hopefully you have enough free diskspace remaining from partitioning your harddrive for Windows and Ubuntu, because now the 2 partitions for OpenELEC will be created.

 Harddrives can contain upto 4 primairy partitions, after that logical partitions must be created inside an extended partition.
 Bootable Linux partitions (inluding OpenELEC) can also be created as logical partitions.
 Create the first partition, EXT4 format preferably. Label it 'OE_SYSTEM', size 512MB to 1GB.
 In here, the two operating system files KERNEL and SYSTEM will be placed
 Create the second partition, EXT4 format preferably. Label it 'OE_DATA', size.
 Here all local OpenELEC/XBMC data will be placed, such as databases and thumbnails.
 Note: write down the linux drive letters (i.e. /dev/sda3, /dev/sdc2 etc.)that have been assigned to both partitions.
 You will need them later on when adding the OpenELEC entry in the Grub2 bootloader.

Bootable Flag

The OE_SYSTEM partition must be flagged as bootable. This option can be set by you disk partition tool.

Copying OpenELEC Files

Next, both operating system files, SYSTEM and KERNEL, must be placed into the OE_SYSTEM partition. Mount the OE_SYSTEM partition, and copy both files to it via a Terminal session.

 Example: sudo cp /location_of_OE_files/* /media/OE_SYSTEM

Adding OpenELEC to the GRUB2 bootloader

Adding the OpenELEC menu item to GRUB is done by editing the following file:

 sudo gedit /etc/grub.d/40_custom

or

 sudo nano /etc/grub.d/40_custom

An example:

 #!/bin/sh
 exec tail -n +3 $0
 # This file provides an easy way to add custom menu entries.  Simply type the
 # menu entries you want to add after this comment.  Be careful not to change
 # the 'exec tail' line above.
 #
 menuentry "OpenELEC" {
    search --set=root --label OE_SYSTEM --hint hd0,msdos3
    linux /KERNEL boot=LABEL=OE_SYSTEM disk=LABEL=OE_DATA quiet
 }
 menuentry "OpenELEC debugging" {
    search --set=root --label OE_SYSTEM --hint hd0,msdos3
    linux /KERNEL boot=LABEL=OE_SYSTEM disk=LABEL=OE_DATA debugging
 }

Please note the /dev/sda3 and /dev/sda4 devices correspond to the two OpenELEC partition device names that you created earlier in this tutorial. In the example, /dev/sda3 corresponds to the partition labelled 'OE_SYSTEM' which KERNEL and SYSTEM have been copied to, and /dev/sda4 corresponds to the partition 'OE_DATA' which was left empty.

Please note that GRUB2 differs from GRUB regarding the partitions schemes, as it starts enumerating partitions from 1 instead of 0. Within GRUB2, the notation 'set root=(hd0,3)' corresponds to the third partition on the first drive, i.e. 'sda3'. The two values shall match.

Now, we will finalize the grub menu addition(s):

 sudo update-grub

If all went well, reboot and the OpenELEC entry will show up in the GRUB2 bootloader, and OpenELEC will be selectable.


old

20px   OpenELEC Configuration Dual Boot

File:Ambox content.png

This page is incomplete and may require expansion or cleanup. Please help to improve the article, or discuss the issue on the talk page.


File:Ambox content.png

This article discusses something which the OpenELEC team provides zero support for and may even be potentially dangerous. If something goes wrong you are on your own. Proceed at your own risk.


This guide follows is given as a courtesy only for the advanced or adventurous user.


This tutorial describes how to set up a multi boot environment for Ubuntu and OpenELEC.


In the end you get a system that boots to a Grub menu with openelec selected by default (so if you do/press nothing, OpenELEC loads automatically after some seconds).

  • First of all, I assume you're using a HTPC with a new (unformatted) HD. If not and is your HD already formatted, you can skip this step.
  • Download Ubuntu and create an Ubuntu boot cd (if your HTPC has an optical drive) or a boot usb. Instructions for creating either a boot cd or boot usb is listed on the Ubuntu download page. I recommend downloading Ubuntu 10.04 since it is the latest LTS.
  • Turn on the HTPC with the Ubuntu boot cd/boot usb inserted. The Ubuntu installer will load. Follow the instructions to install Ubuntu.
  • When you get to the "Prepare disk space" step, choose Specify partitions manually (advanced).
  • Before continuing, read --Partition layout guide-- at the end of this tutorial for optimal partition locations. If your hdd is unformatted you will need to first click "New Partition Table".
  • Then add an EXT4 partition that is at least 5Gb. Specify it's mount point as /. If you plan on using Ubuntu for more than just minimal operations, you should (optional) also create a swap partition at this time (just create a partition of type "swap" that is the same size as the RAM you installed in your HTPC).
  • Continue following the onscreen instructions to complete the installation, reboot when completed and remove the boot cd/boot usb.
  • Power on the HTPC and it will boot into Ubuntu. Select System -> Administration -> Update Manager, and install any updates listed. You may end up rebooting a few times depending on the updates.
  • In Ubuntu, download the latest OpenELC build (http://openelec.tv/get-openelec). Remember where you download this to as you will need it later (the default is /home/[username]/Downloads).
  • In Ubuntu, select System -> Administration -> Synaptic Package Manager. Search for "gparted" and install the package (right-click on it, select "Mark for installation", then click "Apply" at the top of the screen).
  • With gparted installed, select System -> Administration -> GParted. We are now going to create the partition for OpenELEC and the partition for OpenELEC's data storage.
    • Right-click the "unallocated" partition below your Ubuntu partition and select "New". Create an EXT4 parition of at least 512MB. Place this partition at the end of the hdd (so "free space following" should be 0). This will be the OpenELEC boot partition. Make a note of the partition's name, should be in the format "/dev/sdaX" where "X" is an integer (for example, /dev/sda3).
    • Create another EXT4 partition of at least 4Gb. This partition will be used for OpenELEC's data storage, so make it as big as you want for local movies/music/etc. As well as for OpenELEC library data. If you created a swap partition for Ubuntu earlier, place this new partition within the same extended partition that houses the swap; otherwise, place this partition directly preceding the OpenELEC boot partition. Make a note of this partition's name, should be in the format "dev/sdaX" where "X" is an integer (for example, /dev/sda4).
    • Click "Apply" to create the partitions.
  • Select Places -> 512MB Partition (or whatever size you made the OpenELEC partition), this will mount the partition in Ubuntu. Right-click the OpenELEC build you downloaded in step 5 and choose "Extract Here". The extracted folder will contain a subfolder "target" with two files, KERNEL and SYSTEM. Copy these two files to the root of the OpenELEC partition. Congratulations, you have just installed OpenELEC.
  • Now that OpenELEC is installed, you need to update the boot loader to be aware of its presence. Open a terminal (shortcut ctrl-alt-t) and run
 sudo nano /etc/grub.d/40_custom
  • You may be prompted to enter your administrative password before being allowed to edit the file. Once in the file, paste the following information to the end of the file. Note that boot=/dev/sdaX must be the partition name of your OpenELEC partition, and disk=/dev/sdaX must be the partition name of your OpenELEC data partition, so make any necessary changes below before copy/pasting. Also, root=(hd0,Y) should point to the openelec partition (so Y should be either 3 or 4).
menuentry "OpenELEC.tv" {
   set root=(hd0,3)
   linux /KERNEL boot=/dev/sda3 disk=/dev/sda4 quiet
}

menuentry "OpenELEC.tv (Textmode)" {
   set root=(hd0,3)
   linux /KERNEL boot=/dev/sda3 disk=/dev/sda4 textmode quiet
}

menuentry "OpenELEC.tv (Debugmode)" {
   set root=(hd0,3)
   linux /KERNEL boot=/dev/sda3 disk=/dev/sda4 debugging textmode quiet
}
  • To save the changes using nano, hit ctrl+x -> y -> enter.
  • Alternatively, you can use UUID's to point to the partitions in Grub which will allow OpenELEC to still boot if the drives bus order is changed(eg different SATA port, changed boot order or in a different computer). root= and boot= point to the OpenELEC boot partition and disk= points to the storage partition. use the command blkid to get the UUID's of your partitions.
menuentry "OpenELEC.tv" {
    search --no-floppy --fs-uuid --set=root 21247e93-512c-4aab-894b-caa7cb3a8930
    linux /KERNEL boot=UUID=21247e93-512c-4aab-894b-caa7cb3a8930 disk=UUID=df911cc6-741b-4f8a-8ef1-3ca012a95d58 quiet
}

menuentry "OpenELEC.tv (Textmode)" {
    search --no-floppy --fs-uuid --set=root 21247e93-512c-4aab-894b-caa7cb3a8930
    linux /KERNEL boot=UUID=21247e93-512c-4aab-894b-caa7cb3a8930 disk=UUID=df911cc6-741b-4f8a-8ef1-3ca012a95d58 textmode quiet
}

menuentry "OpenELEC.tv (Debugmode)" {
    search --no-floppy --fs-uuid --set=root 21247e93-512c-4aab-894b-caa7cb3a8930
    linux /KERNEL boot=UUID=21247e93-512c-4aab-894b-caa7cb3a8930 disk=UUID=df911cc6-741b-4f8a-8ef1-3ca012a95d58 debugging textmode quiet
}
  • (optional, but recommended) The bootloader is now aware of OpenELEC, but it would be nice if it selected it by default.

Open a terminal and run

 sudo nano /etc/default/grub
  • Change the following values:
GRUB_DEFAULT="OpenELEC.tv"
GRUB_HIDDEN_TIMEOUT=
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=5

The value of GRUB_DEFAULT is the boot item selected by default, so by setting it to the menuentry name we set in Step 9 the Shuttle will boot into openelec if no other command is given. GRUB_TIMEOUT is the amount of time in seconds that the user has to select a different boot item before the default is selected. Increase or decrease this value as suits your needs. I recommend setting it to at least 5 seconds.

You can completely hide the Grub screen by setting GRUB_TIMEOUT=0 and hold the left shift button on a keyboard to bring up the Grub menu. Until you have the left shift button working keep Ubuntu as your GRUB_DEFAULT, otherwise making changes to Grub will be difficult. You may need to edit /etc/grub.d/30_os-prober depending on your multi-boot setup. See [1] and [2].

  • Last step. Open a terminal and run
 sudo update-grub

This saves all of your Grub settings.

Note that if you want to install a third OS there will be extra steps to get the boot menu updated properly. This is especially true if you want to install Windows, since installing Windows overrides the boot menu and requires you to reinstall it. I added Windows XP to my system and used this guide to reinstall grub: help.ubuntu.com/community/Grub2#Reinstalling%20from%20LiveCD Very simply, you just have to boot off your Ubuntu boot cd/usb, reinstall grub into the ubuntu partition, restart the HTPC, load up Ubuntu, and run "sudo update-grub" for grub to automatically detect the Windows partition. At this point you may need to edit the grub openelec settings again (see below for more details).

Partition layout guide

When you have more than one partition on a hdd, it is wise to carefully choose where you want each partition located. I recommend using this setup:

V BEGINNING OF HDD
[Ubuntu EXT3/EXT4 partition]
[(optional)Ubuntu swap partition]
[UNUSED SPACE]
[OpenELEC EXT4 data partition]
[OpenELEC boot partition]
^ END OF HDD

The reason behind this setup? The OpenELEC boot partition should never have to be resized, so placing it at the end of the hdd is a safe bet. By keeping [UNUSED SPACE] in the middle of the hdd, the Ubuntu partition and/or OpenELEC data partition can expand without affecting other partitions. If you want a third os such as Windows installed, place it on the side of the [UNUSED SPACE] that you think is least likely to be resized (for example, if you don't think Ubuntu will ever need more space, place Windows directly following Ubuntu).

Note that hdd's support a maximum of 4 primary partitions (at least under gparted), so if you want to install a third OS make sure you have a free primary partition left to use.