Systemd Autostart Ubuntu Server 16.04

Sonarr version (exact version): 2.0.0.4146
Mono version (if Sonarr is not running on Windows):4.2.1
OS: Ubuntu Server 16.04
((Debug logs)) (posted to hastebin or similar): Not sure logs are applicable as Sonarr will not start.
Description of issue: Sonarr will not run on system startup but the systemd service will run while run manually.

Alright so I’ve been struggling with this for awhile now. I think I’ve followed the instructions here correctly. I would love any help you could give me with this.

My service file looks like:

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

[Service]
User=nic
Group=nic

Type=simple
ExecStart=/usr/bin/mono /opt/NzbDrone/Nzbdrone.exe -nobrowser
TimeoutStopSec=20
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target

When running “sudo systemctl start sonarr.service” everything works just fine.
However upon a restart, sonarr fails to start. Journalctl -xe reveals this:

-- Subject: Unit sonarr.service has finished start-upic x86_64)
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit sonarr.service has finished starting up.
-- pdates are security updates.
-- The start-up result is done.
Jun 16 08:58:42 Ubuntu-Media mono[1240]: [Info] Bootstrap: Starting Sonarr - /opt/NzbDrone/NzbDrone.exe - Version 2.0.0.4146
Jun 16 08:58:42 Ubuntu-Media mono[1240]: [Fatal] ConsoleApp: EPIC FAIL!
Jun 16 08:58:42 Ubuntu-Media mono[1240]: [v2.0.0.4146] System.UnauthorizedAccessException: Access to the path "/home/nic/.config" is denied.
Jun 16 08:58:42 Ubuntu-Media mono[1240]:   at System.IO.Directory.CreateDirectoriesInternal (System.String path)     <0x7fcacc1565d0 + 0x00120> in <fJun 16 08:58:42 Ubuntu-Media mono[1240]:   at System.IO.Directory.CreateDirectory (System.String path) <0x7fcacc156420 + 0x000a0> in <filename unJun 16 08:58:42 Ubuntu-Media mono[1240]:   at System.IO.DirectoryInfo.Create () <0x7fcacc158170 + 0x00013> in <filename unknown>:0
Jun 16 08:58:42 Ubuntu-Media mono[1240]:   at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:Create ()
Jun 16 08:58:42 Ubuntu-Media mono[1240]:   at System.IO.Directory.CreateDirectoriesInternal (System.String path) <0x7fcacc1565d0 + 0x000d3> in <fJun 16 08:58:42 Ubuntu-Media mono[1240]:   at System.IO.Directory.CreateDirectory (System.String path) <0x7fcacc156420 + 0x000a0> in <filename unJun 16 08:58:42 Ubuntu-Media mono[1240]:   at NzbDrone.Common.Disk.DiskProviderBase.CreateFolder (System.String path) <0x40ccff70 + 0x00110> in <Jun 16 08:58:42 Ubuntu-Media mono[1240]:   at NzbDrone.Common.Disk.DiskProviderBase.EnsureFolder (System.String path) <0x40ccdc20 + 0x00027> in <Jun 16 08:58:42 Ubuntu-Media mono[1240]:   at NzbDrone.Common.EnvironmentInfo.AppFolderFactory.Register () <0x40ccdbb0 + 0x0003d> in <filename unJun 16 08:58:42 Ubuntu-Media mono[1240]:   at NzbDrone.Host.Bootstrap.Start (NzbDrone.Common.EnvironmentInfo.StartupContext startupContext, IUserJun 16 08:58:42 Ubuntu-Media mono[1240]:   at NzbDrone.Console.ConsoleApp.Main (System.String[] args) <0x40c57ce0 + 0x00083> in <filename unknownJun 16 08:58:42 Ubuntu-Media mono[1240]: Press any key to exit...
Jun 16 08:58:42 Ubuntu-Media systemd[1]: sonarr.service: Main process exited, code=exited, status=1/FAILURE
Jun 16 08:58:42 Ubuntu-Media systemd[1]: sonarr.service: Unit entered failed state.
Jun 16 08:58:42 Ubuntu-Media systemd[1]: sonarr.service: Failed with result 'exit-code'.
Jun 16 08:58:43 Ubuntu-Media systemd[1]: sonarr.service: Service hold-off time over, scheduling restart.
Jun 16 08:58:43 Ubuntu-Media systemd[1]: Stopped Sonarr Daemon.
-- Subject: Unit sonarr.service has finished shutting down   

I have attempted to chmod and chown /home/nic/.config to 777 and nic:nic respectively. Not sure where to go from here.

What about directory /home/nic did you check permissions there?
Also the unit you posted has an extra single quote at the end, I assume is a mistake posting in the forum.

I just changed the permissions there as well still comes up with the same issue.
The unit is just related to me posting here, in the actual file it is not there.

Does it starts manually?

/usr/bin/mono /opt/NzbDrone/Nzbdrone.exe

Also you can specify the data path manually

/usr/bin/mono /opt/NzbDrone/Nzbdrone.exe -nobrowser -data=/some/path

I signed up just because I was having the same issues… change Nzbdrone.exe to NzbDrone.exe in your startup script. Pissed me off when I realized that’s why i couldn’t get it to work.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.