Start Mavproxy as a service

I tried to make a service that starts mavproxy in my rasperry. I made the service file and put it in systemd, i put the complete part in the exec of the service fie and user pi and all other settings. Once i start it with systemctl the service turns green and doesn’t throw any error but nothing comes out. If i use the same path i use in the service file in the command line it starts and does its things.
Is there anything special i have to add to make it work?
I am at home now and don’t have the file with me but i’ll post it tomorrow. Any help will be greatly appreciated.

Another little question, if i wanted to update my installed mavproxy to the latest release how should i proceed? pip install --upgrade MAVProxy?


Here is the script:

Description=My service

ExecStart=/usr/local/lib/python3.7/dist-packages/MAVProxy/ --master=/dev/ttyAMA0 --baudrate=115200 --out=udp: --aircraft=Quad


p.s. managed to update mavproxy, way easier than i tought, just run “pip install --upgrade MAVProxy” that is all it took.

Hi there!
I am trying to make a MAVProxy start as service as well, but it keeps crashes right away.
There is no error information except: “Process exit with error code” after calling systemctl status.
In the output file there is only standard starting info from MAVProxy and waiting for master.

Do you have any ideas what can be the issue?

P.S. I tried it on Navio image and clean raspbaian as well.

I’d suggest using an init script for Mavproxy (, and just a simple call to mavproxy by systemd

Hi, @james_pattison, thanks for answer. Unfortunately, this can’t be done because I need to define outputs depends on system configuration.

Isn’t is possible for you to start mavproxy simply in the /etc/rc.local ? That’s the way I’m doing this (also with different “on-the-fly” generated configurations).

@fingadar Main goal is to monitor mavproxy and restart it if it fail. Also second feature is control when it start, for example after network is working.

But I didn’t try it yet. I will check if it work.

Hello, I am also trying to run mavproxy as a service. But the service exits with status 203, which says it could not find the path to the executable. Did you mange to solve it?


@Pavan Hi, after trying a lot of ways, finally found mine.

Create file with settings for service at: /etc/default/pixhawkmavlink

#MASTER settings

#UDP config

Next, create file with service at: /etc/systemd/system/pixhawkmavlink.service

Description=Pixhawk to mavproxy/mavros deamon

ExecStart=/usr/local/bin/ --master=${DEVICE},${DEVICE_BAUD} --out=udpbcast:${UDP_ADR}:${UDP_PORT} --aircraft=pixhawk --cmd="set flushlogs True" --state-basedir="/home/pi/" --daemon


At the end, you can create configuration script at: /usr/local/bin/ or type everything by hand. In my opinion better way is to make script, you will have saved commands if you need to restart it.

#! /bin/bash

sudo systemctl daemon-reload
sudo systemctl enable pixhawkmavlink
sudo systemctl daemon-reload
sudo service pixhawkmavlink start
service --status-all

Launch script with sudo, which will launch the service. After every boot, it will wait for WiFi connection or Ethernet and then launch service.
In the /etc/default/pixhawkmavlink file you can change settings like baudrate or serial device and port for UDP. If you need, you can create your own settings and use it in service file.
You can also change names of files if needed.

Good luck!

Edit: I am working on Navio image with preinstalled mavproxy.


Thank you for the answer. I tried it and when I run the service with ExecStart=/usr/local/bin/…, I get an error ‘No executable found’. I see the Mavproxy is installed in /home/pi/.local/bin/ in the pi. But when I use this path, the service still does not run and the service status says error 203. Is the Mavproxy in your system installed in /usr/local/bin/ ?

We use supervisor to launch and monitor processes in our vehicles

Yes, it’s preinstalled.
If in your case its installed in /home/pi seems like you only make installation for user, not root. In this case you could experience problem launching program from different user. Try start mavproxy with sudo, and see whats going on.

So having User as pi and a script with mavproxy launch command in it solved the issue.


ExecStart=/usr/bin/screen -DmS mavproxy /home/pi/


1 Like

Hey, very cool setup here. Is there any way you can use mavproxy interactively after starting it as a service in daemon mode? For instance, checking for a certain parameter and setting it to a desired value via mavproxy once the deamon has started, either manually over ssh or automatically in ExecStartPost.

Hi, what I remember, interacting with systemd can be tricky, if sometimes not possible. If you have some set of settings and params you want to upload and set, you can try mavproxy scripts ( With them you can define all needed variables, params and mavproxy itself.

1 Like

I used crontab

sudo crontab -e

@reboot sudo /home/ubuntu/ardupilot/build/sitl/bin/arducopter -S --model + --speedup 1 --slave 0   --defaults /home/ubuntu/ardupilot/Tools/autotest/default_>
@reboot sudo /usr/bin/screen -Dms mavproxy /home/ubuntu/




/usr/bin/ --out --out --master tcp: --sitl --out udpout:  --cmd="set flushlogs True" --state-basedir="/home/ubuntu/"  --daemon

systemd has all but replaced crontab and should be used in its place in almost every case.

The dev response (above) to utilize an initialization script that is triggered by a systemd service is the cleanest, most practical solution.

1 Like