【问题标题】:Python Celery init.d script OSError: [Errno 1] Operation not permittedPython Celery init.d 脚本 OSError: [Errno 1] Operation not allowed
【发布时间】:2014-07-18 05:49:08
【问题描述】:

启动/etc/init.d/celeryd 时,出现以下错误。我确保所有目录对于我启动它的用户都是可读写的。我什至做了touch 文件,以确保在所有地方都有一个要写入文件的指令。

(community)community@community:~$ /etc/init.d/celeryd  start
bot_server.settings.production
celery multi v3.1.11 (Cipater)
> Starting nodes...
    > w1.bot_server@community.net: Traceback (most recent call last):
  File "/home/community/community-forums/bot_server/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/community/.virtualenvs/community/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/home/community/.virtualenvs/community/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/community/.virtualenvs/community/local/lib/python2.7/site-packages/djcelery/management/commands/celeryd_detach.py", line 26, in run_from_argv
    detached().execute_from_commandline(argv)
  File "/home/community/.virtualenvs/community/local/lib/python2.7/site-packages/celery/bin/celeryd_detach.py", line 160, in execute_from_commandline
    **vars(options)
  File "/home/community/.virtualenvs/community/local/lib/python2.7/site-packages/celery/bin/celeryd_detach.py", line 42, in detach
    with detached(logfile, pidfile, uid, gid, umask, working_directory, fake):
  File "/home/community/.virtualenvs/community/local/lib/python2.7/site-packages/celery/platforms.py", line 383, in detached
    maybe_drop_privileges(uid=uid, gid=gid)
  File "/home/community/.virtualenvs/community/local/lib/python2.7/site-packages/celery/platforms.py", line 520, in maybe_drop_privileges
    initgroups(uid, gid)
  File "/home/community/.virtualenvs/community/local/lib/python2.7/site-packages/celery/platforms.py", line 473, in initgroups
    return os.initgroups(username, gid)
OSError: [Errno 1] Operation not permitted
* Child terminated with errorcode 1
FAILED

我正在使用:

Django==1.6.3
celery==3.1.11
celerymon==1.0.3
django-celery==3.1.10
django-celery-with-redis==3.0

【问题讨论】:

标签: python django celery django-celery


【解决方案1】:

OSError errno 1 看起来像是权限问题: OSError: [Error 1] Operation not permitted

看起来问题出在 os.initgroups 上,它在系统上调用 initgroups -- 请参阅 man initgroups

根据您的提示,您似乎正在使用某种角色帐户,我猜您的角色/组权限如何设置与 django 正在访问的文件有关。

编辑: 来自man initgroups

DESCRIPTION
   The initgroups() function initializes the group access list by reading
   the group database /etc/group and using all groups of which user is a member.
   The additional group group is also added to the list.

community 可以读取 /etc/group 吗?

【讨论】:

  • community 是该 python 环境的用户和所有者。该用户可以完全访问所有 django 文件。
  • 社区可以读取/etc/group吗? ls -l /etc/group 如果没有,可能会导致 initgroups 失败。您可以尝试在命令行中运行initgroups 来进一步调试;失败/成功的地方应该和 python 一样,但是你会得到更详细的错误信息。
猜你喜欢
  • 2017-12-23
  • 2016-01-05
  • 2017-01-28
  • 2018-05-29
  • 1970-01-01
  • 2022-06-23
  • 2020-02-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多