How To – Making a Media Center Using Ubuntu 12.04 LTS
For quite some time I have been away from the HTPC scene (~2 years), having resigned to using a Roku Player with the Plexapp channel for home media purposes. I recently took another look last week at the HTPC option for my home. Safe to say, I found I could safely get 80 percent of what I wanted for a media box out of the experience. The Dell GX755 PC slim desktop is now tucked safely into the TV stand, and it works beautifully. How did I do it it? Why? Read on for more.
Table of Contents
The purpose of this over something like Mythbuntu or other AV Linux distributions, was I wanted to hand tailor it myself, and in doing so, enjoy the experience. When you do something like that, you get a much larger sense of accomplishment. If you want an easy setup, something like GeexBox, Mythbuntu, or Element OS will fill those shoes. Feature wise I had a very specific set of requirements if I were to make another run at an HTPC in the living room:
- Some sort of remote option that negates the use of a full keyboard and mouse
- The Linux distro fully setup for a 10 ft. viewing interface including the browser and themes
- Xbox controller functionality
- Blu Ray support and decoding keys
- Media channels or direct access to: Youtube, XBMC, Netflix, Hulu, Pandora, Slacker, Spotify, Amazon Video, Steam, Plex Media Center/Server, and more
- Quick shortcuts or access to administrative functions including: shutdown, reboot, show desktop, minimize/maximize, interface settings, and more.
- Simple way to update the system, or an automated method that is safe enough.
- Simple backup methodology, with option to reboot and image the system as well.
- Access to Samba servers and CUPS printers in my house
- Full onscreen keyboard that works for all functions of the system
- Functioning computer of course
- Optional: Xbox wired PC controller
- Some sort of micro remote with optional mouse movement integrated
- Optional: The xboxdrv userland module
- Linux applicatoins: Pipelight, VLC, XBMC, Spotify Beta, Firefox
- Graphics card capable of 720p or 1080p playback. Take into consideration AMD’s lower performance (currently at time of writing) to Nvidia on Linux, as well as additional performance hits from using Netflix under pipelight.
- Capable processor (suggested: Core 2 Duo or above equivalent). Take into consideration additional performance hits from using Netflix under pipelight.
- Knowledge of bash scripts and using GitHub recommended.
- Ubuntu 12.04 LTS
- Intel Core 2 Duo E series, clocked at 2.0 Ghz stock (soon to be Quad Core Q6600)
- AMD HD 6670 Low-profile graphics card (DVI/HDMI)
- Slim desktop pictured second from the left above. (Referred to Dell as a “desktop” form factor). This model can be found online for around 50 dollars US.
- The full Dell Optiplex GX755 specifications sheet can be found here.
- Mini keyboard found here on Amazon.
- Microsoft certified Xbox PC controller
- 2.5 inch form factor SD/MMC/USB media card reader
- Blu Ray disc drive
- Super cool, and uber awesome Linux stickers
In my examples, I will be using Ubuntu 12.04 LTS, which is a fine choice for a number of reason. First, Ubutu has a wealth of packages that mix long standing Debian staples and non-free programs (look away if you are a strict FOSS advocate). Ubuntu’s well suited support for many popular methods and applications for easy media playback is quite admirable. I do realize and suggest you review other alternatives as well, including Linux Mint, ZorinOS, Elementary OS, Mythbuntu, and others. I will go through the multiple steps involved in my project, as well as reference github links to the mentioned files. Any steps detailing more than basic steps will be in a subsection within this piece.
Getting a “10 foot interface” down is always an ongoing work in progress. While I achieved 80 percent of what I wanted through tweaks, utilities, and command line foo, there is some areas I still have to tidy up just a bit. I went through several modes of trial and error on usability and work flow management, which is detailed in my final thoughts section at the end. If you prefer individual icon adjustments ont the desktop, you can right click the icons, and choose “resize icon.” Without further adieu, let’s begin.
Utilities/Applications required for this section:
First, let’s head into ‘dconf’ to tweak a few things first. dconf is a “tool to collect a system’s hardware and software configuration. It allows to take your system configuration with you on the road, compare identical systems (like nodes in a cluster) to troubleshoot HW or SW problems.” Additional tweaks as I test them will appear here. Any numerical value can be adjusted to your liking. Areas of interest will be:
- /org/gnome/desktop/interface/ , Name = “cursor-size”, Value= “65”
- /org/gnome/desktop/interface/ , Name = “font-name”, Value= “Ubuntu 16”
- /org/gnome/desktop/interface/ , Name = “icon-theme”, Value= “ubuntu-mono-light”
- /org/gnome/desktop/interface/ , Name = “text-scalling-factor”, Value= “1.5”
- /org/gnome/desktop/interface/ , Name = “toolbar-icons-size”, Value= “large”
- /org/gnome/desktop/interface/ , Name = “ubuntu-overlay-scrollbars”, Value/Action= Uncheck Visible Box
In order, these do the following:
- Change the cursor size to a nice large mouse pointer (As the default Adawaita mouse is fixed to a certain max size). In order to enable this, change your mouse cursor to option 6 with the following terminal command:
sudo update-alternatives --config x-cursor-theme
- Change the file system fonts during desktop sessions to larger size. Also see below on #5 for text scaling.
- Change the default font to one that is a bit darker to be seen from far. Adjust value to “ubuntu-mono-dark” to see the opposite.
- The text scaling factor is a much cleaner way than messing with fonts (see below for MyUnity tool). Do not adjust this in large increments! Adjusting in .5 increments should be safe.
- This value will adjust the Unity dock icons to the largest value without editing complex XML code in the theme itself.
- This option is pure choice. I am not a fan of the little simulated button slider that shows up when you are near a scrollbar. You may like it though.
MyUnity is a neat little tool to tweak Ubuntu’s Unity interface specifically, nothing that partial to any gnome underpinnings. It is quite handy. A little side note: if you have trouble seeing areas of the program (it doesn’t seem resizable), adjust your text font or scaling temporarily. The following settings are one’s I chose to modify. Some of these are optional, and you should be careful not to mix certain font options in contrast to any ‘dconf’ settings you made. You can use this tool over dconf, but I wanted to show folks this if they are not comfortable with dconf.
- On the first tab, you can optionally remote the Unity launcher by setting “Behavior” to “Hidden.” I do not suggest this if you plan on using full screen browser options. You will see the size should already reflect what we set in dconf.
- On the “desktop” tab, of note should be the “Active Show Desktop” feature for hiding windows (if you keep the Unity dock).
- In the “font” section, you may adjust things to your liking, but like mentioned above, be careful.
- In the “themes” tab, set your theme. I particularity like the NaturAlinea-Dark theme, due to the large Close, Minimize, and Maximize buttons. To install any themes, exit My Unity, and do the following:
tar -xvzf Name_of_Theme.tar.gz sudo cp -R Name_of_Theme/ /usr/share/themes/
- Make sure to resart MyUnity and check for the theme.
Adding available programs to the desktop
Since Unity is a headache, you can’t simply right click a program from the Unity Dash and tell it to copy to desktop. The easiest method for this is to open your Home folder, and navigate to (from the left side bar) File System > usr > share > applications. Right click any icon here and choose “Copy to Desktop” Viola!
Note: This next section is optional. you can always purchase an IR remote or wireless remote from newegg or amazon. For a quick setup, you can always run the quick –mouse option:
sudo apt-get install xboxdrv -y sudo rmmod xpad sudo xboxdrv --mouse
Easy Setup (pre-configured mappings)
- LS (move): move mouse cursor
- LS (click): backspace
- LS (move): mouse scroll
- RS (click): space
- D-Pad: up/down/left/right
- Reset: Alt+Left
- Start: Alt+Right
- LB: PageUp
- LT: VolumeDown
- RB: PageDown
- RT: VolumeUp
- Y: enter
- A: mouse left-click
- B: mouse right-click
- X: mouse middle-click
The next biggest thing is setting up the “xboxdrv” userland module. This is probably one of the most involved steps, and is optional, but you will love the usefulness once you get this setup up. A sample file is located on my git repository or you can use the sample file located under “/usr/share/doc/xboxdrv/examples/mouse.xboxdrv”. Some helpful hints can be found on OMGUbuntu. In the end, if you don’t wish to use the config file, you can use QJoyPad if that suits your needs. The first thing you will want to do, is install xboxdrv with the command:
sudo apt-get install xboxdrv
The utility itself is very useful, but with proper setup, it can be amazing. Next up, we will find the necessary info that makes this setup tick. Needed here, is the ID of the udev event, as well as some optional tweaking to adjust buttons, and finally, testing and implicating it. Let’s begin.
udevadm monitor --udev‘ from the terminal application and then plug in the xbox controller. You will see some output that looks like this:
In the example above, my Xbox controller even ID is “event17”. With this information in hand, let’s first create a sample config file. I have created a sample ini file on the github repo found here. Use the following commands to obtain the files for this project:
sudo apt-get install git git clone https://github.com/ProfessorKaos64/UbuntuHTPC_1204_LTS cd UbuntuHTPC_1204_LTS
In this directory you will find xbox-mouse.ini. Go ahead an copy that file to where you wish, but it is best to just keep it where it is, as I will be updating this repository from time to time. Using the command ‘git pull’ in the “UbuntuHTPC_1204_LTS” folder from the Terminal will grab the latest files from the repo. The following configurations are currently set:
- LS (move): move mouse cursor
- RS (move): mouse scroll
- D-Pad: up/down/left/right
- Back Button: keyboard backspace
- Start Button: Shutdown/Restart Menu
- LB: “Back” in Firefox, using this add-on. Locked F4 to LB in .ini file
- LT: Volume Down, mapped using Ubuntu keyboard shortcut F7, Locked F7 to LT in .ini file
- RB: “Forward” in Firefox, using this add-on. Locked F5 to LB in .ini file
- RT: Volume Up, mapped using Ubuntu keyboard shortcut F8, Locked F8 to RT in .ini file
- Y: keyboard space
- A: keyboard enter
- B: mouse right-click
- X: mouse left-click
- Xbox Center Button – call up onboard keyboard. Ubuntu keyboard shortcut, custom set to onboard/F6, locked F6 to center button in .ini file
You can map these according to your controller output with udevadm. The reason I use F1/F2 in conjunction with Volume UP/Down shortcuts from Ubuntu’s keyboard shortcuts settings, is I am having trouble pegging down the config for the Left and Right triggers. Personally for me, right now I have them mapped to the Right and Left Shoulder Buttons. When you are satisfied, do the following:
killall xboxdrv sudo xboxdrv --config xboxdrv-mouse.ini
Save and quit the file. The necessary Now make the script executable:
sudo chmod +x launch_xbox_mouse.sh
The script is now able to run. It will kill xboxdrv if it exists and restart it, taking into account if you make changes, you hopefully are not left with a non functioning config. I highly suggest you make copies of the file for testing. There is one in the github repo. In the repo, is also short scripts for rebooting, shutting down the sytem, and more. Now, set your session to autostart the script:
Listed below are programs suggested for the HTPC, some of which you may not use, and some that are not even on this list. The follow is just what I personally use. If I do not note the link to the install, the page name is the name of program, installable via ‘sudo apt-get install program_name’. I will note below which are native, non-native, or web links (with .png icons):
- vlc – Will play almost everything you throw at it. It is far easier to enable third party plugins when you install Ubuntu 12.04 LTS.
- spotify – Available via the beta client here.
- xbmc – XBMC is one of the most featured media center on Linux, aside from Plex Media Server. Be sure to check the github repo for the skins I used. You can optionally start xbmc in the startup session properties as well.
- firefox – Capable and very customizable web browser for Linux.
- steam – Gaming platform that now runs under Linux. See Ubuntu’s wiki for more.
- lastfm – Great little music program for streaming audio channels
- miro – Great podcast/video application with capable HTPC sizing for text scaling
- Pandora – web link
- Plex Media Server – web link (I haven’t had much luck with the desktop application).
Blu-Ray playback on Linux is hit and miss. I can only suggest you take any suggestions here with a grain of salt. Even if you get your Blu Ray discs playing, likely newer titles will not fully play right or even at all. My suggestion here is to use MakeMKV+Handbrake, and backup your movies, or stream them from another PC that has functionality. The following set of commands may or may not work for you (Use distupgrade with caution!):
sudo add-apt-repository ppa:n-muench/vlc sudo apt-get update sudo apt-get install libaacs0 libbluray-bdj libbluray1 sudo apt-get dist-upgrade cd ~/ mkdir -p ~/.config/aacs/ cd ~/.config/aacs/ wget http://vlc-bluray.whoknowsmy.name/files/KEYDB.cfg
I will post any other methods I can find to get this working in this section.
Please leave a comment below for any comments or criticisms. I will try to improve this guide as I get time.
All in all, I am currently quite pleased with my setup using the Xbox controller. Some advice: don’t unplug the controller while the system is turned on, or you may receive a different event ID, which you can of course check for again and simply change the number in the xboxdrv-config.ini file. Again, the reason I did this over popular alternative distros like Mythbuntu, Enna, GeexBox, and more, is the availablilty of media. Using pipelight, I can play just about any websites’ media from the browser if a native Linux application does not exist (such as Netlix and several TV show websites). The modifications described, once learned, allow you to be freely in control of the entire system. While XMBC can work as a one-stop solution for most, several services that involve DRM will not work, and if they do, its a workaround that is often difficult to implement for both the developer and the end-user.
The article here will remain a long standing sticky post for HTPC methods under Ubuntu. The 12.04 LTS release was chosen for its long running updates (until this LTS does eventually stop receving them on the next LTS release), and compatibilty/stability over the 13.10 release. As always, I am open to suggestions and corrections. If you have tweaks and experiences of your own, I would love to hear them, and if I have you permission, they will be show here with credit to your site or username.