Add a program to autostart

I recently installed Bazarr to my Dietpi instalation but now I need to add the new path for the application and I don’t know where is the location.

I need to add python bazarr.py and the path where I installed to the autostart on DietPi, so Bazarr can start with Sonarr, Radarr, Jackett and Transmission.

Any suggestion?

Cheers.

Hi,

as this software is not available on DietPi Software catalog, you would need to follow Bazarr vendor instructions to create the autostart entries:

https://github.com/morpheus65535/bazarr/wiki/systemd-service-file-for-Debian-Ubuntu

Google is your friend :sunglasses:

Thanks, I follow the instructions but I cannot make it to start with the Pi :frowning: Maybe it is not compatible with Dietpi.

I don’t see any reason it shouldn’t work. You could try a Docker install? Docker take a bit of learning but there are numerous tutorials around to get you started. One advantage of this approach is you don’t have to mess around with Python versions - if some of your programs need a specific Python version things can get messy. Docker does away with this possible pitfall.

John

I guess there is a configuration issue on the service file because I did a quick and dirty installation on one of my VM’s and it’s working fine

root@DietPiVM1:~# journalctl -u bazarr.service
-- Logs begin at Thu 2020-01-02 18:52:34 CET, end at Thu 2020-01-02 18:53:29 CET. --
Jan 02 18:52:38 DietPiVM1 systemd[1]: Starting Bazarr Daemon...
Jan 02 18:53:08 DietPiVM1 systemd[1]: Started Bazarr Daemon.
Jan 02 18:53:23 DietPiVM1 bazarr[702]: Bazarr starting...
Jan 02 18:53:23 DietPiVM1 bazarr[702]: 2020-01-02 18:53:23,486 - root                             (7f245fb1f740) :  INFO (main:2260) - BAZARR is started
 and waiting for request on http://0.0.0.0:6767/
root@DietPiVM1:~#

did you tried to start the service from command line

 systemctl start bazarr.service

is that working? you can check the status as follow

systemctl status bazarr.service

it should deliver something like this

root@DietPiVM1:~# systemctl status bazarr.service
● bazarr.service - Bazarr Daemon
   Loaded: loaded (/etc/systemd/system/bazarr.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2020-01-02 18:53:08 CET; 4min 29s ago
  Process: 517 ExecStartPre=/bin/sleep 30 (code=exited, status=0/SUCCESS)
 Main PID: 702 (python)
    Tasks: 14 (limit: 2381)
   Memory: 141.2M
   CGroup: /system.slice/bazarr.service
           ├─702 /usr/bin/python /root/bazarr/bazarr.py
           └─706 /usr/bin/python -u /root/bazarr/bazarr/main.py

Jan 02 18:52:38 DietPiVM1 systemd[1]: Starting Bazarr Daemon...
Jan 02 18:53:08 DietPiVM1 systemd[1]: Started Bazarr Daemon.
Jan 02 18:53:23 DietPiVM1 bazarr[702]: Bazarr starting...
Jan 02 18:53:23 DietPiVM1 bazarr[702]: 2020-01-02 18:53:23,486 - root                             (7f245fb1f740) :  INFO (main:2260) - BAZARR is started
 and waiting for request on http://0.0.0.0:6767/

I think that the problem is the version of python, bazarr needs 3.6 or greater, but my istallation doesn’t recognize that I have installed python 3.8 and I don’t know how to change it.

Any suggestion how force to my dietpi to execute python 3.8?

Regards.

Again my question. Are you able to start the service like this?

systemctl start bazarr.service

Edit your systemd startup script along the lines of:

[Service]
ExecStart=/usr/bin/python3.8 /opt/Bazaar…etc

You can have several Pythons versions installed but only one default, so other version can be used like this.

Reconsider using Docker it gets round this type of Python stuff.

John

This is my /etc/systemd/system/bazarr.service:

[Unit]
Description=bazarr Daemon
After=syslog.target network.target

[Service]
User=root
Group=root

Type=simple
ExecStart=python /opt/bazarr/bazarr.py
TimeoutStopSec=20
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target

And this is what I get when I put sudo systemctl start bazarr:

Failed to start bazarr.service: Unit bazarr.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status bazarr.service' for details.

I have tried with Docker but I have not managed to install anything or start it; I have followed the steps of https://hub.docker.com/r/linuxserver/bazarr, I have copied the Docker Pull Command but I cannot follow. Can someone tell me what are the steps to follow?

If from terminal I write python /opt/bazarr/bazarr.py I start the application but as soon as I close the terminal it ends.
Any ideas?

Thank you very much and greetings.

What does

systemctl status bazarr.service say?

In your systemd script put the full path to python3.8.

Or else, assuming Docker is correctly instaled - run this from CLI: (change paths accordingly then paste)

docker create
–name=bazarr
-e PUID=1000
-e PGID=1000
-e TZ=Europe/London
-e UMASK_SET=022 #optional
-p 6767:6767
-v /home/john/bazarr/config:/config
-v /mnt/movies:/movies
-v /mnt/tv:/tv
–restart unless-stopped
linuxserver/bazarr

Just tried this works fine

PS - not a good idea to run this as root as you have done. In the docker script UID 1000 will probly be your own user ID but

id john (in my case) will give you the UID to use.

To which directory you installed bazarr?

This is my systemctl status bazarr.service

bazarr.service - bazarr Daemon
  Loaded: error (Reason: Invalid argument)
  Active: inactive (dead)

I don’t know what is the Invalid argument.

In your systemd script put the full path to python3.8.

I think that this is the full path /usr/local/bin/python, I follow this instructions for the instalation of python 3.8:
https://installvirtual.com/how-to-install-python-3-8-on-raspberry-pi-raspbian/


The path is /opt/bazarr/bazarr.py.

Thanks for all.

Hi,

somehow your config file for the service looks different than the file described on the Bazarr install guide. You are missing some lines unter [Service]

[Unit]
Description=Bazarr Daemon
After=syslog.target network.target
# After=syslog.target network.target sonarr.service radarr.service

[Service]
WorkingDirectory=/opt/bazarr/
User=your_user(username of your choice)
Group=your_group(group of your choice)
UMask=0002
Restart=on-failure
RestartSec=5
Type=simple
ExecStart=/usr/bin/python /opt/bazarr/bazarr.py
KillSignal=SIGINT
TimeoutStopSec=20
SyslogIdentifier=bazarr
ExecStartPre=/bin/sleep 30

[Install]
WantedBy=multi-user.target

To check which python you are running, you can type the following to command line

which python