Rivendell 3.2.0 install from source.

We have experienced stability issues testing this version.
We do recommend this version until these issues are resolved.

These instructions will allow you to install Rivendell from source on Linux Mint 19 or Ubuntu 18.04 64bit and derivatives (tested using our Linux Mint 19 XFCE 64bit install detailed elsewhere on this site).

Begin the install:

These instructions assume you're logged in as user "broadcast" (without quotes).
If this is not the case then change this to your userid.

Open a terminal and run:

sudo apt-get -y install build-essential dpkg-dev fakeroot g++ g++-7 gcc gcc-7 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libatomic1 libaudio-dev libcilkrts5 libcups2-dev libcupsfilters-dev libcupsimage2-dev libdrm-dev libexpat1-dev libfakeroot libfontconfig1-dev libfreetype6-dev libgcc-7-dev libgl1-mesa-dev libgles1 libglu1-mesa-dev libglvnd-core-dev libglvnd-dev libice-dev libiodbc2 libitm1 libjbig-dev libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev liblcms2-dev liblsan0 liblzma-dev libmng-dev libmng2 libmpx2 libmysqlclient20 libopengl0 libpq5 libpthread-stubs0-dev libquadmath0 libsm-dev libstdc++-7-dev libtiff-dev libtiff5-dev libtiffxx5 libtsan0 libubsan0 libx11-dev libx11-doc libx11-xcb-dev libxau-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb1-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxft-dev libxi-dev libxinerama-dev libxmu-dev libxmu-headers libxrandr-dev libxrender-dev libxshmfence-dev libxt-dev libxxf86vm-dev make mesa-common-dev pkg-config x11proto-core-dev x11proto-damage-dev x11proto-dev x11proto-dri2-dev x11proto-fixes-dev x11proto-gl-dev x11proto-input-dev x11proto-randr-dev x11proto-xext-dev x11proto-xf86vidmode-dev x11proto-xinerama-dev xorg-sgml-doctools xtrans-dev libflac++6v5 libid3-3.8.3v5 sox lame libsox-fmt-all

sudo apt-get -y install apache2 mysql-server

sudo mysql_secure_installation
When prompted, select "N" to "VALIDATE PASSWORD PLUGIN".
Set a password.
Remove anonymous: Y
Disallow root login remotely: N
Remove test database: Y
Reload tables: Y

Fix root MySQL login issues (change from socket to password auth):

sudo mysql -uroot -p
(enter the password you set above)

SELECT User,Host FROM mysql.user;
DROP USER 'root'@'localhost';

ALTER USER 'root'@'%' IDENTIFIED BY 'yourpassword';

Turn off MySQL strict mode to avoid database errors:
sudo vi /etc/mysql/conf.d/disable_strict_mode.cnf
Paste in:

Make some changes to the MySQL config to improve performance:

sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

Add the following to end of this file (this was tested on a machine with 4GB of RAM):
innodb_buffer_pool_size = 512M    # 50-75% of available Memory
innodb_write_io_threads=8 #To stress the double write buffer 
innodb_log_file_size = 32M #Small log files, more page flush 
skip-innodb_doublewrite # might not be needed

Install HPI Audio card support:

Download this .deb tarball to the Downloads directory:
Click here to download.
(Even though this is named for Rivendell 2.19.2 it also supports 3.2.0).

cd /tmp
tar -zxvf /home/broadcast/Downloads/rivendell-2.19.2-amd64.tar.gz
sudo dpkg -i hpi/*.deb

Setup JACK audio:

sudo apt-get -y install jack screen samba patchage vlc-plugin-jack jackd libcdparanoia-dev libflac++-dev libsamplerate0-dev libid3tag0-dev libid3-3.8.3-dev libcurl4-gnutls-dev libsndfile-dev libpam0g-dev libsoundtouch1-dev libasound2-dev libtwolame-dev libmp3lame-dev libmp4v2-dev libfaad-dev libmad0-dev libjack-jackd2-dev libice-dev libsm-dev libxt-dev libxi-dev libssl-dev build-essential libx11-dev libxext-dev xsltproc evince

Do not enable "realtime" if prompted.

Make JACK run on login:

mkdir rdscripts
cd rdscripts

Paste in the following:
screen -DmS jack jackd -dalsa -dhw:0 -r48000 -p1024 -n3 -s &
The -dhw:0 line above may need to be changed to your primary sound adaptor number (for example if your machine has both digial and analogue audio or multiple adaptors).
aplay -l and aplay -L will show these.
The sample rate is set to 48000 in the script above. You might choose to change this to 44100.

Make the script executable:

chmod +x

Make the script run at login:
On the Linux desktop, run "Session and Startup".
Click "Application Autostart". Click "Add":
Name: Broadcast Startup
Path: /home/broadcast/rdscripts/
Add and Close.

Download the Rivendell source code to the Downloads folder:
Click here to download rivendell-3.2.0.tar.gz

tar -zxvf /home/broadcast/Downloads/rivendell-3.2.0.tar.gz

Before compiling, install some more packages that we found we needed:
sudo apt-get install qt4* libtag1-dev libmysqlclient-dev libqt4-sql-mysql libqt5sql5-mysql qtcreator
sudo apt-get install curl python3-mysqldb
sudo apt-get install python3-pyqt4 python3-pip build-essential libssl-dev libffi-dev python3-dev
sudo apt-get install python3-pyqt4*
sudo apt-get install python3.7
sudo apt-get install docbook5*
sudo apt-get install autotools-dev
sudo apt-get install libtooli* automake

International Patches
Date formats in Rivendell are hard coded in American format (MM/DD/YY), meaning that confusingly the date and month are the wrong way around for non-US users. In addition, the meters are marked using American "Vu" style numbers. If you are not in the US, you can apply the following patch file which corrects the date format in RDairplay, RDlibrary, RDlogedit and RDlogmanager and also changes the audio meters to read in dBFS with the indications closely matching an EU or BBC style PPM meter where -18 dBFS is equal to "Test" or PPM4. This patch also changes the background of the RDairplay macro message window to black, as we found that made messages stand out more and makes the interface look more symetrical.

Download the patch file to the Downloads folder:
Click here to download the patch file.

Apply the patch:
cd rivendell-3.2.0
unzip ../Downloads/
Type capital A to confirm replacing the files.

Now we can compile the source:

cd rivendell-3.2.0
./configure --disable-docbook --libexecdir=/usr/local/libexec

Note: This can take some time. Typically between 5 and 30 mins. Ignore any minor "warning" messages. They're normal and are warnings about differences between systems, not errors.

Now install the compiled program:
sudo make install

Create needed links and cache to shared libraries:
sudo /sbin/ldconfig -v

Stop the RDmonitor running at boot (not used in this configuration):
sudo rm /etc/X11/xinit/xinitrc.d/

sudo addgroup rivendell
sudo adduser broadcast rivendell
sudo adduser broadcast audio
sudo adduser broadcast www-data

Configure Apache:

vi ~/rivendell-3.2.0/conf/rd-bin.conf
Around line 24 you will see:
  Options ExecCGI FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
Delete these two lines:
  Order allow,deny
  Allow from all
...and replace with the new way of doing things:
  Require all granted
sudo cp ~/rivendell-3.2.0/conf/rd-bin.conf /etc/apache2/sites-available/

Now make the site active:
sudo a2ensite rd-bin
sudo service apache2 reload

We also need to enable the CGI module otherwise your audio won't import
(because CGI is now disabled by default):
sudo a2dismod mpm_event
sudo a2enmod mpm_prefork
sudo service apache2 restart
sudo a2enmod cgi
sudo service apache2 restart

Creating /var/snd:
sudo mkdir -p /var/snd
sudo chown broadcast:broadcast /var/snd
sudo chmod ug+rwx /var/snd

sudo rdcleandirs

Rivendell needs to run as the same user as Jack, however provided script runs as root by default. Therefore we need to modify this to make it run as our "broadcast" user:

sudo vi /lib/systemd/system/rivendell.service

The following line needs to be added to the end of the [Service] section:

The final file should look like this:
Description=Rivendell Radio Automation System



Now we reload the service file:
sudo systemctl daemon-reload

Some more MySQL tweaks:

sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
In the mysqld section (under [mysqld] at around line 31) add the following line:
default_storage_engine = MyISAM
Also change bind-address to

IMPORTANT Restart the MySQL service:
sudo service mysql restart

Now configure Rivendell:

sudo cp ~/rivendell-3.2.0/conf/rd.conf-sample /etc/rd.conf

Configure Rivendell:
sudo vi /etc/rd.conf







Add the following section to the end of the file:

Populate the new machine's Rivendell database:
sudo rddbmgr --create --generate-audio

Only if you are certain you need to upgrade an existing database, replace this with:
sudo rddbmgr --modify

Note: If you are upgrading from 2.19.2 you might experience poor performance.
The solution appears to be to delete the contents of the STACK_LINES and STACK_SCHED_CODES tables (used to keep track of previously scheduled music) once you have upgraded using an SQL tool such as HeidiSQL. For example via the following SQL commands:
delete from STACK_LINES;
delete from STACK_SCHED_CODES;

Now we can start and check the Rivendell service. We don't set this to auto-start as it has to run after jack:

sudo systemctl start rivendell
sudo systemctl status rivendell

sudo systemctl disable rivendell

Note: If you get an error you may not have rebooted earlier. Reboot and try this section again.

sudo rdalsaconfig
Ensure no sound cards are set as active or JACK won't work.

The way we start the Rivendell service after jack has run is by using the @reboot function of cron. This ensures it runs 30 seconds after our script to start Jack, as long as auto login is enabled. It can also be started manually or via other methods.

sudo crontab -e

Add the following at the end of the crontab file. Note that sudo above is vital as this must be the root cron:

@reboot sleep 30 && systemctl start rivendell

Note: Older and slower booting systems may need 30 changing to 60 seconds or longer.

After a reboot, the system will start the Rivendell services 30 seconds after the system has logged in. This is a bit messy but works well. If any other programs or services need to run automatically (such as rdairplay) at boot, these should have a "sleep 60" command or similar before them to ensure everything has started first.

Note: If you login manually you will need to type "sudo systemctl restart rivendell" after logging in to start Rivendell as the crontab entry above will not work (because it will run before you get a chance to login and run Jack and it needs to run after Jack has loaded). However on unattended systems, auto-login is needed to boot to the desktop and allow Rivendell to run so the crontab entry above will start everything automatically. There are probably many cleaner ways this could be run (which we will document in future) but this is our current tested method.

With that done you no longer need the rivendell source folder:
rm -rf rivendell-3.2.0

Run RDadmin to check the install (or update any previous database).
The username is admin and the password is blank.

IMPORTANT: In RDadmin click "System Settings" and ensure the sample rate is set
to match the JACK config above (48000 in the example).

(Rebooting at this stage is important to ensure all services start.)

The system is now ready to use.

We can now make some cosmetic improvements to Rivendell:

Make the Rivendell interface look a bit nicer:
sudo qtconfig-qt4
Select GUI Style: CDE
Button Background: 181.183.188
Window Background: 144.144.144
Tune Palette \ Active Palette \ Central Colour Roles:
   Window: 144.144.144
   Window Text: 0.0.0
   Base: 255.255.255
   Text: 0.0.0
   Button: 181.183.188
   Button Text: 0.0.0
   BrightText: 140.140.140
   Highlight: 192.192.192
   Highlighted Text: 32.32.32
Close and save the settings.

Run RDadmin:
Click "Manage Hosts" and double click on the current hostname.
Click "RDairplay".
Click "Display Settings", "Background Image".
Select: /home/broadcast/pixmap-background/rdairplay_skin.png.
Click "Ok" and close all the windows.

On dedicated playout machines, the volume control can be removed from the taskbar as it's not required for Rivendell (use "alsamixer" from a terminal instead): Right click on Panel / Panel preferences: Remove the Pulseaudio volume control.

Additional Notes:

"patchage" can be used to check JACK patching.

To adjust the system volume if it's too quiet or loud, run "alsamixer" from a terminal.
Ensure the "Master" output on the soundcard is enabled if no audio.

Troubleshooting JACK.
Both JACK and Rivendell must run as the same user. If there are issues this can be checked with:
ps -C caed -C jackd -o pid,user,group,cmd

For a studio playout system, set the screen resolution of the RDairplay window to 1024x768.
This can be done by running the "Display" utility.
This will ensure RDairplay fills the screen.

Modification to allow JACK and Pulse audio at the same time!

The Rivendell setup above takes full control of the system audio via JACK, so sounds from other applications should not by default be broadcast. This is desired in a radio environment.

However for home or production use you might need to have other applications on the system provide audio. To allow this you can install the Pulse to JACK audio bridge as follows:

sudo apt-get install pulseaudio-module-jack
sudo vi /etc/pulse/
Add the following lines, underneath the #'ed out line that says #load-module module-alsa-sink
load-module module-jack-sink
load-module module-jack-source

Ensure Pulseaudio is disabled at startup (if not done already):
sudo vi /etc/pulse/client.conf
(uncomment the autospawn=yes line, and set it to no)

Make Pulseaudio start AFTER Jack:
cd rdscripts

Add as last lines in file:
sleep 5
pulseaudio &


Install some apps known to work well with this configuration:
sudo apt-get install linphone chromium-browser

Once installed you can do some other cool things using the "patchage" utility, such as connecting the output of non-JACK desktop apps to the JACK input of Audacity to allow their audio to be directly recorded, or you can connect Rivendell to Pulse, allowing the use of in the Chromium browser so remote users can hear real-time high quality audio for remote voicetracking.