Rant
You might ask why I choose the title I did. Why the hard way? Well it is because others and myself have worked so hard to make Rivendell so easy to install on Ubuntu. But it seems that some people want to do the heavy lifting themselves and jump into Rivendell (Linux and the command line too) head first. Now by working on RRAbuntu I am not wanting to end up with what Ham(Amateur) Radio operator call “appliance operators”.
This term refers to people that can use something but have absolutely no idea as to how it works. With true every day appliances this may not be a bad thing. Does the average person need to know how the toaster works to enjoy toasted bread. Not really but if something breaks the average person is going to just put the toaster in the garbage and get a new one. 🙁
A radio automation system is not a toaster. Someone will need to know how to administer the system, period! Otherwise one day it will burn your toast or stop working. Setting up a radio automation system is not a matter of plugging it into the power and inserting bread.
The point of RRAbuntu is to get people over that initial installation learning curve that meant for many that they walked away from Rivendell sans toast. They never figured out how to plug it in or where to put the bread. I find this sad and it is the reason RRAbuntu exists today.
That all said if you think that installing Rivendell will some how magically teach you what you need to know about administering it, or you like to learn things the hard way, then this tutorial is for you. Don’t get me wrong. You will learn some things, some useful and other will be just frustrating. I will not assume you know anything but I will not attempt to teach you what all the commands that we will use mean. That is up to you to figure out.
I highly recommend cutting and pasting the commands into the terminal. Be especially careful of long commands on narrow screens as you may need to scroll to the right to select all of the command. The command line can be a very hard place. One false character including spaces could mean the command does not work.
Note I said hard way not the hardest way as there are two harder ways to install. Next in hardness is compiling and after that compiling from cvs. So, I you are just looking for something really hard to do you may want to move on and go straight to compiling the cutting edge, bleeding heart code from cvs that may or may not work.
Be for warned that for this installation I am going to be very narrow and focused. Others have published tutorials. There is a INSTALL.txt included with the source code when you compile. There is also the very good blog post by Alban. However even he was broader than I am going to be as his tutorial was for Debian and Ubuntu.
I will be using Alban blog post and the scripts that we use in RRAbuntu as the basis for this tutorial. I will focus this tutorial on Ubuntu and specifically Ubuntu 10.04 LTS (Long Term Support) release and Rivendell version 1.7.2 and only one sound card. If you choose to use this tutorial with any other Linux distro, Ubuntu release, or Rivendell version it just might not work, unless you know how “this” toaster works. 😉
So, please do not post comments asking how to plug in a different Linux toaster or where to put the toast in an other Ubuntu release, or how to output or input toast from more than one toaster at a time. 😉
Since you are doing things the hard way I will let you figure out how to install Ubuntu 10.04 LTS on your own. I also trust that you have an ALSA compatible sound card on the computer you are going to install on.
Before you start to install Rivendell you need to decide what to do with Pulse Audio. This is the default sound system on Ubuntu. You need to make the hard decision of what to do with pulse audio. I will present two options. Option one works with the ALSA sound system and the other with JACK and Pulse Audio.
Option A is to basically turn Pulse Audio off and there by allow Rivendell to be the only application to use the sound card using ALSA. Thats right in this option no other program can use the sound card, but hey maybe this is what you want if this is your on-air log playback computer. You do not want systems sounds going out over the air in addition to what is playing in Rivendell.
Option B is to setup Rivendell with JACK and set up Pulse Audio to work with JACK. This allows you to still use your sound card with other applications in addition to Rivendell. However, this is even harder to setup as you need to setup jack, get jack and the daemons to all start in the correct order, etc. So, for now I am not going to cover how to do this, but if enough people ask in the comments I might make a future blog post with that info.
Instructions
I would highly recommend that you read to the end of this blog post before starting to work through these installation instructions.
Step 1. Say goodbye to pulseaudio. I am taking much of this from the Rivendel wiki page that I put together on it. You need to copy /etc/pulse/client.conf to ~/.pulse/client.conf. Use this command to check if you have a .pulse folder and if not, make it.
if [ ! -d ~/.pulse ]; then mkdir ~/.pulse; fi
Now you can copy client.conf with the following command in a terminal:
cp /etc/pulse/client.conf ~/.pulse/client.conf
Then and change the line: ; autospawn = yes to autospawn = no by running in a terminal the following commands :
sed s/\;\ autospawn\ \=\ yes/autospawn\ \=\ no/ ~/.pulse/client.conf >/tmp/temp.conf
cp /tmp/temp.conf ~/.pulse/client.conf
rm /tmp/temp.conf
Now we need to kill and running instances of Pulse Audio with:
killall pulseaudio
After that run
ps -C pulseaudio
to check if pulseaudio is still running. If you do not get back something similar to:
PID TTY TIME CMD
17065 ? 00:00:02 pulseaudio
Then pulse audio is still running, however if you get back:
PID TTY TIME CMD
Then all is well and pulse audio is not running anymore. However if each time you run the command to kill pulse audio it is still there when you run the command to check if it is running and the PID number keeps going higher then you have not turned off autospawning. Maybe you edited the file by hand and missed the fact that you needed to delete the semicolon(;) at the front of the line in client.conf Well one step down, want to continue or are you ready to do download the RRAbuntu CD and drink your favorite beverage in the mean time?
Step 2. Add the Tryphon repository to your software sources. The good people at Tryphon produce packages for Debian and Ubuntu. If you ever have to compile Rivendell you will be thankful for the work they have saved you. May be a good idea to drop them a thank you for packaging and maintaining the repository for Rivendell among other programs. The repository is locate at debian.tryphon.eu and there you can read more about it. However, what you want to do right now is tell our computer to use the tryphon repository as a software source.
echo 'deb http://debian.tryphon.eu lucid main contrib #Tryphon-Rivendell
deb-src http://debian.tryphon.eu lucid main contrib #Tryphon-Rivendell Source' >/tmp/rivendell.list
sudo cp /tmp/rivendell.list /etc/apt/sources.list.d/
rm /tmp/rivendell.list
Next we need to add the repository key with the command:
wget -q -O - http://debian.tryphon.eu/release.asc | sudo apt-key add -
Then make apt aware of the new Tryphon software repository by issuing the following command:
sudo apt-get update
Step 3. Install needed MySQL packages (client and server) as the tryphon packages do not have them listed as a dependency so they will not be installed automatically when installing Rivendell. You also need to start the MySQL server. You can do this with the commands:
sudo apt-get install mysql-client mysql-server
sudo service mysql start
When the Configuring mysql-server dialog pops up answer the “New password for the MySQL “root” user:” with a password. Remember/write this down as you will need it later. <OK> reenter the password and once more <OK>.
Step 4. Setup Linux user and group that the Rivendell daemons and applications will run as. The following commands will setup the Linux user you are running as as the Rivendell Linux user. I will also use the group rivendell as the Rivendell group.
sudo groupadd -f rivendell
sudo adduser $(whoami) rivendell
Step 5. Setup the Rivendell group, in our case rivendell, with real time running privileges with the following commands.
echo '@rivendell - rtprio 99
@rivendell - memlock 250000
@rivendell - nice -10' >/tmp/rivendell.conf
sudo cp /tmp/rivendell.conf /etc/security/limits.d/rivendell.conf
rm /tmp/rivendell.conf
After this you need to log out and then back in again for the real time privileges to take effect.
Step 6. Create a ALSA configuration file. Normally you do not need an ALSA configuration file but Rivendell looks for one and more importantly for entries with rd in them. I am going to assume you do not have an ALSA configuration file and we will create one from scratch with the commands:
echo 'pcm.rd0 {
type hw
card 0
}
ctl.rd0 {
type hw
card 0
}
' >/tmp/asound.conf
sudo cp /tmp/asound.conf /etc/asound.conf
Step 7. Create Rivendell configuration file and setup the current Linux user as the Rivendell Linux user with the following commands:
echo '[Identity]
AudioOwner=username
AudioGroup=rivendell
Password=letmein
[mySQL]
Hostname=localhost
Loginname=rduser
Password=letmein
Database=Rivendell
Driver=QMYSQL3
[Logs]
Facility=Syslog
[Alsa]
PeriodQuantity=4
PeriodSize=1024
[Tuning]
UseRealtime=Yes
RealtimePriority=9
[Format]
SampleRate=44100
Channels=2
[Cae]
AudioRoot=/var/snd
AudioExtension=wav
AllowNonstandardRates=Yes
' >/tmp/tmp.rd.conf
sed s/AudioOwner=username/AudioOwner=$(whoami)/ /tmp/tmp.rd.conf >/tmp/rd.conf
sudo cp /tmp/rd.conf /etc/rd.conf
rm /tmp/rd.conf
rm /tmp/tmp.rd.conf
Step 8. Create directory /var/snd for Rivendell audio files and set permissions with these commands:
if [ ! -d /var/snd ]; then sudo mkdir /var/snd; fi
sudo chown -R $(whoami):rivendell /var/snd
Step 9. Create directory /var/run/rivendell for Rivendell pid files and set permissions with these commands:
if [ ! -d /var/run/rivendell ]; then sudo mkdir /var/run/rivendell; fi
sudo chown -R $(whoami):rivendell /var/run/rivendell
Step 10. Install the Rivendell packages and needed dependencies with:
sudo apt-get install rivendell
When the Configuring jackd dialog pops up, answer the question “Enable realtime process priority?” with <Yes>. When the Rivendell configuration dialog pops up answer the question “Configure Rivendell and rd.conf through debconf?” with <No>.
Step 11. Create test tone cart if it failed to be created correctly with this command:
if [[ ! -f /var/snd/999999_000.wav || ! $( stat -c%s /var/snd/999999_000.wav ) -eq 1769528 ]]; then rdgen -t 10 -l 16 /var/snd/999999_000.wav; fi
Step 12. Start Rivendell for the first time. Since this is the first time there will not be a rivendell database. In order to create it you will be asked for the root mysql login and password that you setup when mysql was installed.
rdadmin
A “mySQL Admin” dialog will pop up. “Unable to access the Rivendell Database! . . .”
User Name: root
Password: the one you gave when you setup MySQL.
You should get back a “Created Database” dialog. Click OK and RDAdmin will start.
User Name: admin
Password: This is blank. Don’t enter anything in the password field just hit enter.
You can now start RDAirplay from the Sound & Video menu. Click the Add button, select the test tone, add it to the log, then click start.
Bash Script
I have made a bash script of all the commands in this blog post if you do not want to do a lot of copying and pasting you are welcome to use it. The instruction for it are this.
1. Download it and save it in your home directory. So, if your Linux login is johndoe you would save it as
/home/johndoe/lucid-1.7.2-install.sh
2. Make the script executable by running the command:
chmod +x ~/lucid-1.7.2-install.sh
3. Run the script to install Rivendell with the command:
~/lucid-1.7.2-install.sh
4. Any time you are asked for a password at the command prompt like so, “[sudo] password for johndoe:“, enter your Linux password.
5. Any time it asks you on the command line “Do you want to continue [Y/n]?” just hit the Enter key to answer yes.
6. When the Configuring mysql-server dialog pops up answer the “New password for the MySQL “root” user:” with a password. Remember/write this down as you will need it later. <OK> reenter the password and once more <OK>.
7. When the Configuring jackd dialog pops up, answer the question “Enable realtime process priority?” with <Yes>.
8. When the Rivendell configuration dialog pops up answer the question “Configure Rivendell and rd.conf through debconf?” with <No>.
One thing that I experience a couple of times and figured out how to get around it by accident, is that before the Configuring jackd dialog comes up my terminal went blank. That is correct, all the text in the terminal disappeared. I waited a while to give it time to come up switch to another open program and back, but only when I in the terminal when to File>Open Tab and then switch back to the original tab that the script was running in did I see the “Configure jackd” dialog.
You can download the bash installation for Rivendell 1.7.2 on Ubuntu Lucid 10.04 LTS script here.
Testing
After five working installs of Ubuntu Lucid 10.04 LTS (and two failed with disk errors), I managed to get everything working correctly in the right order. So this is not a off the cuff blog post that has not been tested or tested on a system that was halfway configured. I hope that this will help some people just like RRAbuntu has to be able to install Rivendell for the first time easily.