Auto Update fails on Arch Linux

I changed your service file slightly since the default location when installing Sonarr from the AUR is “/usr/lib/sonarr” but it comes up with an error.
Service file
Service file error

Your particular error is caused by the fact that ExecStop line is split into 3 lines. Just format it so it is just one line. There are other issues that prevent it form working for me though, trying some things out now.

Well, here’s another alternative for ensuring your Sonarr installation is up to date. Reproduce the same functionality within systemd using an update service and an update timer.

#Step 1 - Disable internal updater and configure pkg sources
First, disable the internal updater within sonarr via the web interface.

Then configure your package manager to get updates from the sonarr repo (directions below for ubuntu, alter as necessary):

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FDA5DFFC
echo “deb http://apt.sonarr.tv/ develop main” | sudo tee etc/apt/sources.list.d/sonarr.list

#Step 2 - Sonarr updater service
Now go into /etc/systemd/system and create the file ‘sonarr-update.service’

[Unit]
Description=Sonarr Updater 
Wants=sonarr-update.timer

[Service]
Type=oneshot
ExecStart=-/bin/systemctl stop sonarr
ExecStart=-/usr/bin/apt-get update
ExecStart=-/usr/bin/apt-get install --only-upgrade nzbdrone
ExecStart=-/bin/systemctl start sonarr
TimeoutStopSec=20

[Install]
WantedBy=multi-user.target

#Step 3: Create timer for Sonarr Updater
Now go into /etc/systemd/system and create the file ‘sonarr-update.timer’

[Unit]
Description=Sonarr updater timer

[Timer]
# Feel free to change the "OnCalendar" setting to any value you wish.
# Sonarr's internal process does it every 4 hours, but I think once a day is more than enough.
# More info: http://www.freedesktop.org/software/systemd/man/systemd.time.html
OnCalendar=daily
Persistent=true
Unit=sonarr-update.service

[Install]
WantedBy=multi-user.target

#Step 4: Enable timer
Perform the following:

systemctl daemon-reload
systemctl enable sonarr-update.timer
systemctl start sonarr-update.timer

Note: Do NOT “enable” the sonarr-update.service via systemctl enable. The service file is called by the timer.

Ok, I have the issues on Arch resolved.

The link to the executable can be either /usr/bin/mono /usr/lib/sonarr/NzbDrone.exe or just /usr/bin/sonarr

For ExecStart -data=/var/lib/sonarr argument is also required.

I updated [Install Sonarr on Arch Linux][1] post with the systemd file corrected for Arch. @Ice_Nine btw, let me know if you want me to link somewhere to you as an author of the script :smile:
[1]: http://dominicm.com/install-nzbdrone-sonarr-on-arch-linux/

No need, like anything else, it’s going to need editing to satisfy the needs of any particular distribution :slight_smile: A lot of this is simple trial and error while I learn all the nuances of systemd.

I’ll report in on how the timer-based updates work out. I have it configured now, I figure in a couple of days I’ll have some good data regarding how reliable it is.

-k

I had issues with autoupdate working on Ubuntu that were related to Sonarr (Drone at the time) not exiting gracefully at update time. It was running as an Upstart job, and Upstart would try to restart the service, borking the update. I had to turn off “respawn” in the .conf file.

There (if I remember right) were permission issues with Sonarr (which runs as you) modifying its default install directory (not owned by you) --which I solved by installing sonarr into my home folder and running it from there. I suppose I could have chown/chmod’d the default install directory as well, but figured this was easier and more portable should I need to migrate the install.

Well, you should always chown a directory that has to run as a certain user - unless you want to restrict writes (then you could simply chmod or use an acl/stickybit).

This is why I think it’s simply easier to just have systemd handle the whole upgrade process. Since systemd controls the underlying process, it has no problem killing it, allowing root to update it, and restart it again as the proper user without incident.

I know there’s a lot of misguided hate towards systemd. Say what you will about it, it’s very well thought-out. I understand that the linux community prefers decentralization above most things, but systemd just makes perfect sense to me (except for the whole journal thing not being a flat file, that kinda sucks, but it’s not a horrible ordeal since everything gets dumped in cleartext to syslog anyway).

I moved a post to a new topic: Arch Linux Updater Requests Windows Update Package

The service script doesn’t seem to work for me. It seems like the update exe is called with the wrong arguments?

Here’s what my service looks like: http://pastebin.com/V7sTqC9T

After getting the update package and moving everything where it should be, the updater is then called like this:

15-2-10 01:19:44.8|Debug|mono|Starting mono /tmp/nzbdrone_update/NzbDrone.Update.exe 638 /tmp/nzbdrone_update /usr/lib/sonarr/NzbDrone.exe /data=/var/lib/sonarr /nobrowser

Which seems wrong? Shouldn’t the third argument be /usr/lib/sonarr or have I misunderstood how the updater works?

Edit

Got it working. Think there was some funky-ness somewhere about the ‘\`’ in the ExecStop command which should take care of taking over the update job when the updater kills the process. Used " instead and it works fine.

It looks like formatting struck again :slight_smile: Thanks for sharing it. Updated Install Sonarr on Arch Linux post too so now it should work out of the box.