Thursday 14 August 2014

Fixing Sabnzbd and Sickbeard etc. in FreeNAS 9.x


A friend of mine asked me for some help after they managed to break their install of Sabnzbd and Sickbeard in FreeNAS 9.2.1.5, after a power cut none of the plugins would start in the plugin jail created.

After much research it seemed they had managed to change the permissions of all the files in the jail to 777.

Theres various posts relating to this being a bug in some way, theres even a bug report: https://bugs.freenas.org/issues/3992

First thing I tried was upgrading to 9.2.1.7 that had just been released, unfortunately this didn't work.

All I could find via google was that I should remove the Jail and reinstall, but I didn't fancy doing this.

I worked out that there was an issue with Python, when trying to run it from the command line I got the message below:

# python 
Shared object "libintl.so.9" not found, required by "python"

I'm not sure that this was causing the issue but looking in /lib I saw that libintl.so.9 was missing, using locate I found it in /usr/local/lib and copied it to /lib:

cp /usr/local/lib/libintl.so.9 /lib
Trying python again and it worked!

# pythonPython 2.7.6 (default, Dec 11 2013, 21:07:05) [GCC 4.2.1 20070831 patched [FreeBSD]] on freebsd9Type "help", "copyright", "credits" or "license" for more information.>>> exit() 

Ok, lets try and start sabnzbd:

# service sabnzbd restartsabnzbd not running? (check /var/db/sabnzbd/sabnzbd.pid).Starting sabnzbd.su: pam_start: system error/usr/local/etc/rc.d/sabnzbd: WARNING: failed to start sabnzbd

Damn! doesn't work, lets check the logs:

# tail /var/log/messagesAug 13 15:03:55 Downloads su: in openpam_check_desc_owner_perms(): /etc/pam.d/su: insecure ownership or permissionsAug 13 15:03:55 Downloads su: pam_start: system error

Ok, permissions errors, after a bit of trial and error using chmod permissions I found the below worked:

# chmod 755 /etc/pam.d/*# chmod 755 /usr/lib/pam*

* Note I have no idea if this is the correct permission but it worked for me!

Ok, lets try and start sabnzbd again:

# service sabnzbd restartsabnzbd not running? (check /var/db/sabnzbd/sabnzbd.pid).Starting sabnzbd.Error:Can't write to logfile/usr/local/etc/rc.d/sabnzbd: WARNING: failed to start sabnzbd

Better but looks like permissions on the logfile this time, I worked out the logfiles were stored in /var/db/sabnzbd/logs so changed the permissions to 777:

# chmod 777 /var/db/sabnzbd/logs/*

And tried for a third time to start sabnzbd:

# service sabnzbd restartsabnzbd not running? (check /var/db/sabnzbd/sabnzbd.pid).Starting sabnzbd.

Yay! no errors, browsed to the jails IP on port 8080 and sabnzbd was running.

Now to try Sickbeard:


# service sickbeard startStarting sickbeard.Traceback (most recent call last):  File "/usr/pbi/sickbeard-amd64/share/sickbeard/Sick-Beard/SickBeard.py", line 403, in <module>    main()  File "/usr/pbi/sickbeard-amd64/share/sickbeard/Sick-Beard/SickBeard.py", line 323, in main    sickbeard.initialize(consoleLogging=consoleLogging)  File "/usr/pbi/sickbeard-amd64/share/sickbeard/Sick-Beard/sickbeard/__init__.py", line 667, in initialize    logger.sb_log_instance.initLogging(consoleLogging=consoleLogging)  File "/usr/pbi/sickbeard-amd64/share/sickbeard/Sick-Beard/sickbeard/logger.py", line 99, in initLogging    self.cur_handler = self._config_handler()  File "/usr/pbi/sickbeard-amd64/share/sickbeard/Sick-Beard/sickbeard/logger.py", line 111, in _config_handler    file_handler = logging.FileHandler(self.log_file_path, encoding='utf-8')  File "/usr/pbi/sickbeard-amd64/lib/python2.7/logging/__init__.py", line 903, in __init__    StreamHandler.__init__(self, self._open())  File "/usr/pbi/sickbeard-amd64/lib/python2.7/logging/__init__.py", line 928, in _open    stream = codecs.open(self.baseFilename, self.mode, self.encoding)  File "/usr/pbi/sickbeard-amd64/lib/python2.7/codecs.py", line 881, in open    file = __builtin__.open(filename, mode, buffering)IOError: [Errno 13] Permission denied: '/usr/pbi/sickbeard-amd64/etc/sickbeard/Logs/sickbeard.log'/usr/local/etc/rc.d/sickbeard: WARNING: failed to start sickbeard
Damn! lots of errors, however theres one about log permissions, so I'll try fixing that:


chmod 777 /usr/pbi/sickbeard-amd64/etc/sickbeard/Logs/sickbeard.log
And try again:

# service sickbeard start
Starting sickbeard.
No errors, a quick browse to the jails IP on port 8081 and Sickbeard was running too!

It's not been rebooted yet so this may not be a permanent fix but its working for now.

6 comments:

  1. Just wondering, did this permanently fix the issue?

    Cheers

    ReplyDelete
    Replies
    1. It seems to, Frenas has since been updated and rebooted and all is still working.

      Delete

  2. i need help as well are you copying the whole script and pasting it in the jail?

    ReplyDelete

  3. i need help as well are you copying the whole script and pasting it in the jail?

    ReplyDelete
  4. Cool, this worked for me thank you!!!

    ReplyDelete