HOW-TO Auto start MMDVMHost as a service on boot in Raspbian Jessie

The following is taken from a file that was uploaded to the MMDVM Yahoo group by KC7WSU; it is not my original work, but it does the job far better than anything I could have figured out – why re-invent the wheel!

I have dissected the file to add my own comments to explain what is going on at each stage to aid in your self-learning.

Use Raspbian Jessie Lite

This first instruction is to use Raspbian Jessie Lite ; it should work equally well in the full version of Jessie.  To download the img file, goto the Raspberry Pi website here.  Instructions on how to flash the image to an SD card are also there.

You should be executing the following commands using the command line interface accessible from a terminal session if you are running the full Jessie image.  If you are using Jessie Lite, you should be familiar with the command line interface as that’s the only option you have!

1. Expand File System
 # sudo raspi-config

This first step will open a textual dialogue with various options, select the first option and follow any instructions given.

Screenshot from 2016-03-19 10-11-45

2. Update Raspberry Pi
 # sudo apt-get update
 # sudo apt-get upgrade

Step 2 ensures the RPi is up-to-date and running the latest software.

3. Install Pre-Requisite Software
 # sudo apt-get install git screen

At step 3, we install some software that will be of use in the following steps.  Git is the software we will use to download MMDVMHost and/or MMDVMCal in the next step.  Screen is a terminal multiplexer which will enable us to connect to the output of MMDVMHost and see what it’s doing later on.

4. Download MMDVM Software 
 # cd /opt
 # sudo git clone
 # sudo git clone

Step 4 downloads the software’s source code.  (MMDVMCal is optional).

5. Build MMDVM Host Software
 # cd /opt/MMDVMHost
 # sudo make
 # sudo nano MMDVM.ini
 Edit Settings according to Format
 **Make sure you change the port settings**
6. Build MMDVM Calibration Tool
 # cd /opt/MMDVMCal
 # sudo make

Steps 5 and 6 build the executables and configure MMDVMHost.  (MMDVMCal is still optional, but obviously it won’t be there to build if you optionally decided not to download it in step 4!)

My advice here is, once you are happy with the way the system is running, set the logging level to 0 (FileLevel=0) so you don’t write to the SD card constantly; DisplayLevel=1 is fine as-is or if you want something slightly more readable than all the hex/ascii data DisplayLevel=2 is probably what you want.

OK, here’s the bit we are interested in, else you wouldn’t be here, right …?!

7. Create Service
 # sudo nano /lib/systemd/system/mmdvmhost.service

Description=MMDVM Host Service

ExecStart=/usr/bin/screen -S MMDVMHost -D -m /opt/MMDVMHost/MMDVMHost /opt/MMDVMHost/MMDVM.ini
ExecStop=/usr/bin/screen -S MMDVMHost -X quit


 # sudo chmod 755 /lib/systemd/system/mmdvmhost.service

Create a symbolic link between your script and a special location under /etc:
 # sudo ln -s /lib/systemd/system/mmdvmhost.service /etc/systemd/system/mmdvmhost.service

This step opens a text editor for you to copy the RED text and save it to a file, set some permissions and then link it to the required file elsewhere in the filesystem.

8. Create Timer
 # sudo nano /lib/systemd/system/mmdvmhost.timer



 # sudo chmod 755 /lib/systemd/system/mmdvmhost.timer

Create a symbolic link between your script and a special location under /etc:
 # sudo ln -s /lib/systemd/system/mmdvmhost.timer /etc/systemd/system/mmdvmhost.timer

Step 8 is similar to step 7 above, but this one tells it to start 60 seconds after boot.

9. Make systemd aware of your new service

 # sudo systemctl daemon-reload
 # sudo systemctl enable mmdvmhost.timer
 # sudo reboot

Service should start 60 sec after bootup.

What we are doing in step 9 is making Jessie aware we have added and new service and enabling the 60 second timer.  We’re also done, so reboot to fire her up!

The rest of the file are commands we can use to control the MMDVMHost service and how to update the software when new updates are released.  Some more advice for you, copy your MMDVM.ini file somewhere safe before you update as it may be overwritten.

Appendix A

Start Service manually
 # sudo systemctl start mmdvmhost.service

Stop Service manually
 # sudo systemctl stop mmdvmhost.service

Restart Service manually
 # sudo systemctl restart mmdvmhost.service

Service Status
 # sudo systemctl status mmdvmhost.service

Connect to Screen Output
 # sudo screen -r MMDVMHost
 Ctrl+a then d to disconnect from screen and keep the service running.

 # sudo /opt/MMDVMHost/MMDVMHost /opt/MMDVMHost/MMDVM.ini

 # sudo /opt/MMDVMHost/MMDVMCal /dev/ttyACM0

Appendix B

Update MMDVM Host Software
 # cd /opt/MMDVMHost
 # sudo git pull
 # sudo make
 # sudo nano MMDVM.ini
 Edit Settings according to Format
 **Make sure you change the port settings**

 Update MMDVM Calibration Tool
 # cd /opt/MMDVMCal
 # sudo git pull
 # sudo make

2 thoughts on “HOW-TO Auto start MMDVMHost as a service on boot in Raspbian Jessie

  1. unable to get my Utah image on a PI3 to auto start. My directory is different, but all is the same as you have
    here. Only failure was the linking, which told me file exists…
    Manually running or stopping the mmdvm host works fb!
    Since this is going 30 miles away, I need to know it will restart after power failure…
    Glen K4KV
    Moultrie, GA
    repeater ID#311335,311334


    1. Glen was wondering if you got this working as I am having the same issue. I tried to do the same thing and the only difference is my directory as well. I even changed the directory and got even more errors so I changed it back. Any info would be appreciated.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s