Update via GUI failing on Arch Linux

Update Log:

15-5-30 23:03:07.1|Info|UpdateApp|Starting Sonarr Update Client
15-5-30 23:03:07.5|Info|UpdateApp|Updating Sonarr to version 2.0.0.3154
15-5-30 23:03:07.6|Info|AppFolderInfo|Data directory is being overridden to [/var/lib/sonarr]
15-5-30 23:03:07.6|Debug|UpdateApp|NzbDrone process ID: 30688
15-5-30 23:03:07.6|Debug|UpdateApp|Arguments:
15-5-30 23:03:07.6|Debug|UpdateApp|  30688
15-5-30 23:03:07.6|Debug|UpdateApp|  /tmp/nzbdrone_update
15-5-30 23:03:07.6|Debug|UpdateApp|  /usr/lib/sonarr/NzbDrone.exe
15-5-30 23:03:07.6|Debug|UpdateApp|  /data=/var/lib/sonarr
15-5-30 23:03:07.6|Debug|UpdateApp|  /nobrowser
15-5-30 23:03:07.7|Debug|UpdateApp|Using executing application: /usr/lib/sonarr/NzbDrone.exe
15-5-30 23:03:07.7|Debug|UpdateApp|Executable location: /usr/lib/sonarr/NzbDrone.exe
15-5-30 23:03:07.7|Info|UpdateApp|Starting update process. Target Path:/usr/lib/sonarr
15-5-30 23:03:07.7|Info|InstallUpdateService|Verifying requirements before update...
15-5-30 23:03:07.7|Debug|ProcessProvider|Finding process with Id:30688
15-5-30 23:03:07.7|Warn|ProcessProvider|Unable to find process with ID 30688
15-5-30 23:03:07.7|Fatal|UpdateApp|An error has occurred while applying update package.

System.ArgumentException: Process with ID doesn't exist 30688
  at NzbDrone.Update.UpdateEngine.InstallUpdateService.Verify (System.String targetFolder, Int32 processId) [0x000c3] in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Update\UpdateEngine\InstallUpdateService.cs:72 
  at NzbDrone.Update.UpdateEngine.InstallUpdateService.Start (System.String installationFolder, Int32 processId) [0x00000] in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Update\UpdateEngine\InstallUpdateService.cs:76 
  at NzbDrone.Update.UpdateApp.Start (System.String[] args) [0x00020] in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Update\UpdateApp.cs:59 
  at NzbDrone.Update.UpdateApp.Main (System.String[] args) [0x00042] in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Update\UpdateApp.cs:43 

Version information from About page in Sonarr:
(Sonarr) Version 2.0.0.3004
Mono Version 3.12.1 (tarball Thu Mar 12 06:45:56 UTC 2015)
AppData directory /var/lib/sonarr
Startup directory /usr/lib/sonarr

Additional information:
I have confirmed that the process ID does exist, i can only assume that something is keeping sonarr from seeing that the process exists. How can I help troubleshoot this?

I believe Arch is preventing applications from getting the all the processes, so Sonarr’s update process is unable to find the existing process.

FreeNAS has the same issue by the looks of it:

Added an issue to Github to track it https://github.com/Sonarr/Sonarr/issues/584

It appears downgrading mono to 3.10 (from 3.12) allowed it to see the process ID again. I did some more digging on the forums and found a reference to this website: http://dominicm.com/install-nzbdrone-sonarr-on-arch-linux/ which I followed for modifying the systemd script. After that, I kept seeing permissions errors in the logs for accessing the updates folders (this could be my fault, I was attempting to run that ExecStop command referenced in the new systemd script as root just to see what the output in the logs was). Anyway, I fixed a bunch of permissions and finally have a completed upgrade.

I’m throwing a quick VM up while this is all fresh in my head so I can verify the permissions issues were my fault. I’ll post back with more details.

Edit: just kidding, nothing about throwing up an arch linux VM is quick, send for help if i’m not back in a week

Ok,

Fresh 64-bit arch linux VM, installed Sonarr from the arch user repository, and the only thing i had to change to get the update to install properly was add
ExecStop=-/usr/bin/mono /tmp/nzbdrone_update/NzbDrone.Update.exe "ps aux | grep NzbDrone | grep -v grep | awk '{ print $2 }'" /tmp/nzbdrone_update /usr/lib/sonarr/NzbDrone.exe
to file
/usr/lib/systemd/system/sonarr.service

Things of note (to hopefully help other readers):

  • Without that ExecStop line in the systemd script updates via the UI won’t work, the Sonarr process just gets killed and nothing happens afterwards. It seems the ExecStop command properly calls the update process once sonarr gets killed.
  • This VM is 64-bit and the machine I was having issues with is 32-bit. Notably, the mono version on the 64-bit install is different (mono 4.0.1 versus the 32-bit mono 3.12.1 package). Maybe the Process ID issue specifically has something to do with mono 3.12.1?
  • Sonarr can’t restart itself on arch-linux. After the upgrade was done I had to start sonarr with systemctl start sonarr and any time I click the restart button in the UI it successfully kills sonarr, it just doesn’t start it back up again. I believe this is documented elsewhere on the forums as well.
  • Based on my experiences on the fresh VM, I did fubar ownership on a few subdirectories on the 32-bit machine by running that ExecStop command as root instead of the sonarr user. It created several update subdirectories owned by root and they needed to be owned by sonarr for the update to complete properly. If you think you’re running into this issue you can try sudo chown -R sonarr:sonarr /usr/lib/sonarr to fix ownership.