PS3 Media Server And Ubuntu Foo… Again

It feels like Groundhog Day all over again. After finding a relatively painless way of installing the PS3 Media Server on Ubuntu (PS3 Media Server And Ubuntu Foo), I found an easy way with a PPA (PS3 Media Server made easy) and I thought all will be good when I do the re-install of my server with Saucy. I couldn’t be more wrong. The latest Ubuntu version that is supported by the PPA is Raring and it seems it stopped at version 1.81.0 of the PS3 Media Server. A quick check of the home page and the current version is 1.90.1.

After some thought, I checked my old blog post and the configuration files from the PPA. So, this is a chimera of all these components and most importantly, it works. I can now feed media to my devices that don’t support the Plex Media Server.

So, lets get started. Oh, before I forget it. All these steps need to be done as root!

Dependencies/Repositories

The good thing is, that nowadays most of the media related packages are already part of Ubuntu. So, we can simply pull most dependencies directly from Ubuntu’s repository and don’t have to add tons of PPA’s.

First and foremost you need Java. I prefer for some unrelated reasons to use the Oracle JDK. I know JDK 8 was just released but 7 will do for the moment. And as far as I know PMS (yes, I use the abbreviation again) works fine with the OpenJDK. So this first step is kinda optional.

add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install oracle-java7-installer

And if you want to try OpenJDK, you do the following

apt-get install openjdk-7-jdk

Now we need the media related dependencies. All the encoders, decoders, muxers, etc. Most of it is already in Ubuntu and you might not need all of it (like dcraw). But I think it is better to have it installed and ready use, then be surprised when a feature, you never used before, doesn’t work. So here we go.

apt-get install mplayer mencoder mediainfo ffmpeg imagemagick vlc flac dcraw

tsMuxeR is the only one missing in this list. Luckily Robert Tari created a PPA. Lets just add it:

add-apt-repository ppa:robert-tari/main
apt-get update
apt-get install tsmuxer

Get PS3 Media Server

The project switched from Google Code to SourceForge but has its source code at GitHub. Confused? Well, so am I, but they must have their reasons and I don’t question it. Anywhoo, you can download the latest version (currently 1.90.1) from here:

http://sourceforge.net/projects/ps3mediaserver/

Installation

After downloading you can install PMS into /opt or any other directory you think might be useful (/usr/local, etc.). I personally prefer /opt. Here we go:

tar xzvf pms-1.90.1-generic-linux-unix.tar.gz -C /opt/
ln -s /opt/pms-1.90.1/ /opt/pms

Creating the symlink in the second step makes life easier for later updates. All the configuration and start/stop scripts just look for /opt/pms. Updating should be as easy, as extracting the package into /opt and recreating the symlink.

Start Script

I based my scripts on the scripts from the PPA from Happy-Neko. Currently I did just some path corrections but I am planning on moving more configuration options to the configuration in /etc/default/.

Here are the steps to get the Upstart script, service configuration file and set the legacy link.

wget http://www.rfc3092.net/wp-content/uploads/2014/03/ps3mediaserver.conf_.gz
gunzip ps3mediaserver.conf_.gz
mv ps3mediaserver.conf_ /etc/init
wget http://www.rfc3092.net/wp-content/uploads/2014/03/ps3mediaserver.gz
gunzip ps3mediaserver.gz
mv ps3mediaserver /etc/default
cd /etc/init.d/
ln -s /lib/init/upstart-job ps3mediaserver
initctl reload-configuration

The last two steps set the legacy link, so that you can start the service using the old /etc/init.d mechanism. And the second is to tell Upstart, to scan for new services.

Please check /etc/default/ps3mediaserver, if it fits your needs. For instance, not everybody wants to run PMS as root. So take a minute and clean that up.

Configuration

The configuration for PMS with this setup in the configuration area for the user root.

/root/.config/ps3mediaserver

You can change this in /etc/default/ps3mediaserver. Here is how you get a basic configuration going.

wget http://www.rfc3092.net/wp-content/uploads/2014/03/PMS.conf_.gz
gunzip PMS.conf_.gz
mkdir -p /root/.config/ps3mediaserver
mv PMS.conf_ /root/.config/ps3mediaserver

The configuration file is already updated to reflect the paths for all external tools. It does not contain a UUID for the server, because that is created automatically when you fire up the server for the first time.

You should take a look at the following settings (see also my blog post PS3 Media Server And Ubuntu Foo for tips):

  • folders
  • name
  • network_interface
  • hostname

folders is the only one out of these that you definitely want to set to reflect your setup. The server is running as a service and therefor headless. Just put a comma separated list of directories in there. Something like

folders = /src/videos,/srv/music

name on the other hand is just a cosmetic thing and defines with which name the server shows up on the client.

Yet, the default for network_interfaces can sometimes cause some grieve. You might have to bind the server to a specific interface if some virtual interface seems to be more attractive to PMS.

hostname is similar to network_interfaces. Usually it should not be needed but if you have multiple IP’s on a device you might want to specify which IP it binds itself to.

Service Start

Now that everything is set up you can start the service.

service ps3mediaserver start

The service should fire up without any errors. And if you encounter errors you will find the logs in /var/log/ps3mediaserver/root/.

Happy Streaming!

Final Thoughts

I think it is pretty straight forward to get PMS to work on Ubuntu. If I find some time… did I just write that?! Well, if I find some time, I will create a PPA with the latest version and I will try to keep it up to date.

BIND Journal Foo

After doing some updates to my DNS set up I ran some standard checks. And it took me a while to realize that for some reason my zone didn’t load correctly and the secondary server was used.

So I dove into the logs and low and behold I saw this:

zone dusares.com/IN: journal rollforward failed: journal out of sync with zone
zone dusares.com/IN: not loaded due to errors.

And it dawned on me. I am currently implementing my own little dynamic DNS updater and all the updates are stored in a journal. Fine, I can re-run my tests and simply remove that journal (.jnl files. In Debian based distributions they are in /var/lib/bind) before restarting BIND.

That works of course but should not the way how you should handle things. Especially not, if you need the content of the journal. So here is the correct way of doing it:

  1. rndc freeze dusares.com
  2. apply changes to zone file
  3. rndc reload dusares.com
  4. rndc thaw dusares.com

Re-Assign Host Access Permission For User In MySQL Foo

Changing the configuration of a VPN can have interesting side effects. In my case I had to open up the host permissions for my MySQL users and databases from a /24 to a /16 network. Should be easy… and it actually is. Here are the SQL commands you have to execute to perform such an update:


update mysql.user set host = '10.42.%' where host = '10.42.42.%;
update mysql.db set host = '10.42.%' where host = '10.42.42.%;
flush privileges;

You can of course go crazy in the where clause and in- or exclude everything you want.

Happy SQL-ing.

Amazon AWS SSL Certificate Import Foo

Using Amazon’s Elastic Load Balancer (ELB) with SSL is supposedly an easy thing to set up. And for the most part it is. You can use the command line tools or the web interface and all is good.

But it seems Amazon messed up a little bit the error messaging. When uploading our SSL certificate I got the nice error message Invalid Public Certificate. After double and triple checking the public certificate and not finding anything I asked the beloved oracle called Google.

One of the first things that came up that the intermediate certificate might be in the wrong order, or the root certificate is missing in the chain. Not helping in my case. I had only one certificate in the chain and the root is added automatically according to Amazon’s documentation.

While digging through the AWS documentation I found the little hint, that the private key has to be in RSA format. In other words your file should look like this:

-----BEGIN RSA PRIVATE KEY-----
(tons of text)
-----END RSA PRIVATE KEY-----

and not like this:

-----BEGIN PRIVATE KEY-----
(tons of text)
-----END PRIVATE KEY-----

OpenSSL can do the conversion in one easy step:

openssl rsa -in my_private.key -outform PEM -out my_private.key.pem

After using that version of the private Amazon was accepting the public key as well, despite the error telling me that the public key is invalid. Can now somebody please explain the difference between public and private to Amazon?

Wicd On Ubuntu Fails To Start Foo

Running Ubuntu, like most mainstream Linux distribution, means nowadays automatically that your computer gets exposed to the NetworkManager and its sideeffects. Maybe this tool might work for some desktop users, but it definitely never worked for me. It is cumbersome to configure, doesn’t like if an interface is managed manually or you want to change it back to automatic. It has major problems with similar IP ranges for different locations…

Anyways, I digress. I tried a lot of versions of the NetworkManager and it actually got worse and worse. Switching back to manually editing /etc/network/interfaces is not really spouse compatible either. The decision was made, lets install an alternative: wicd.

I think there is enough on the internet on how to transition from NetworkManager to wicd, like this official one here from Ubuntu’s own help pages.

After all is set and done you should have wicd running and you should be able to use the widget of your favorite desktop environment to configure it. But not so in my case. All I saw was that wicd failed to start. And a lot of digging unvealed finally a bug and it is even filed (Launchpad Bug Report).

In short, it is a problem with how the symlinks for resolv.conf are set up. So here is the quick workaround to get wicd to work:


rm /etc/resolv.conf
ln -s /run/resolvconf/resolv.conf
rm /var/lib/wicd/resolv.conf.orig
ln -s /run/resolvconf/resolv.conf /var/lib/wicd/resolv.conf.orig

After that sequence you should be able to start wicd. Happy networking.

Google Chrome With APT On Ubuntu Foo

Installing Google Chrome on a Debian based distribution is actually pretty nice and easy… if you know how.

So lets get started. In the directory /etc/apt/sources.list.d/ create a file called google-chrome.list. Make sure that he extension is .list. The content of the file should be this:

deb http://dl.google.com/linux/chrome/deb/ stable main

After running apt-get update you will see an error message like this (the public key ID might change!):

W: GPG error: http://dl.google.com stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A040830F7FAC5991

This is just telling you that you have to add Google’s key to your keychain. And here are the commands to do exactly that:

gpg --recv-keys A040830F7FAC5991
gpg --export -a A040830F7FAC5991 | sudo apt-key add -

Here is a sample output of that procedure:

root@majestix:/etc/apt/sources.list.d# gpg --recv-keys A040830F7FAC5991
gpg: requesting key 7FAC5991 from hkp server keys.gnupg.net
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 7FAC5991: public key "Google, Inc. Linux Package Signing Key " imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1
root@majestix:/etc/apt/sources.list.d# gpg --export -a A040830F7FAC5991 | sudo apt-key add -
OK
root@majestix:/etc/apt/sources.list.d# apt-get update
...

After that you can look for and install Google Chrome out of the apt repository:

root@majestix:/etc/apt/sources.list.d# apt-cache search google-chrome
google-chrome-beta - The web browser from Google
google-chrome-stable - The web browser from Google
google-chrome-unstable - The web browser from Google

More Ubuntu Annoyances, Like Focus-Follows-Mouse… Foo

I don’t know how anybody can work with focus on click. It is just a waste of time and energy. So it is really annoying to me that focus on click is always the default. And Unity has the same lack of configuration option as Gnome. You can’t switch the mouse focus mode with the standard settings.

To help that problem they finally have a UI that you can install with this command:

apt-get install unity-tweak-tool

When you now search for the unity-tweak-tool it will start and gives you a lot of missing options and settings to improve your workflow on your desktop. Stuff like configuring the launcher, panels, desktop switcher, mouse behavior, shortcuts, theme settings, etc.

This tool is a life savior for me and makes Unity actually a little bit more usable.

But there might be some stuff that is not in the tweak tool yet. In that case you can install the gconf editor:

apt-get install gconf-editor

You start it with the command gconf-editor. If you like poking around in the MS Windows registry, then this is your friend. It looks very similar and is a powerful tool to apply settings for which Canonical thought you don’t need a UI for.

Now, there is of course another tool that is helping you setting up Compiz, the composite manager. Most settings should be in the gconf editor, but you never know. So lets install that one as well and play around:

apt-get install compizconfig-settings-manager

You invoke it with the command ccsm and have access to all the internal settings of Compiz.

And the CompizConfig settings manager,… wow, that is a mouthfull… That manager is the one that finally was able to resolve my issue with resizing windows. I like the quite common setting of using ALT+RightMouseButton to resize a window. and the Compiz settings manager is offering the setting.

In Window Management->Resize Window you can change exactly that behavior from the Ubuntu default middle mouse button to the right button. When you set it to the right mouse button (button 3) you might get a warning about a conflict with the Window Menu feature. I don’t need that one so I simply disabled it. And if I needed, then I can use the same tool to assign another key-mouse-button combination.

Now, why do you need next to the standard settings dialogs additional three tools to get just the basic setup going is something that most likely only some UI designers at Canonical know. But at least I have some tools to get to a usable workspace.

Getting Rid Of The Top Menu In Ubuntu

A fresh installation on one of my machines and I decided to give Ubuntu’s Unity another try. And the first that jumped out at me was the more than annoying global menu bar on top of the screen. Apple might be everybody’s darling when it comes to UI design but they do not understand how this disrupts the workflow. Especially when you are using focus-follows-mouse, it is like playing roulette when you try to get to the correct menu.

But it seems quite easy to get rid of that annoying function by simply uninstalling some packages. And here is what I found you have to do:

apt-get remove appmenu-gtk appmenu-gtk3 appmenu-qt

Well, but that is not working for the Saucy Salamander (13.10). Why should it, it is new and shiny. So here is what you have to remove in addition:

apt-get remove appmenu-qt5 indicator-appmenu

And before I forget it. In the older Ubuntu versions you also have to disable the “Global Menu Bar integration” plugin in Firefox.

In pre-saucy Ubuntu versions you can also use a less invasive way of disabling the menu:


echo "export UBUNTU_MENUPROXY=0" > /etc/X11/Xsession.d/81ubuntu-menu-proxy

Nonetheless there are some problems. Some programs, i.e. Rhythmbox, require the global menu. So I simply resorted to not using them. But if you rely on them and you don’t want to have a global menu, then you have a problem. But maybe this will be resolved with the new per-application configuration in 14.04.

Adobe Acrobat Reader in Ubuntu 13.10 Foo

I guess more or less every Linux user has noticed that the official Adobe Acrobat Reader version is out of date and that Adobe has no intention to update it. So you are stuck with version 9.5.5, which is mostly okay especially when you need some features that are only available in the official reader.

And as a logical consequence, Ubuntu is not providing a package anymore in its newer releases. Especially when there are so many alternatives to the simple Reader functionality. But fear not, you can still install the Adobe’s Reader and there is even a .deb package on Adobe’s download site.

Because the package does not come through the standard repository you have to resolve the dependencies on your own… well, I mean tell apt to resolve the dependencies.

First install the package using the following command (change the file name as needed):

dpkg -i AdbeRdr9.5.5-1_i386linux_enu.deb

If you see error messages about the wrong architecture, then you work on a 64 bit system and dpkg needs a little hint.

dpkg -i --force-architecture AdbeRdr9.5.5-1_i386linux_enu.deb

Afterwards you should see error messages about missing dependencies. And now we fix them:

apt-get -f install

This should pull all missing libraries, install them and then wrap up the installation of the Acrobat Reader.

It seems that these steps are not enough on some 64 bit Kubuntu systems. You might have to install two additional libraries:

apt-get install libxml2:i386 lib32stdc++6

And now happy PDF reading… wait… can it be that easy? At least not on my Kubuntu 13.10. Reading on the screen is fine but printing is messed up. Every print out from the Reader scales down the output to about two-third of the original size. To make things worse, it does a really crappy job at scaling. The output is basically unreadable.

Picasa Web Album Download Foo

I must admit, I don’t use Picasa. I actually don’t like all these image organization and album programs. But somebody shared a Picasa Web Album with me that had some really nice pictures of my niece’s wedding.

These were nice pictures and I wanted them on my machine. So, lets get on it and download them. This is not so easy, if you are not using Picasa. And that is not so easy on Linux. And the album had way too many pictures to download them manually.

The Firefox extension, or add-on DownThemAll! and it’s companion DownThemAll! AntiContainer are your friends when it comes to Web Album downloads from Picasa.

Once you installed everything DownThemAll! offers you a plethora of download options. For Picasa’s Web Album you choose the RSS feed link from the sidebar. Right click on it and select “Save Link with DownThemAll!” or go to the “Tools” menu and select in the “DownThemAll!” menu the entry “DownThemAll!…”.

The latter gives you a little bit more control over what is downloaded. For instance, you can select just image files or JPEG images. Either way, select a destination folder and click the “Start!” button. Sit back and watch it download.

The only downside is the image quality. I have not found any way to get a higher resolution image. The Flash or Shockwave based viewer shows beautiful HiRes pictures. But what I downloaded is much worse. Not really bad. But everything but good.

So, if anybody out there has an idea how to download the original resolution image in a shared Picasa Web Album, then let me know. I am all ears.

But until then, happy downloading.