Sonarr won't start on Ubuntu 14.04 server (EPIC FAIL)

Sonarr version: 2.0.0.4472
Mono version: 4.2.3
OS: Ubuntu 14.04 (headless server, terminal only)
Issue: Sonarr is failing to start. I attempted to restart Sonarr via the webUI to resolve an issue with a usenet tracker connection, and it didn’t restart. Upon attempting to run from command line via PuTTy, I got the following:

[Info] Bootstrap: Starting Sonarr - /opt/NzbDrone/NzbDrone.exe - Version 2.0.0.4472 [Error] PidFileProvider: Unable to write PID file: /home/nezumi/.config/NzbDrone/nzbdrone.pid
[v2.0.0.4472] System.UnauthorizedAccessException: Access to the path “/home/nezumi/.config/NzbDrone/nzbdrone.pid” is denied. at System.IO.FileStream…ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) <0x7f92bc95d240 + 0x005ed> in :0 at System.IO.FileStream…ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, System.String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) <0x7f92bc95d190 + 0x0004d> in :0 at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool) at System.IO.StreamWriter.CreateFile (System.String path, Boolean append, Boolean checkHost) <0x7f92bc7cfd50 + 0x00095> in :0 at System.IO.StreamWriter…ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize, Boolean checkHost) <0x7f92bc7cfa10 + 0x00073> in :0 at System.IO.StreamWriter…ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) <0x7f92bc7cf9d0 + 0x00035> in :0 at System.IO.StreamWriter…ctor (System.String path, Boolean append, System.Text.Encoding encoding) <0x7f92bc7cf990 + 0x0002b> in :0 at (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool,System.Text.Encoding) at System.IO.File.WriteAllText (System.String path, System.String contents, System.Text.Encoding encoding) <0x7f92bc95b930 + 0x0003d> in :0 at System.IO.File.WriteAllText (System.String path, System.String contents) <0x7f92bc95b900 + 0x00022> in :0 at NzbDrone.Common.Processes.PidFileProvider.Write () <0x418ce6f0 + 0x000b2> in :0
[Fatal] ConsoleApp: EPIC FAIL!
[v2.0.0.4472] System.UnauthorizedAccessException: Access to the path “/home/nezumi/.config/NzbDrone/nzbdrone.pid” is denied. at System.IO.FileStream…ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) <0x7f92bc95d240 + 0x005ed> in :0 at System.IO.FileStream…ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, System.String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) <0x7f92bc95d190 + 0x0004d> in :0 at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool) at System.IO.StreamWriter.CreateFile (System.String path, Boolean append, Boolean checkHost) <0x7f92bc7cfd50 + 0x00095> in :0 at System.IO.StreamWriter…ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize, Boolean checkHost) <0x7f92bc7cfa10 + 0x00073> in :0 at System.IO.StreamWriter…ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) <0x7f92bc7cf9d0 + 0x00035> in :0 at System.IO.StreamWriter…ctor (System.String path, Boolean append, System.Text.Encoding encoding) <0x7f92bc7cf990 + 0x0002b> in :0 at (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool,System.Text.Encoding) at System.IO.File.WriteAllText (System.String path, System.String contents, System.Text.Encoding encoding) <0x7f92bc95b930 + 0x0003d> in :0 at System.IO.File.WriteAllText (System.String path, System.String contents) <0x7f92bc95b900 + 0x00022> in :0 at NzbDrone.Common.Processes.PidFileProvider.Write () <0x418ce6f0 + 0x000b2> in :0

At this point, I am stuck as to what to do. Before reading another thread about sonarr not starting, I tried purging nzbdrone, rebooting the server and then installing anew, but no luck there either.

Any assistance or pointing in the right direction would be great.

I have made the same query on reddit (https://www.reddit.com/r/sonarr/comments/5u78v2/sonarr_wont_start_on_ubuntu_1404_headless_server/)
When I run “Locate nzbdrone.pid” it now returns no results. “locate nzbdrone” gives the following:
/etc/init.d/nzbdrone
/etc/rc0.d/K20nzbdrone
/etc/rc1.d/K20nzbdrone
/etc/rc2.d/S20nzbdrone
/etc/rc3.d/S20nzbdrone
/etc/rc4.d/S20nzbdrone
/etc/rc5.d/S20nzbdrone
/etc/rc6.d/K20nzbdrone
/usr/share/doc/nzbdrone
/var/cache/apt/archives/nzbdrone_2.0.0.4472_all.deb
/var/lib/apt/lists/update.nzbdrone.com_repos_apt_debian_dists_master_InRelease
/var/lib/apt/lists/update.nzbdrone.com_repos_apt_debian_dists_master_main_binary-amd64_Packages
/var/lib/apt/lists/update.nzbdrone.com_repos_apt_debian_dists_master_main_binary-i386_Packages
/var/lib/dpkg/info/nzbdrone.list
/var/lib/dpkg/info/nzbdrone.md5sums
/var/log/upstart/nzbdrone.log.1.gz

I am worried that when I try and reinstall Sonarr, some old config or other files are sticking around and messing up the new install - is that possible?

It’s possible if the user running Sonarr doesn’t have write access to the NzbDrone folder.

What user is running Sonarr?
If nothing is in that folder you could remove it and see if you still have issues (not sure if you’re trying to restore from a backup or not, but backup the config/database if need be).

Sonarr had been running fine for two months - the only change was that I tried to restart it.

I considered attempting to restore from backup, but in all honesty I wasn’t sure how to go about this in the terminal, so I just went ahead with trying to create a new install.

Well. I’m not sure how/what/why, but instead of running “mono /opt/NzbDrone/NzbDrone.exe” I tried “sudo mono /opt/NzbDrone/NzbDrone.exe”, which seems to have worked.

What do I need to do to avoid this in the future?

It’s a permission issue. And you should fix that. It’s basic linux stuff, nothing really to do with Sonarr.

Running Sonarr as ‘root’ (which sudo) isn’t advisable.

I can kind of understand that, but I’m not sure why it’s happening.

I followed this guide: http://www.htpcguides.com/install-nzbdrone-ubuntu/, including the change ownership part and set that as my main user (nezumi in the above terminal dumps), but it still wasn’t working.

Is there any way to see what’s wrong with the permissions? I would have expected that if I installed sonarr as a user, it would run just fine, and not require me to sudo.

Well, I take that back. This morning I tried connecting to my sonarr through the WebUI (miranda:8989) and the connection was refused, although it worked last night.

nzbdrone is still running on the server, so I’m at a loss as to the cause of this latest hiccup.

Check the permissions on the folder in terminal/via SSH. Since it’s in the home directory the owner should be nezumi (and usually the group as well).

sudo should not be required unless root or another user owns the folder (and it’s contents), which could happen if the folder was restored.

Check the logs, but best to fix the first problem and see if this is still an issue.

I’ve followed https://github.com/Sonarr/Sonarr/wiki/Cannot-install-update-because-startup-folder-is-not-writable-by-the-user, but for both opt/NzbDrone and /home/nezumi.

This seems to have worked, as I was able to start Sonarr without using sudo.

Thanks!

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