RIoTBoard - Review

Table of contents

RoadTest: RIoTBoard

Author: packetgeek

Creation date:

Evaluation Type: Evaluation Boards

Did you receive all parts the manufacturer stated would be included in the package?: True

What other parts do you consider comparable to this product?: null

What were the biggest problems encountered?: The biggest problem was the version of Ubuntu (11.04) that was provided. Since Canonical no longer supports 11.04, I had to update to 12.04 (which isn't current but has support from Canonical).

Detailed Review:

With apologies for rambling, as the below is comprised of two months-worth of notes, covering multiple project restarts and exploration of a number of work-arounds.  If you want to avoid the rambling, jump to "Building the jukebox" below.


RIoTboard Jukebox

 

Even though the RIoTboard arrived at my house only a day or so after projects were selected, I started reading about this board the day I volunteered for the Road Test.  It quickly rose in status to must-get on my Christmas wish list (i.e., I'd have been annoying my wife for one if Element14/Farnell hadn't provided one).

 

My proposed project was to determine if Savonet's Liquidsoap (link below) is useable on the RIoTboard.  The short answer: it is.  The slightly longer answer: it is, with some work.  The longest answer: it appears so, but a number of underlying issues needed work.  Most of these issues (if not all) will disappear as better supported versions of Linux are made available for the RIoTboard.

 

As I spent a lot of time working around issues with Ubuntu (not the board), I wasn't able to finish the design of the Jukebox.  What I have finished works, and you can use it to play songs randomly or on-request.  The minor things, like being able to start/stop Liquidsoap and Icecast2 from the web interface, will take a bit longer.

 

Jukebox features (wish list)

 

- Being able to sort on various properties (song title, artist, genre) (works)

- Being able to upload new music via the web interface (works)

- Being able to play random songs when others are not queued (works)

- Ability to "bump" the jukebox, causing it to skip to the next song (works)

- Ability to add/edit metadata in the database (works)

- Display request queue (pending)

- Web interface (works)

- Ability to start/stop the Liquidsoap and Icecast2 services via the web interface (pending)

- Displays the currently playing song in the web interface (pending)

 

Overall impression and thoughts


Primarly: the board is very nice (a must-have), but the operating system that accompanied it was quite horrible.  With boards such as this, the first step shouldn't be to upgrade the operating system.


After having to upgrade the OS to a supported version, the majority of the remaining issues related to MP decoder and encoder routines.  This wasn't readily apparent and took weeks to isolate and work around. I did manage to get the jukebox to play ogg files, though I did waste a sizeable amount of time working with a bad .ogg file.  While researching the segfault issue, I read discussion about how the issue might be caused by liblame and that I should try playing ogg files to determine if the rest of the scripting language works.  Given time restrictions, I decided to get a proof-of-concept jukebox working on the RIoTboard, using the Liquidsoap scripting language, with the intent of pursuing/fixing the MP3 codec issues while out from under the requirement to have the project turned in on time.

 

Working with ogg files had it’s own problems.  Lacking an ogg file to work with, I grabbed one of the old LinuxCranks ogg files off of the Internet.  I wasted 3+ hours messing around with that before I came across discussion of troubleshooting with the “-r” switch (e.g., "liquidsoap -r file.mp3").  Upon running "liquidsoap -r LinuxCranks2009-3.ogg", I noticed that liquidsoap couldn't determine what type of file it was.  Frustrated, I grabbed one of my mp3 files and ran it through Audacity, converting it to the ogg format.  Amazingly, it worked first try.  (Lesson learned: don’t use older ogg files.)

 

Shortcomings with the RIoTboard

 

- The provided version of the Ubuntu OS is no longer supported by Canonical.  It requires an upgrade to a supported version.

- The default install includes a desktop gui, which consumes a lot of valuable space.  There’s need for an a smaller, headless install (i.e., a server distro).  In researching this, I did note someone having ported Kali to the RIoTboard (need to try)(see https://github.com/offensive-security) It's quite frustrating that http://www.element14.com/community/community/designcenter/single-board-computers/riotboard/blog/2014/08/07/riotboard-development-center didn't exist until 9 days before the project is due. (Hint: scroll down.) Will need to play with these later.

- Something important is broken in the LAME and MAD libraries (see below)

- There's no case available for the board.  There's no market (yet?) for them.  As a countermeasure, I picked up four 10mm stand-offs from Radio Shack (P/N 276-1381) to use as feet for the board.  They're tall enough to raise the board up off the the hosting surface, while still being short enough to allow stuffing the board back into the original anti-static bag.

 

Notice that, except for the last, all of the shortcomings are software based.  This is a good thing as such things tend to be corrected over time. Even with the software problems, the RIoTboard is still my favorite piece of hardware at the moment.

 

Compromises in getting the Jukebox to work

 

One of the most notable issues in getting the jukebox up and running is that the provided version of Ubuntu is no longer officially supported by Canonical.  In short, the repositories normally used to update software packages are no longer online.  This caused no end of problems in getting various components installed and working.

 

Due to time restrictions, I was forced to abandon the effort to play MP3 files with the jukebox.  This was due to multiple issues with the MP3 encoder and decoder binaries (liblame and libmad), as well as the OCaml libraries for Liquidsoap (e.g., software looking for a non-existant dllliquidsoap.so).  However, I was able to set up a working proof-of-concept that plays OGG files.

 

Things I did try

 

- I tried Christoffer Blinhiem's solution from the Launchpad Bugs page associated with Liquidsoap (https://bugs.launchpad.net/ubuntu/+source/liquidsoap/+bug/883159).  This fixed the issue with the missing dll (someone want to explain why a binary on a Linux system actually goes looking for a a dll file?).  However, the codec issues were more insidious (likely something to do with the libraries used to compile the encoder and decoder).  The quick fix is to employ a newer version of Linux, once new distros become available.  Note: this step is required to get the below working with ogg files.

- I even went so far as to compile Liquidsoap from scratch.  (If you want a copy of the how-to, send email.)  This is part of how I realized that there’s issues with the MP3 codecs, yet not the Ogg codecs.  After six weeks of trying to fix the MP3 codecs, I decided to use the Ogg codecs and call the attempt a proof-of-concept.  I’m looking forward to when newer distros are available for the RIoTboard.  (Update: as of 11 August, there are newer distros available.)

 

Building the jukebox

 

Requirements

 

- RIoTboard

- 5v power supply (I using the power supply from an old WRT54G)

- Ethernet cable

- SD card (min. 4GB)

 

Steps

 

Note: in the following, all command line commands (unless otherwise noted) are assumed to be run as root.

 

1) Install Ubuntu, using the MFGtool, as per the available docs.

 

It took a little bit longer than it probably should have to perform the initial flashing of Ubuntu onto the board.  The MFG tool has a very poor progress indicator (there are 3 bars that, if you watch them, they don't move) and I'm a bit impatient.  It took a few tries to get a full install of Ubuntu flashed onto the board.  The successful install took about 20 minutes to complete, once I figured out where to put the files in the Windows folder.

 

2) Log onto the riotboard with username/password of linaro/linaro

 

Note: to determine the RIoTboard's IP address, I run the following on a Linux computer connected to the same switch as the RIoTboard, prior to powering it:

 

  tcpdump -n -i eth0 not host 192.168.2.179

 

where "192.168.2.179" is the IP for my desktop computer.  Another way of determining the IP address is to watch the DHCP lease table (in your router) for new entries.

 

3) Switch to root via

 

  sudo su - root

 

4)  Remove .viminfo via

 

  rm .viminfo

 

The above removes the junk that shows up in a complaint when you try to use vim to edit a file as root

 

5) edit /etc/network/interfaces and make it look like:

 

auto lo

iface lo inet loopback

 

auto eth0

iface eth0 inet static

  address 192.168.2.27

  netmask 255.255.255.0

  broadcast 192.168.2.255

  network 192.168.2.0

  gateway 192.168.2.1

  dns-nameservers 192.168.2.246

  dns-search joat

 

Of course, edit the above to suit your environment.

 

6) Reboot the riotboard via:

 

  shutdown -r now

 

Note: you may need to press the reset button

 

7) Login and jump to root again

 

8) Edit /etc/resolv.conf and make it look like:

 

  nameserver 192.168.2.246

  search joat

 

Note: above indicates two things about my architecture: 1) my DNS server is at IP 192.168.2.246 and 2) I run a private top-level domain (TLD), internal to my home network, which terminates with ".joat".  Edit the above to match your environment.

 

9) check the system date by running:

 

  date

 

If the returned date reports 1 Jan 1970, run the following:

 

  ntpdate-debian ntp.ubuntu.com

 

Above should temporarily fix the system time.  I'll suggest a permanent fix for this later.

 

10) Check for available space by running:

 

  df -h

 

If you're following this guide step for step, you should now have around 1.2 GB of free space.  The following will require most of this.

 

11) One of the big obstacles in working with the provided version of Ubuntu is that it’s no longer supported by Canonical.  In other words, the respositories for the individual software upgrades no longer exists.  The only option is to upgrade to a supported version.

 

Fortunately, as you’ll see when you log into the system, there’s a command to upgrade the system to Ubuntu 12.04.  Do this by running:

 

  do-release-upgrade

 

This left roughly 470 MB of the original 1.3 GB of storage free.  (Running "sudo apt-get clean" brought the storage back up to 1.2 GB of free space.)  Not wanting to tempt fate with yet another distro upgrade, I left the version at 12.04, which is one of the long-term support (LTS) versions.  Be sure to run "apt-get update" before doing anything else.

 

Note: Once the above gets to the package installation stage, this will take a very long time to complete, as there’s 1200+ packages being upgraded.  Recommend starting this early in the morning, answering the initial questions, and then checking it periodically to determine if the upgrade requires user input.  It takes more than a couple hours.

 

Note: if you intend to watch the system while the code compiles (e.g., using "df" and/or "top"), recommend logging in, via SSH, before running "make" as compiling will drive the system load into the 3's and logging in will be slow/difficult.

 

Note: when it asked me to choose a character set, I chose "Latin 1 and Latin 5".

 

Note: when it asks about services to restart, accept the default.  After this, go find lunch, take a nap, do your homework, mow the lawn, etc.  The rest of the script will take awhile to complete.

 

Note: if you're watching memory, it will drift down to around 400MB during the install.

 

12) The upgrade script will likely complain about the vim install just before it finishes.  Fix the vim upgrade by performing the following:

 

  rm /var/lib/dpkg/alternatives/vim

  rm /var/lib/dpkg/alternatives/vimdiff

  rm /var/lib/dpkg/alternatives/rvim

  apt-get install -f

 

13) Reboot the machine via:

 

  shutdown -r now

 

Note: you'll likely need to press the reset button.

 

14) At this point, available memory should be around 500MB.  This can be increased back to around 1.2GB by running:

 

  apt-get clean

  apt-get autoremove

 

15) Install liquidsoap by running:

 

  apt-get install liquidsoap libnet-telnet-perl

 

This grabbed a number of plugins and dependencies (probably too many for what I needed to do but, to save time, I didn't bother to tailor the install (a better approach is to compile liquidsoap yourself and install only what's needed).

 

Note: the above will install a number of additional dependencies (around 115 MB).  This left 976 MB of regular storage free.

 

Note: the Perl interface to Telnet is needed as Liquidsoap has a Telnet-based API which the jukebox script will employ.

 

16) Install Apache by running:

 

  apt-get install apache2

 

17) Install MySQL by running:

 

  apt-get install mysql-server

 

Note: for security, be sure to set the root password when the install script asks for it. (For this demo, I set it to "linaro".)

 

Note: libdbi-perl should be installed as part of the above.  Check this with the following (and if it isn't install it):

 

  dpkg -l|grep libdbi-perl

 

18) Install Icecast by running:

 

  apt-get install icecast2

 

Note: for security, be sure to set the Icecast2 password.  Leave the hostname as "localhost" and enter appropriate passwords when the script asks for them.  (For this demo, I set all passwords to "linaro".)

 

19) Edit the Icecast config file (/etc/icecast2/icecast.xml) to suit your use.  Since my Icecast server is internal to my home network, I employ an entirely reflective configuration.  In other words, it will serve any stream pointed at it.  I've included a sample icecast.xml config file in the attached tarball.  If you want to use it, place it in /etc/icecast2/ and set ownership to icecast2:icecast, with permissions of 660.

 

 

20) Copy the main web page (index.html) to /var/www/.  It's included in the files.tgz attached to this document.

 

21) Fix the ownership and permissions of index.html

 

  cd /var/www

  chown root:root index.thml

  chmod 644 index.html

 

22) Copy jukebox.cgi, now.cgi, queue.cgi, and queued.cgi to /usr/lib/cgi-bin.  The cgi files are in the files.tgz attached to this document.

 

23) Fix the ownership and permissions of jukebox.cgi and now.cgi

 

  cd /usr/lib/cgi-bin

  chown www-data:www-data *.cgi

  chmod 700 *.cgi

 

24) Copy letters.html to the /var/www folder.  The letters.html file is in the files.tgz attachment to this document.

 

25) fix the ownership and permissions of letters.html

 

26) Create the directory to hold your music and set the ownership

 

  mkdir /var/www/music

  mkdir /var/www/upload

  chown www-data:www-data /var/www/music /var/www/upload

 

(Note: if you have a lot of files, you'll want to add an SD card or USB thumb drive for extra storage.  If this is the case, you'll want to skip the above and link to a folder on the external storage with the "ln -s" command.)

 

27) Edit /etc/init.d/liquidsoap so that user and group are "www-data" vice "liquidsoap"

 

28) Change the ownership on /var/run/liquidsoap and /var/log/liquidsoap to www-data

 

  chown www-data:www-data /var/run/liquidsoap

  chown www-data:www-data /var/log/liquidsoap

 

29) Log into mysql via:

 

  mysql -p

 

30) Create a music database and switch to it

 

  create database music;

  use music;

 

31) Create the songs table by entering the following:

 

create table songs(id int not null primary key auto_increment, title varchar(255) not null, artist varchar(255) not null, genre varchar(255) not null, album varchar(255) not null, file varchar(255) not null);

 

32) Set permissions to the database with:

 

  grant all on music.* to music@localhost identified by "linaro";

 

33) Exit MySQL with:

 

  exit

 

34) Copy jukebox.liq to /etc/liquidsoap/ and set it's permissions via:

 

  chmod 755 jukebox.liq

  chown root:root jukebox.liq

 

35) If you attempt to run liquidsoap at this point, you'll get an error that complains about a missing dllliquidsoap.so library.  The following steps will fix this.

 

35.a) Insert your SD card and mount it via the following:

 

  mkdir /mnt/sdcard

  mount /dev/mmcblk1p1 /mnt/sdcard

 

35.b) cd into the card and run the following to build the missing library (note: it will take awhile to complete):

 

  cd /mnt/sdcard

  apt-get install -f libgd2-noxpm-dev libgd-gd2-noxpm-ocaml-dev libgd2-noxpm

  apt-get build-dep liquidsoap

  apt-get source liquidsoap

  cd liquidsoap-1.0.0

  dpkg-buildpackage

  cp src/dllliquidsoap.so /usr/lib/

 

Note: the SD card is needed because downloading the libraries and building from source will consume almost all of the available storage space on the RIoTboard.  Using an SD card for this step avoids any memory issues that may arise while compiling the library (the build-dep line will consume about half of available space).

 

Note: the "apt-get install -f" line forces an install of the listed libraries and triggers removal of a number of binaries dependent on the xpm version of the gd2 libraries, so if you're using the RIoTboard for other purposes, this step may break your current install.

 

As an alternative to the above, I've included a copy of the dllliquidsoap.so library in the files.tgz attachment.  Copy it to /usr/lib/ and set ownership to root:root and permissions to 755.

 

36) Upload at least one ogg file via the web interface

 

37) Create the playlist

 

  ls -1 /var/www/music/*.ogg > /var/www/playlist

 

The content of playlist should comprised of one song per line, with full path.  Example:

 

  /var/www/music/spiderbait-blackbetty.ogg

  /var/www/music/dp-smoke-on-the-water.ogg

 

Note: I need to automate this as part of the upload function.

 

38) Create playing.html and set permissions

 

  touch /var/www/playing.html

  chown www-data:www-data /var/www/playing.html

 

39) Start the services

 

service icecast2 start

service liquidsoap start

 

40) Point your favorite OGG stream player (mplayer works nicely) at:  http://IP-of-riotboard:8000/jukebox.ogg

 

At this point you should be listening to a random song from your playlist.  If not, try troubleshooting by reading /var/log/liquidsoap/jukebox.log, /var/log/apache2/error.log, /var/log/apache2/access.log, and /var/log/mysql.log.

 

Wish LIst (for the RIoTboard)

 

1) More Memory - I wish the board had a couple more 3.6 GBs of memory (there’s only about 1.2GB left after Linux is installed).  As with the RPI, this can be partially rectified by adding external storage and moving most of the operating system there.  Adding file-based swap should also help.

 

2) Newer/better supported versions of Linux - Once the RIoTboard has a dedicated Linux distro, it will probably be easier to get Linux up and running on the RIoTboard.  For now, it's a pain to get running and experimenters might be better served by running Android on the board.  Update: the following was posted 9 days before the deadline for this project.  It contains links to a number of additional operating systems fro the RIoTboard.

 

[One Stop Place] RIoTboard Platform Glossary

 

Other things to do with the Jukebox

 

- Improve the web interface (add Ajax?)

- Add tags and filter-by-tag

- Add to API

 

Noted issues (with the Jukebox)

 

- When first starting the board up, it will take a very long time for a login attempt to finish.  This is because the board is heavily loaded (6+) and certain processes are blocked from completing, a SSH login being one of them.  Just be patient and the system will catch up and finish the login process.

 

Other things I want to try with the RIoTboard (later experimentation)

 

- During boot, while sniffing the network, I see the RIoTboard using IP 10.10.10.6, port 6665, attempting to connect to 10.10.10.4, port 6666.  Having seen this activity before, while substituting firmware on a GoFlex Home, this is UBOOT console in action.  The method used with the GoFlex may negate the need for a UART cable with the RIoTboard (to watch the boot sequence).

- adding a battery to the RIoTboard's real time clock

http://www.embest-tech.com/community/index.php?topic=2846.msg3711#msg3711

- add SD card for increased storage of music (for the Jukebox)

Anonymous