SynoCommunity / spksrc

Cross compilation framework to create native packages for the Synology's NAS
https://synocommunity.com
Other
3.04k stars 1.23k forks source link

Sickboard Custom with Sickrage, permission launch problem with dsm6 beta 1 / 2 #2099

Closed reyman closed 6 years ago

reyman commented 8 years ago

Hi,

I'm trying to install Sickrage with Sickboard Custom package in DSM 6 beta 2

I use this fork :

Fork URL: git://github.com/SickRage/SickRage.git
Fork branch: master

Install of the package finish, but this is the package launch which failed. I try with DSM 6 Beta 1 then after upgrade to beta2, without success.

I have a DS213+ FREESCALE QorIQ P1022

Log when i launch the script /var/packages/{package}/scripts/start-stop-status start

root@SPIN:/var/packages/sickbeard-custom/scripts# ./start-stop-status start
Starting SickBeard Custom ...
su: Permission denied

As you can see, i have a permission denied, but i'm in root when i launch the command...

The right in root@SPIN:/var/packages/sickbeard-custom :

root@SPIN:/var/packages/sickbeard-custom# ll
total 60
drwxr-xr-x  5 root root  4096 Jan 23 21:21 .
drwxr-xr-x 30 root root  4096 Jan 23 21:20 ..
drwxr-xr-x  2 root root  4096 Jan 23 21:21 conf
lrwxrwxrwx  1 root root    39 Jan 23 21:20 etc -> /usr/syno/etc/packages/sickbeard-custom
-rw-r--r--  1 root root 38079 Jan 23 21:20 INFO
drwxr-xr-x  2 root root  4096 Dec 20 10:47 scripts
lrwxrwxrwx  1 root root    35 Jan 23 21:20 target -> /volume1/@appstore/sickbeard-custom
drwxr-xr-x  2 root root  4096 Dec 20 10:47 WIZARD_UIFILES

The right in /volume1/@appstore/sickbeard-custom

root@SPIN:/volume1/@appstore/sickbeard-custom# ll
total 20
drwxr-xr-x  5 sickbeard-custom root 4096 Jan 23 21:20 .
drwxrwxrwx 24 root             root 4096 Jan 23 21:20 ..
drwxr-xr-x  3 sickbeard-custom root 4096 Dec 20 10:47 app
drwxr-xr-x  5 sickbeard-custom root 4096 Jan 23 21:20 env
drwxr-sr-x  3 sickbeard-custom root 4096 Jan 23 21:20 var

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

meermisael commented 8 years ago

Same issue here. Tried to chown rights of sickbeard-custom to root and tried giving it to users group, but that doesn't work.

Nailig commented 8 years ago

same here, I looked around and it looks like there are some changes in DSM beta 2 that mess up everything.

They did something with privileges of the admin and root account You can not SSH as root anymore, you need to SSH as admin and then do a sudo su - to become root.

This could mean that install and/or startup scripts behave differently and cannot do things they could previously. like making a user account needed for the package. /bin/nologon is also gone.

Several options to overcome that are becoming available on several fora. I found no perfect solution yet, but i just started looking

baz1860 commented 8 years ago

You absolutely can SSH as root in beta 2; I'm currently logged in via SSH as root at this very moment.

Nailig commented 8 years ago

@baz1860 Maybe you can, but i can't. And i previously could! Both on my DS214play (in use) and on my DS716+ (clean install) both with DSM 6.0 beta 2. I found more posts in the internet from people with the same problem. So instead of just bluntly disagreeing with me (and thereby insulting me), perhaps you could be more helpful and let us know how you log in?

When i do a default ssh session from putty on windows: login as: root root@10.0.1.201's password: Access denied root@10.0.1.201's password:

And please consider that this is beta software, things might work differently on different systems and perhaps you also changed some settings on your DS in the past?

BrianGilbert commented 8 years ago

tail of /var/log/messages when trying to run it:

Jan 26 19:45:45 DiskStation [263354.559182] init: pkgctl-sickbeard-custom pre-start process (27539) terminated with status 1
Jan 26 19:45:45 DiskStation synoscgi_SYNO.Core.Package.Control_1_start[27188]: servicecfg_internal_lib.c:181 Failed to start job [pkgctl-sickbeard-custom][0xD900 manager.cpp:204]
Jan 26 19:45:47 DiskStation synoscgi_SYNO.Core.Package.Control_1_start[27188]: service_initjob_action.c:27 InitJobStart failed, [0xD900 manager.cpp:204]
Jan 26 19:45:47 DiskStation synoscgi_SYNO.Core.Package.Control_1_start[27188]: pkgstartstop.cpp:246 Failed to start pkgctl-sickbeard-custom (err=-1) [0xD900 manager.cpp:204]
baz1860 commented 8 years ago

SSH root@myds415+ logs me in.

I'm using beta 2 on a DS415+ and I'm SSH'ing from Terminal on OSX El Capitan 10.11

It wasn't my intent to insult you, but if you're that easily insulted perhaps the internet isn't for you...

I have found that repeatedly trying to run packages that won't run on first start will eventually allow them to run; sometimes takes 2 goes, sometimes 20, but once they start they stay started through reboots and shutdowns. It's not a solution, but it's a workaround in the mean time. On Tue, 26 Jan 2016 at 08:46 Brian Gilbert notifications@github.com wrote:

tail of /var/log/messages when trying to run it:

Jan 26 19:45:45 DiskStation [263354.559182] init: pkgctl-sickbeard-custom pre-start process (27539) terminated with status 1 Jan 26 19:45:45 DiskStation synoscgi_SYNO.Core.Package.Control_1_start[27188]: servicecfg_internal_lib.c:181 Failed to start job [pkgctl-sickbeard-custom][0xD900 manager.cpp:204] Jan 26 19:45:47 DiskStation synoscgi_SYNO.Core.Package.Control_1_start[27188]: service_initjob_action.c:27 InitJobStart failed, [0xD900 manager.cpp:204] Jan 26 19:45:47 DiskStation synoscgi_SYNO.Core.Package.Control_1_start[27188]: pkgstartstop.cpp:246 Failed to start pkgctl-sickbeard-custom (err=-1) [0xD900 manager.cpp:204]

— Reply to this email directly or view it on GitHub https://github.com/SynoCommunity/spksrc/issues/2099#issuecomment-174894943 .

Dr-Bean commented 8 years ago

For the people who can run as root, what happens when you run the start command manually? Stop the package first, then execute this: https://github.com/SynoCommunity/spksrc/blob/master/spk/sickbeard-custom/src/dsm-control.sh#L23 Obvously replace the variables with the correct values, e.g. ${INSTALL_DIR} becomes /usr/local/sickbeard-custom and so on.

roeiegans commented 8 years ago

@Dr-Bean on the page in your last post I saw the package uses the account "sickbeard-custom". So I thought, give it a shot and create that user before installing, gave it admin permissions... and yes, for now at least... that really seems to be the solution!!! I guess normally this account is created during installation? Will test a bit further, but the package now starts from the GUI again with the latest SR-commit!

matnoublanche commented 8 years ago

Hi all, @Dr-Bean I try that you say, and here is the error returned

ash-4.3# su - root -c "HOME=/usr/local/sickrage/var PATH=/usr/local/sickrage/bin:/usr/local/sickrage/env/bin:/usr/local/python/bin:/usr/local/git/bin /usr/local/sickrage/env/bin/python /usr/local/sickrage/var/SickRage/SickBeard.py --daemon --pidfile /usr/local/sickrage/var/sickbeard-custom.pid --config /usr/local/sickrage/var/config.ini --datadir /usr/local/sickrage/var/"
Downloading pip ...
Downloading: /volume1/@appstore/sickrage/var/SickRage/requirements/get-pip.py Bytes: 1511867
 Installing pip ...0%]
Requirement already up-to-date: pip in /volume1/@appstore/sickrage/env/lib/python2.7/site-packages
Cleaning up downloaded pip files
Patching SiCKRAGE SSL Context
Checking for required SiCKRAGE packages, please stand by ...
[1.00%]::Installing APScheduler package
[2.00%]::Installing babelfish package
[4.00%]::Installing backport-ipaddress package
[5.00%]::Installing backports-abc package
[6.00%]::Installing backports.ssl-match-hostname package
[8.00%]::Installing beautifulsoup4 package
[9.00%]::Installing bencode package
[10.00%]::Installing CacheControl package
[12.00%]::Installing certifi package
[13.00%]::Installing chardet package
[14.00%]::Installing click package
[16.00%]::Installing cryptography package
[17.00%]::Installing decorator package
[18.00%]::Installing dill package
[20.00%]::Installing docopt package
[21.00%]::Installing dogpile.cache package
[22.00%]::Installing dogpile.core package
[24.00%]::Installing enum34 package
[25.00%]::Installing enzyme package
[27.00%]::Installing feedparser package
[28.00%]::Installing FormEncode package
[29.00%]::Installing future package
[31.00%]::Installing futures package
[32.00%]::Installing gntp package
[33.00%]::Installing guessit package
[35.00%]::Installing hachoir-core package
[36.00%]::Installing hachoir-metadata package
[37.00%]::Installing hachoir-parser package
[39.00%]::Installing httplib2 package
[40.00%]::Installing html5lib package
[41.00%]::Installing idna package
[43.00%]::Installing ipaddress package
[44.00%]::Installing jsonrpclib package
[45.00%]::Installing lockfile package
[47.00%]::Installing Mako package
[48.00%]::Installing markdown2 package
[50.00%]::Installing MarkupSafe package
[51.00%]::Installing MultipartPostHandler package
[52.00%]::Installing oauth2 package
[54.00%]::Installing oauthlib package
[55.00%]::Installing pbr package
[56.00%]::Installing profilehooks package
[58.00%]::Installing py-unrar2 package
[59.00%]::Installing pycparser package
[60.00%]::Installing PyGithub package
[62.00%]::Installing pysrt package
[63.00%]::Installing python-dateutil package
[64.00%]::Installing python-fanart package
[66.00%]::Installing python-twitter package
[67.00%]::Installing pytz package
[68.00%]::Installing pyxdg package
[70.00%]::Installing PyYAML package
[71.00%]::Installing requests package
[72.00%]::Installing requests-oauthlib package
[74.00%]::Installing rtorrent-python package
[75.00%]::Installing Send2Trash package
[77.00%]::Installing simplejson package
[78.00%]::Installing singledispatch package
[79.00%]::Installing six package
[81.00%]::Installing SQLAlchemy package
[82.00%]::Installing sqlalchemy-migrate package
[83.00%]::Installing SQLObject package
[85.00%]::Installing sqlparse package
[86.00%]::Installing stevedore package
[87.00%]::Installing subliminal package
[89.00%]::Installing sympy package
[90.00%]::Installing Tempita package
[91.00%]::Installing tmdbsimple package
[93.00%]::Installing tornado package
[94.00%]::Installing tzlocal package
[95.00%]::Installing wheel package
[97.00%]::Installing xmltodict package
[98.00%]::Installing yarg package
[100.00%]::Installing python-daemon package
Checking for upgradable SiCKRAGE packages, please stand by ...
  File "/volume1/@appstore/sickrage/var/SickRage/sickrage/__init__.py", line 755, in main
    if core.initialize():
  File "/volume1/@appstore/sickrage/var/SickRage/sickrage/core/__init__.py", line 467, in initialize
    'nolaunch': sickrage.WEB_NOLAUNCH
  File "/volume1/@appstore/sickrage/var/SickRage/sickrage/core/webserver/__init__.py", line 180, in __init__
    ctx = daemon.DaemonContext()
Traceback (most recent call last):
  File "/volume1/@appstore/sickrage/var/SickRage/sickrage/__init__.py", line 755, in main
    if core.initialize():
  File "/volume1/@appstore/sickrage/var/SickRage/sickrage/core/__init__.py", line 467, in initialize
    'nolaunch': sickrage.WEB_NOLAUNCH
  File "/volume1/@appstore/sickrage/var/SickRage/sickrage/core/webserver/__init__.py", line 180, in __init__
    ctx = daemon.DaemonContext()
AttributeError: 'module' object has no attribute 'DaemonContext'

I try to execute it as default user and as root too

Hope that it helps

neoatomic commented 8 years ago

@Dr-Bean We are also getting multiple reports that the sickbeard-custom package isn't working for DSM 6.0 Beta.

I know there is some sort of change in DSM 6 concerning the accounts/rights/permissions, but didn't follow the development to know the details... The info i currently have is when installed before the upgrade (DSM 5.2 --> DSM 6) the package works, but a fresh install on DSM 6 doesn't. Also looking at the SickRage logs, they point to permission issues. For testing, one user did create the account sickbeard-custom (with administrative rights) before the package installation, and that allows the package to run and function correctly. More about that here. : https://github.com/SickRage/sickrage-issues/issues/587#issuecomment-175194186

Hope you will be able to take a look at whats the issue with sickbeard-custom and DSM 6. (btw. This shouldn't be confused with the sickragetv version 6 from the old Repo, that is broken for another reason.)

EDIT: Forgot to add. All issues i have seen where with the sickbeard-custom package, haven't seen one with the (former) sickrage package jet. Could be coincidence, but hope someone can test manually installing the *.spk just to be sure.

Diaoul commented 8 years ago

There should be some new ability in DSM 6 to create system users without needing busybox but I don't have DSM 6 to test nor any documentation so for now there's not much we can do.

BrianGilbert commented 8 years ago

I was able to get it running by changing perms as per: https://forum.synology.com/enu/viewtopic.php?f=190&t=48640&start=75#p238521

leipert commented 8 years ago

Another workaround would be creating a "Manual Task" with the Task Scheduler.

The command to run the sickbeard daemon is simply:

/usr/local/python/bin/python /usr/local/sickbeard-custom/var/SickBeard/SickBeard.py --pidfile /usr/local/sickbeard-custom/var/sickbeard-custom.pid --config /usr/local/sickbeard-custom/var/config.ini --datadir /usr/local/sickbeard-custom/var/ --daemon --nolaunch

Just make sure the task is disabled and has the root user set:

screen shot 2016-02-06 at 18 39 17

You can copy the command from above here:

screen shot 2016-02-06 at 18 41 36

Now you can run the Task Start SB manually from the web interface without needing to set funny user rights via ssh.

the1ts commented 8 years ago

Just done a fresh install of sickbeard on a fresh DSM 6.0 Beta 2 and the start-stop-status script was getting

su - : permission denied

I looked at the sickbeard-custom user added by the package and there was an entry in /etc/passwd that looked fine, but no entry in /etc/shadow, on adding the entry in /etc/shadow I, as root, was able to 'su - sickbeard-custom' and the package was also able to start.

After further investigation, it appears worse than this, just installed sabnzb and the sickbeard-custom user uid-100 has been taken as the sabnzb, again without an update to /etc/shadow.

Is it some changes to user addition in DSM 6.0?

mastruck commented 8 years ago

I just updated SB on DSM 6 and now have the same problem. It was running fine after upgrading DSM to 6 and I had successfully done at least one SB update since the upgrade to 6, but the last one broke it.

I tried running the suggested script via task scheduler with no success.

Suggestions on how to proceed would be appreciated.

mastruck commented 8 years ago

This is the output when I run the suggested script via the task scheduler:

Traceback (most recent call last): File "/usr/local/sickbeard-custom/var/SickBeard/SickBeard.py", line 94, in import sickbeard File "/volume1/@appstore/sickbeard-custom/var/SickBeard/sickbeard/init.py", line 38, in from sickbeard.config import CheckSection, check_setting_int, check_setting_str, check_setting_float, ConfigMigrator File "/volume1/@appstore/sickbeard-custom/var/SickBeard/sickbeard/config.py", line 29, in from sickbeard import naming File "/volume1/@appstore/sickbeard-custom/var/SickBeard/sickbeard/naming.py", line 27, in from sickbeard import tv File "/volume1/@appstore/sickbeard-custom/var/SickBeard/sickbeard/tv.py", line 51, in from sickbeard import network_timezones File "/volume1/@appstore/sickbeard-custom/var/SickBeard/sickbeard/network_timezones.py", line 34, in sb_timezone = get_localzone() File "/usr/local/sickbeard-custom/var/SickBeard/lib/tzlocal/unix.py", line 122, in get_localzone _cache_tz = _get_localzone() File "/usr/local/sickbeard-custom/var/SickBeard/lib/tzlocal/unix.py", line 91, in _getlocalzone return pytz.timezone(etctz.replace(' ', '')) File "/usr/local/sickbeard-custom/var/SickBeard/lib/pytz/init.py", line 180, in timezone raise UnknownTimeZoneError(zone) pytz.exceptions.UnknownTimeZoneError: 'Timezone/Pacific'

mfoti commented 8 years ago

Same problem for me, but seems to be related just to the start-stop-status script, try to change it with:

edit as root: /var/packages/[appname]/scripts/start-stop-status

start_daemon ()
{
   "HOME=${INSTALL_DIR}/var PATH=${PATH} sudo -u ${USER} ${PYTHON} ${SICKBEARD} --daemon --pidfile ${PID_FILE} --config ${CFG_FILE} --datadir ${INSTALL_DIR}/var/"
}
Safihre commented 6 years ago

Test packages for DSM6.1 and various architectures are available here #3138. They also include a new way of handling permissions and should fix existing issues. We hope to publish the packages to the official repo soon and appreciate all testing and reports on the functioning of these packages.