Installing R-Studio on Ubuntu 16.10

rstudioInstalling things on Linux is either really easy, or a yak shave with surprisingly little between those extremes.

It seems that Ubuntu 16.10 has removed Gstreamer 0.10 from the repos and replaced it with Gstreamer 1.0, which is great… until you need to install R-Studio.

While the R-Studio people are aiming to drop the Gstreamer dependency, for the moment, as of 16.10, installing it has fallen into the yak-shave category.

Installing R-Studio works fine, but if you try to run (from the terminal) it you will get the error:

rstudio: error while loading shared libraries: libgstreamer-0.10.so.0: cannot open shared object file: No such file or directory

We can see that it’s failing to load Gstreamer, but since it’s been removed from the Ubuntu repos fixing this will mean getting those packages elsewhere.

To start with, we can download the latest R-studio daily build and install it using dpkg:

$ wget https://s3.amazonaws.com/rstudio-dailybuilds/rstudio-1.0.124-amd64.deb
$ sudo dpkg -i rstudio-1.0.124-amd64.deb

The dpkg command can also query the package to display information about it. If we use the uppercase I option we can confirm that this package requires exactly version 0.10 of libgstreamer:

dpkg -I rstudio-1.0.124-amd64.deb 
 new debian package, version 2.0.
 size 98840122 bytes: control archive=42847 bytes.
     554 bytes,    12 lines      control              
  163246 bytes,  1548 lines      md5sums              
     198 bytes,    10 lines   *  postinst             #!/bin/sh
     158 bytes,    10 lines   *  postrm               #!/bin/sh
 Package: rstudio
 Version: 1.0.124
 Section: devel
 Priority: optional
 Architecture: amd64
 Depends: libjpeg62, libedit2, libgstreamer0.10-0, libgstreamer-plugins-base0.10-0, libssl1.0.0,  libc6 (>= 2.7)
 Recommends: r-base (>= 2.11.1)
 Installed-Size: 526019
 Maintainer: RStudio <info@rstudio.com>
 Description: RStudio
  RStudio is a set of integrated tools designed to help you be more productive with R. It includes a console, syntax-highlighting editor that supports direct code execution, as well as tools for plotting, history, and workspace management.

Debian (which Ubuntu is based on) has the old Gstreamer packages we need to satisfy those dependencies, so we can get them from there. If you need something other than the AMD64 see here and here. The if you have a 64bit machine, you can download and install like this:

# download with wget
$ wget http://ftp.ca.debian.org/debian/pool/main/g/gstreamer0.10/libgstreamer0.10-0_0.10.36-1.5_amd64.deb
$ wget http://ftp.ca.debian.org/debian/pool/main/g/gst-plugins-base0.10/libgstreamer-plugins-base0.10-0_0.10.36-2_amd64.deb

# Now install with dpkg
$ sudo dpkg -i libgstreamer0.10-0_0.10.36-1.5_amd64.deb
$ sudo dpkg -i libgstreamer-plugins-base0.10-0_0.10.36-2_amd64.deb

While that solves R’s problems, we now have one of our own. We’ve purposefully installed old packages and don’t want Ubuntu’s package manager to enthusiastically upgrade them next time we update.
To resolve that problem will put a hold on them with apt-mark:

$ sudo apt-mark hold libgstreamer-plugins-base0.10-0
libgstreamer-plugins-base0.10-0 set on hold.
$ sudo apt-mark hold libgstreamer0.10
libgstreamer0.10-0 set on hold.

And we can check the packages that are on hold with:

$ sudo apt-mark showhold
libgstreamer-plugins-base0.10-0
libgstreamer0.10-0

Hopefully that saves someone some Googling.
Now that’s working, it’s time to play with some R!

Running Gephi on Ubuntu 15.10

A while ago I gave a talk at the Ottawa graph meetup about getting started doing graph data visualizations with Gephi. Ever the optimist, I invited people to install Gephi on their machines and then follow along as I walked through doing various things with the program.

java_install

What trying to get a room of 20 people to install a Java program has taught me is that the installer’s “Java is found everywhere” is not advertising; it’s a warning. I did indeed experience the power of Java, and after about ten minutes of old/broken/multiple  Java versions, broken classpaths and Java 7/8 compatiblity drama, I gave up and completed the rest of the talk as a demo.

All of this was long forgotten until my wife and I started a little open data project recently and needed to use Gephi to visualize the data. The Gephi install she had attempted the day of the talk was still lingering on her Ubuntu system and so it was time to actually figure out how to get it going.

The instructions for installing Gephi are pretty straight forward:

  1. Update your distribution with the last official JRE 7 or 8 packages.
  2. After the download completes, unzip and untar the file in a directory.
  3. Run it by executing ./bin/gephi script file.

The difficulty was that after doing that, Gephi would show its splash screen and then hang as the loading bar said “Starting modules…“.

If you have every downloaded plugins for Gephi, you will have noticed that they have an .nbm extension, which indicates they, and (if you will pardon the pun) by extension, Gephi itself is built on top of the Netbeans IDE.
So the next question was, does Netbeans itself work?

sudo apt-get install netbeans
netbeans

Wouldn’t you know it, that Netbeans also freezes while loading modules.

Installing Oracle’s version of Java was suggested and the place to get that is the Webupd8 Team’s ppa:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer oracle-java8-set-default
# The java version that got installed:
java -version
java version &quot;1.8.0_72&quot;
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)

That finally left us with a working version of gephi.

Gephi 0.9.1 running on Ubuntu 15.10
Gephi 0.9.1 running on Ubuntu 15.10

Installing Gephi on Arch Linux was (thankfully) drama-free, but interestingly installs the OpenJDK, they very thing that seemed to causing the problems on Ubuntu:

yaourt -S gephi
java -version
openjdk version &quot;1.8.0_74&quot;
OpenJDK Runtime Environment (build 1.8.0_74-b02)
OpenJDK 64-Bit Server VM (build 25.74-b02, mixed mode)

It’s a mystery to me why Gephi on Ubuntu seems to require Oracle’s Java but on Arch I can run it on OpenJDK.
With a little luck it can remain a mystery.

Changing keyboard layout options in Ubuntu 14.04

Back in 2012 I switched my caps-lock key to act as a second ESC key. This made a big impact in my Vim usage, and you can understand why when you see the keyboard vi was created with.

Having become reliant on that little tweak, it was a little disconcerting to realize that the keyboard layout options I had used to switch my caps-lock were nowhere to be found in Ubuntu 14.04. It turns out that Gnome (upstream from Ubuntu) removed the settings from the system settings entirely.

Fortunately this is still accessible via the Gnome Tweak Tool.
You can install that like this:

sudo apt-get install gnome-tweak-tool

Once installed you can launch the tool from the terminal:

gnome-tweak-tool

You can find the all the old options under the “typing” option.
gnome tweak tool

Its a little weird to have such useful stuff suddenly removed from the system settings. Hopefully they will find there way back in a future version, for the moment, my Vim crisis has been averted and that’s enough.

Usb tethering – that was easy

I’ve had my Google Nexus phone for a while now and am only just starting to explore some of the stuff it can do. A recent pleasant surprise was using tethering so I could connect to the internet from my laptop via my phone. I connected my phone to my laptop with the USB cable and dug into the settings:

Android settings
Android settings screen
Android wireless settings
Android wireless settings
Tethering and portable hotspot
Tethering and portable hotspot

As you can see you don’t need to dig very far. When I tapped the the “USB tethering” option Ubuntu immediately popped up a notification saying that it had connected to a wired network… and then I checked my email. It happened so fast that I almost feel cheated out of doing something clever to get it going… almost.

If you don’t have your cable you can explore setting up a Wi-Fi hotspot. You’ll just have to add a name and a password for your network.

I have so many memories of installing Windows and having to use a second computer to download drivers for my network card (and every other card)… Ubuntu is making those memories feel very distant indeed.

 

NetworkManager to the rescue

I work in coffee shops reasonably often, and its surprisingly difficult to find one that has the right combination of comfy chairs, decent coffee and unrestricted WIFI.
Recently one of my favourites had Bell come in and monkey with their router. Of course Bell set up the router to use their nameservers, which, I suspect are some of the slowest in the world (entirely what you would expect if you have had any dealings with Bell).
So when I show up, grab a coffee, and get ready do some work, I notice that everything is really slow.

mike@sleepycat:~☺  time curl www.google.ca > /dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10947    0 10947    0     0    698      0 --:--:--  0:00:15 --:--:--  3481
y
real	0m15.675s
user	0m0.013s
sys	0m0.000s

Making the same request using just the IP address so as to skip the DNS name resolution step makes it pretty clear where the problem lies:

e
mike@sleepycat:~☺  time curl 74.125.131.94 > /dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10586    0 10586    0     0  47366      0 --:--:-- --:--:-- --:--:-- 47470

real	0m0.234s
user	0m0.009s
sys	0m0.003s

Now this coffee shop is run by some really lovely people, but my attempt to explain DNS resolution and router settings to girl behind the cash while she frothed milk and customers come in behind me went about as well as you might expect.
So back at my table, I got to thinking; “If only there was a way to accept just the IP address from their router but not their nameserver settings…”

Sure enough, Gnome’s NetworkManager has exactly that:

NetworkManager settings
NetworkManager settings

You will notice I am using Google’s public DNS addresses in there. And the result:

mike@sleepycat:~☺  time curl www.google.ca > /dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10995    0 10995    0     0  62273      0 --:--:-- --:--:-- --:--:-- 62471

real	0m0.187s
user	0m0.011s
sys	0m0.003s

I love that they thought to add that in there. Well played Gnome! :)

Remote Debugging Chrome on Ubuntu

Between AngularJS and some work on responsive design, I’ve been using Chrome Dev Tools more and more lately. One of the things that has really impressed me is Chrome’s remote debugging. Getting it going on Ubuntu is extra easy since it turns out that the Android Debug Bridge tool is in the repos already:

sudo apt-get install android-tools-adb

And then you can fire up the debug bridge and open the debug tools in Chromium in one shot with this:

adb forward tcp:9222 localabstract:chrome_devtools_remote; chromium-browser localhost:9222

And when you’re done:

adb kill-server

That adb command is a pretty good candidate for an alias, since I don’t use is that often and need to google for it every time.

If you think that’s cool, Chrome’s Dev Tools have plenty more features to explore…

Getting Thomas was alone working on Ubuntu 13.04 64bit

I just bought the Humble Bundle 8 mostly because I liked the looks of “Thomas was alone”.
Sadly the download is just a tar file, which I always find a little off putting. It took a little tinkering to get it going so I thought I would save someone else the searching by writing it here.

Extract the contents of the tar file in whatever way makes you happy.

mike@sleepycat:~/Downloads/thomasLinuxStandalone$ ls
thomasWasAlone  thomasWasAlone_Data
mike@sleepycat:~/Downloads/thomasLinuxStandalone$ chmod +x thomasWasAlone

My problem was that I got an error when I tried to run it:
mike@sleepycat:~/Downloads/thomasLinuxStandalone$ ./thomasWasAlone
./thomasWasAlone: error while loading shared libraries: libGLU.so.1: cannot open shared object file: No such file or directory
[/code]

But its easy enough to fix:

mike@sleepycat:~/Downloads/thomasLinuxStandalone$ sudo apt-get install ia32-libs-multiarch:i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
...lots of packages and installation stuff...

And finally it works:

mike@sleepycat:~/Downloads/thomasLinuxStandalone$ ./thomasWasAlone
Set current directory to /home/mike/Downloads/thomasLinuxStandalone
Found path: /home/mike/Downloads/thomasLinuxStandalone/thomasWasAlone
Mono path[0] = '/home/mike/Downloads/thomasLinuxStandalone/thomasWasAlone_Data/Managed'
Mono path[1] = '/home/mike/Downloads/thomasLinuxStandalone/thomasWasAlone_Data/Mono'
Mono config path = '/home/mike/Downloads/thomasLinuxStandalone/thomasWasAlone_Data/Mono/etc'

Happy gaming!

Contributing to Musicbrainz

Hacking on code is not the only way to contribute to the Free Software / Open Source Software community. Many applications rely on external datasets to provide some or most of their functionality and a contribution there helps all the projects downstream.

Ubuntu’s default music application Rhythmbox as well as Banshee, KDE’s Amarok and a host of smaller programs like Sound Juicer all offer the ability to rip CDs. For this feature to be seen to “work” in the eyes of the user the software needs to correctly identify the CD and add the appropriate album details and track names. To do this, these programs all query the Musicbrainz database and the quality of that response essentially decides the users experience of the ripping process; Will it be a one click “import”, or 10 minutes of filling in track names while squinting at the CD jacket? God help you if you have tracks with accented characters and an English keyboard.

What all this means is that every contribution to Musicbrainz results in a better experience for users of ALL of these programs. When someone somewhere decides to rip their favourite obscure CD, and the software magically fills in the track names and album details, its a pretty happy moment. So if you have wanted to contribute to the Free/Open Source Software community but don’t have the programming chops to do it, contributing to Musicbrainz is one way to help out.

The Musicbrainz dataset is under the Creative Commons CCO license which places all the data in the public domain. This means that your contributions will stay open to the public and we won’t have another CDDB/Gracenote situation where people contributed to a database that ended up charging for access. All you need to get started is to create a Musicbrainz account.

A typical contribution looks something like this. I’ll decide to rip one of my CDs and pop it in the drive. I launch Rhythmbox which will tell me if its not recognized:

rhythmbox_unknown_album2

When you click the “Submit Album” button the application will send you to the Musicbrainz website with the Table Of Contents (TOC) information from the CD in the url. Once on the site you will need to search for the Artist or Release to add the TOC to:

musicbrainz_search

Most of the time there will be an entry in the database for the Artist and all that needs to happen is to add the TOC that you are still carrying from page to page in the url to one of the Artists CDs. In cases where the search returns multiple matches I usually explore the different options by ctrl+clicking on the results to open them in separate tabs.

musicbrainz_selected

Click through the artists albums until you find the one you are looking for, or add one if you need to. In this case there was one already there (and all the details including the catalog number matched) so my next step was to click the “Attach CD TOC”. This takes the TOC you can see in the address bar and attaches it to that release.

musicbrainz_attaching_toc

You will be asked to add a note describing where this information you are providing is coming from. In this case its coming from the CD. Add the note and you are done.  What make contributing to Musicbrainz particularly gratifying is that next time you put in the CD, it is recognized right away. My favourite kind of gratification: instant. You can also immediately see the results in Rhythmbox, as well as Banshee and any other application that uses Musicbrainz.

rhythmbox_after

banshee_science_fiction_lookup_after

Its pretty great thinking that the few minutes invested in this process  not only solves your immediate problem of having an unrecognised CD, but also makes software all over the Linux ecosystem just a tiny bit better. That’s a win/win situation if I’ve ever seen one.

Installing Ubuntu on a Dell Inspiron 1300

I was recently given an old Dell Inspiron 1300 that had been replaced with one of Dell’s shiny new laptops. The battery life is of course nearly non-existent but functionally it is still in great shape. I figure all it needs is a little love and I will find it a new home.
Installing Ubuntu is so painless that I was very surprised to find that when I was booting the machine from a usb stick (made with usb-creator and a 12.04 iso) it would hang while displaying the loading screen. A quick googling turned up an answer by the ever-helpful Jorge Castro on Ask Ubuntu. His advice; press F6 and add this to grub’s boot parameters:

b43.blacklist=yes

The trouble is the Broadcom wireless BCM4318 LAN card used in this model. The linuxwireless site describes this situation like this:

The Broadcom wireless chip needs proprietary software (called “firmware”) that runs on the wireless chip itself to work properly. This firmware is copyrighted by Broadcom and must be extracted from Broadcom’s proprietary drivers. To get such firmware on your system, you must download the driver from a legal distribution point, extract it, and install it.

So while blacklisting the b43 driver will get the system to boot to the USB stick and get to the installer, it doesn’t solve the problem. I plugged in an ethernet cable and made my way through the rest of the install process as normal. I needed to repeat Jorge Castro’s trick again to boot the laptop after the install. Once it was running and connected to the internet via my ethernet cable I was able to install the firmware by installing the package mentioned on the linuxwireless site:

sudo apt-get install firmware-b43-installer

After that I rebooted again and was thrilled to see that it came up without a fuss. Thinking it was now solved I looked at the network menu only to find yet another headscratcher. The message there: “wireless is disabled by hardware switch”. WTF?
It didn’t take long to figure out was actually going on; FN+F2 had been pressed at some point disabling the wireless entirely. FN+F2 one more time and suddenly wireless was working.