BUILDING A MEDIA CENTRE PC WITH XBMC / KODI

Every now and then I come across a project I'd like to do with leftover IT equipment I have purchased or found around the house. The latest project I am working on is an XBMC PC. I'd just like to point out for reference and as a disclaimer. This is mainly for my own personal use, and if the build is insecure then that's your issue for not researching it. My build may not be secure, but it works fine. This is mainly used as a guide to help others who are stuck

For the purposes of this document, I am assuming your PC is booting XBMC and it's installed on a seperate HDD

PROGRAMS USED FOR BUILDING XBMC PC

BUILDING AN XBMC PC

  1. Firstly, when you are building a PC you will need to make sure you have a blank HDD to install XBMC. If the HDD isn't blank you can choose to wipe it during the installation stage. Load the CD in the drive and let the installation run through. You will get a prompt, choose the default option to start XBMC from the CD-ROM
  2. When you logon to XBMC this is the "home" screen but not an administrator screen. You will need to logon to the admin console for this. If you don't all changes will be lost when you shutdown the computer
  3. Click on the power button at the bottom left of XBMC and select exit
  4. At the "logon" screen, enter the username xbmc. Then clicking on the wrench icon (top right of the screen) choose XBMCUbuntu from the drop down then leave the password field blank and press enter
  5. This will log you into the main administrator section, there will be an icon called "Install XBMC" select this option
  6. You will then be prompted with a wizard. Select the option for installing onto your hard drive. I selected the option for wipe hard drive completely and do a fresh install (default option), then run through all of the options in the wizard inputting the details as requested. Making note of the usernames and passwords. When the wizard is finished, click next and it will run through the installation. When this is complete, it will prompt you to choose an option
  7. Shutdown the PC it will ask you to eject CD then press enter. Once this is done, your computer has XBMC installed on the HDD and you can use it as normal
  8. If your HDD is of a large size (i.e 2-4TB) and you are planning on storing movies on there, you are fine to go straight ahead and copy the files directly into the home folders with filezilla if required. If you are installing additional HDD's you will need to read on further

INSTALLING ADDITIONAL HDDS

  1. Install additional HDD (formatted or not into computer)
  2. Install the Gparted boot disk into CD-ROM drive and make sure BIOS is set to boot from CD Drive first
  3. When Gparted appears, press enter to accept the default option. Select enter on the loading menus for the default options or choose appropriately
  4. When Gparted loads it will scan your installed HDD. Scanned HDD will show in the window, you can switch between them with the arrow at the top right which also shows the size of the HDD
  5. Once you have the right HDD selected, right click on the all the partitions at the top and select delete partition then click apply
  6. After all partitions are deleted you will have an "unformatted partition", which is the full-size of the disk
  7. Right click here and select new partition. Accept the defaults which will be partition the full size of the disk and ext4 file system. At this point I'd also recommend giving the disk a label so you can ID it later
  8. Once you have given the disk a label, click OK. All the requested jobs will be run.
  9. Carry out this same procedure for all HDD's as required. When finished, click on the exit Gparted and follow instructions.
  10. When the computer is restarted. Connect to your XBMC PC using putty
  11. Now you will need to create a folder which will mount your HDD to the XBMC setup
  12. You can't use folder names which already exist. So what I did for simplicity was add the number2 at the end of each folder
  13. For example /home/xbmc/Videos2 - this helps me ID that it's a Videos HDD and a mount one
  14. Try to leave out any spaces in file names (otherwise you will need to use a \ before the space to signify this) easier just to have no spaces in the filenames
  15. To create a folder name you run the following command (replace <user> with XBMC logon name for the computer) that you created in previous stages sudo mkdir /home/<user>/<directory>.. e.g sudo mkdir /home/xbmc/Videos2
  16. After you have created this, you will then need to specify the drive to map on start up in the computer
  17. Run the following command via putty sudo blkid and after you press enter a list of partitions will be displayed. It should be easy to find your hard disk if you added a label in previous steps, if not you will need to ID partitions to see which one is yours.Once you have it, select the numbers/letters with your mouse (putty automatically copies anything) so you don't have to press Ctrl+C like you would windows.
  18. Now go back to putty prompt and input the following command sudo nano /etc/fstab
  19. This will load up the file system table, find the next blank entry and input the blkid of the hard disk following the same string as the other drives (e.g) UUID=REALLYLONG12345NUMBER /mountdrive nobootwait 0 0 for reference the "mountdrive" is the folder you created in step15 (etc /home/xbmc/cars2)
  20. When you have inputted the above values for EACH individual hard disk, press Ctrl+X to save changes
  21. You will then get a message to confirm changes, press the letter Y
  22. You will then get a message asking you to write the file, press enter
  23. You then input the following command sudo mount -a, after you press enter, any drives will be mounted. If there's errors in your stab file it will be displayed here for you to correct or resolve

TRANSFERRING MEDIA TO XBMC COMPUTER

  1. To transfer media from your computer open up Filezilla
  2. In the file menu - go to File > Site Manager
  3. Click new > enter the hostname (IP address, you can obtain this from the system tab on the XBMC computer)
  4. Protocol - SFTP
  5. Username and Password will be as setup when you first installed XBMC (for me it was xbmc/xbmc for simplicity)
  6. When it's setup click connect, you should then be able to navigate to /home/xbmc/FOLDERNAME and copy over the files over your network from host PC to target PC

PROBLEMS ENCOUNTERED WHEN SETTING UP XBMC

Below is a list of all the problems that I encountered when setting up my media centre PC. Hopefully this can help act as a quick point of reference to guide others in right direction. I have posted a full list of resources and links that I used for finding information in the hope of providing back links and guidance to people who need the help. I am normally a Windows user, so going from Windows to Ubuntu proves a bit difficult when you aren't used to. With this way it should get you up and running in no time with a bit of luck. It's quite cool having a media centre computer. You can host all of your files and watch them over http webpages on your local LAN

Unable to see the drives in XBMC when they're installed

Due to the XBMC running from Ubuntu, it's not like Windows where the drives automatically map and install from drivers. Ubuntu drives have to be mounted into the computer. If they're not mounted, then nothing will work and you won't be able to see the data. This is a multi-step process if you haven't followed the steps above. If you have followed the steps, then there wouldn't be an issue.

Basically, you need to create a directory into the home folder as a mount point, find the blkid with sudo blkid command parameter. Then when you have this information, you open the fstab file (sudo nano /etc/fstab) and add in the parameters to mount the disk. Once this has been done, you shold find the disk will appear under storage information for system after you have "mounted" the disk with the command line parameter sudo mount -a

Drives constantly sharing the same device ID (such as /dev/sda1)

When I first researched this problem, it took a while to understand how to solve it because everytime I looked into changing the device ID I kept getting redirected to links about changing the device partition. The instructions all revolved around deleting the partition on the computer and starting over again before you could rename it. I knew this wasn't what I wanted. Basically to stop your computer mapping each drive to /dev/sda, it's best to run the sudo blkid command. This has a unique UUID for every HDD which means you can map multiple folders and the host O/S will configure the drives as required. Remember to mount the drives one your configure the fstab (sudo nano /etc/fstab) by running the mount command to map the drives into the computer sudo mount -a

How to create directories and delete them

Easy one, just run the parameter sudo mkdir /etc/loginusername/foldernameyouwantcreated

To delete a directory (that's empty), you enter the command sudo rmdir /etc/loginusername/foldernameyouwantcreated

It gets a bit tricky when you start having spaces in filenames as you have to enter a \ to specify it, this is why I don't use filenames.

Copying files into directories (non-home) through Filezilla, resulted in permission denied message

Issue caused to to non-write permissions in newly created directories. Using Putty, run the following command on the folder created by yourself including spaces where listed. For example if the new directory (called cat) was created in the home folder and the logon username was "XBMC", you would enter the following command:

sudo chmod 777 /home/xbmc/cat

XBMC halting when booting due to "missing" drives - prompts for Skip, Ignore or Manual Recovery

This is due to a record in the FSTAB (File System Allocation Table) with an incorrect paramater. You need to modify the parameters at the end so instead of saying referring to remount, it prompts for nobootwait run the following command within Putty to open the fstab records

sudo nano /etc/fstab

This will then bring up the records, most likely if you were like me you copied the entries above for the partition IDs. This will be something along the lines of

partition name /mount/directory errors=remount-ro 0 1

Once you have found the lines you are looking for, amend the value (errors=remount-ro 0 1) and replace this with the value of noboot wait 0 0 (SEE BELOW FOR EXAMPLE)

partition name /mount/directory nobootwait 0 0

This will then prevent XBMC from halting when it finds an error with the fstab records for those entries and then allows the computer to boot as normal. For reference, this value is only for the drives holding my information such as Movies, TV Shows and Music. It's not on the main drive holding the operating system. If XBMC doesn't boot because of this you should fix the issue

 

RESOURCE REFERENCES

These are all the links I read through when I was fixing my XBMC setup as I had to do a lot of research, hopefully it will help out others if you need the direct points, but I think the information I posted above should help you for the most part. The first links I've shown are probably the best ones I found by far for helping me with major issues and how I managed to overcome them after researching the below links

This is also a comprehensive list showing all the pages and articles I went through to fix the problems I encountered or the copious amount of research I had to do with the PC before I could get it in a working state