Monday, November 4, 2013

Sabnzbd Synology and Ubuntu

I've had Sabnzbd+ and Sickbeard working together quite well together on my Synology DS1512+.  I recently purchased a Dell PowerEdge T110 II to install ESXi 5.5 on.  I figured this was a great opportunity to move some of the "services" that I've been hosting on my NAS over to a real server.  I moved over Plex server and it was many times faster and more useable than it ever was on the Synology.  So I decided to move over Sab and Sickbeard and have them just use the Synology as the storage.  I started off with a CentOS minimal install and went from there.  I had quite a few issues getting Sab to run, I think it was an issue with Python but instead of really troubleshooting it I just tried out Ubuntu server 13.  Ubuntu worked great.  I had no real issues getting it fired up or installing Sabnzbd and Sickbeard.  I did have issues with permissions between Ubuntu and Synology though.

When I created the sickbeard user on both they both looked the same, and when I created files and folders with that user from Ubuntu and on the Synology they were created with full 755 permissions.  When Sabnzbd went to save a new nzb to its download folder it initially created it with 722 permissions.  Everyone could write, but could not read.  Sabnzbd would error out and give up on trying to download.  I thought it was strange since it should be the owner of the file who has full rwx permissions.  SSH'd into the Synology box to see what permissions were set and ls -al showed sickbeard as the owner user as the group and 722 permissions set.  Do the same from the Ubuntu box and ls -al showed owner 1033 and group users.

When you create a user in Ubuntu it startes with a UID of 1000 and puts it in the Users group.  When you create a user on Synology it started at 1024 and also puts them in the Users group.  When the usernames match but the UID does not, it goes by the UID.  User sabnzbd shows up to Synology as someone it doesn't know and throws it into the others category.  That's why sickbeard couldn't read it's own files.

The harder part was trying to figure out how to fix this.  The Synology gui doesn't give you an option to set or change a users UID.  You can do it by cli but if you change it to something under 1024 it causes unintended consequences like the user not showing up in the gui.  Not wanting to chase synology ghosts I decided to change it on the Ubuntu box.  Having only used the install for Sickbeard and Sabnzbd it wasn't that bad.  I changed the UID in /etc/passwd and restarted.  When I logged back in I sudo chown -R sickbeard /home and everything was back to normal and sickbeard was able to read it's own files again.

I think the better way to go about this would have been to create some sort of admin user during setup then create the sickbeard user with the proper UID then install everything.  In Ubuntu you can't log in as root, so if you make a change to your only user, log out and back in, you are taking a big risk of being locked out and starting from scratch.  For me on a VM it wasn't a big deal, for someone else with no VM and some actual use on that box it could of been bad...

Let me know if this helps you out!


No comments:

Post a Comment