Config dualboot

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.


 * 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.

sudo nano /etc/grub.d/40_custom
 * 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


 * 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 }

Open a terminal and run sudo nano /etc/default/grub
 * (optional, but recommended) The bootloader is now aware of OpenELEC, but it would be nice if it selected it by default.

GRUB_DEFAULT="OpenELEC.tv" GRUB_HIDDEN_TIMEOUT= GRUB_HIDDEN_TIMEOUT_QUIET=true GRUB_TIMEOUT=5
 * Change the following values:

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 and.

sudo update-grub This saves all of your Grub settings.
 * Last step. Open a terminal and run

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.