question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Policy daemon won't start

See original GitHub issue

Impacted versions

  • OS Type: Ubuntu
  • OS Version: 22
  • Database Type: PostgreSQ
  • Database version: 14
  • Modoboa: 2.0.1
  • installer used: Yes
  • Webserver: Nginx

Steps to reproduce

  • Install Modoboa on Ubuntu 22 with installer
  • Monitor supervisor withjournalctl -u supervisor -f
  • Notice it keeps restarting, because the python script has errors.

Current behavior

Running policy_daemon manually shows the error. It seems that the loop parameter was removed from asyncio: https://bugs.python.org/issue46796

(env) modoboa@mail:~/instance$ python -V
Python 3.10.4
(env) modoboa@mail:~/instance$ python manage.py policy_daemon
Traceback (most recent call last):
  File "/srv/modoboa/instance/manage.py", line 22, in <module>
    main()
  File "/srv/modoboa/instance/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/srv/modoboa/env/lib/python3.10/site-packages/modoboa/policyd/management/commands/policy_daemon.py", line 39, in handle
    server = loop.run_until_complete(coro)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/usr/lib/python3.10/asyncio/streams.py", line 84, in start_server
    return await loop.create_server(factory, host, port, **kwds)
TypeError: BaseEventLoop.create_server() got an unexpected keyword argument 'loop'

Expected behavior

The daemon should do daemon things instead of crashing.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
gsloopcommented, Aug 9, 2022

A quick two liner that “fixes” this on Ubuntu 22.04. (Fresh install of 22.04 and stock Modoboa install using the python install script.)

cp /srv/modoboa/env/lib/python3.10/site-packages/modoboa/policyd/management/commands/policy_daemon.py /srv/modoboa/env/lib/python3.10/site-packages/modoboa/policyd/management/commands/policy_daemon.py.bak

sed -i ‘s/, loop=loop/ /’ /srv/modoboa/env/lib/python3.10/site-packages/modoboa/policyd/management/commands/policy_daemon.py

This certainly appears to work on Ubuntu 22.04, and SHOULD NOT be considered a fix on any other distro or version! I am unable to find any bad impacts from this fix. If someone finds some, it would be helpful to post an update here!

1reaction
Spitfireapcommented, Jul 14, 2022

It seems it is safe to remove , loop = loop l.37 of modoboa/policyd/management/commands/policy_daemon.py. This doc https://docs.python.org/3.8/library/asyncio-stream.html#asyncio.start_server seems to say that loop is automatically set when no argument is provided no ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Daemon doesn't start at boot - how can I debug this?
Try searching through dmesg, /var/log/messages and /var/log/syslog whyc is it happening so but there is a workaround: 1) Try running chkconfig ...
Read more >
Stop unauthorized applications with RHEL 8's File ... - Red Hat
Red Hat Enterprise Linux 8 ships the File Access Policy Daemon (fapolicyd) application allowlisting daemon. Configuring fapolicyd. There are two ...
Read more >
Re: Daemon Manager service does not start - Cisco Community
I looked over the processes and services windows and realized Daemon Manager wasn´t working. I tried to start it but just doesn't happen....
Read more >
CA ARCserve httpd daemon will not start after rebooting the ...
This may be due to the SElinux policy package being installed on the machine and not allowing the httpd to work with what...
Read more >
start-stop-daemon(8) - Linux manual page - man7.org
If such a process does not exist, start-stop-daemon exits with error status ... -P, --procsched policy:priority This alters the process scheduler policy and ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found