On Fri, 21 Oct 2022 12:23:44 -0700 Mark Sapiro <mark@msapiro.net> wrote:
On 10/21/22 09:56, Onyeibo Oku wrote:
On Fri, 21 Oct 2022 09:52:03 -0700 Mark Sapiro <mark@msapiro.net> wrote:
Can you successfully start mailman (or run any mailman commands) with, e.g. ``` /opt/mailman/venv/bin/mailman start
or
/opt/mailman/venv/bin/mailman info
without activating the venv?
Yes. All those are working without activating venv.
On my test installation with /etc/systemd/system/mailman3.service installed per https://docs.mailman3.org/en/latest/install/virtualenv.html#starting-mailman...
systemctl start|stop|status mailman3
all work. Assuming
python3 -c 'from pkg_resources import load_entry_point'
(not in your venv) returns no error, try replacing /opt/mailman/venv/bin/mailman with
#!/opt/mailman/venv/bin/python3 # EASY-INSTALL-ENTRY-SCRIPT: 'mailman==3.3.5','console_scripts','mailman' __requires__ = 'mailman==3.3.5' import re import sys from pkg_resources import load_entry_point if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit( load_entry_point('mailman==3.3.5', 'console_scripts', 'mailman')() )
Or in yours posted at https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/message/... replace everything from the first
try:
throughglobals().setdefault(...)
withfrom pkg_resources import load_entry_point
and see if that helps.
I did the second alternative and replaced from "try" to the "globals ...". It works when I started it directly. However, I get a detailed traceback when systemd tries to start it.
Here is what I got:
Oct 22 04:13:55 mail.server.tld mailman[9253]: Traceback (most recent call last): Oct 22 04:13:55 mail.server.tld mailman[9253]: File "/opt/mailman/venv/bin/mailman", line 9, in <module> Oct 22 04:13:55 mail.server.tld mailman[9253]: from pkg_resources import load_entry_point Oct 22 04:13:55 mail.server.tld mailman[9253]: File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3267, in <module> Oct 22 04:13:55 mail.server.tld mailman[9253]: def _initialize_master_working_set(): Oct 22 04:13:55 mail.server.tld mailman[9253]: File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3241, in _call_aside Oct 22 04:13:55 mail.server.tld mailman[9253]: f(*args, **kwargs) Oct 22 04:13:55 mail.server.tld mailman[9253]: File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3279, in _initialize_master_working_set Oct 22 04:13:55 mail.server.tld mailman[9253]: working_set = WorkingSet._build_master() Oct 22 04:13:55 mail.server.tld mailman[9253]: File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 564, in _build_master Oct 22 04:13:55 mail.server.tld mailman[9253]: ws = cls() Oct 22 04:13:55 mail.server.tld mailman[9253]: File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 557, in __init__ Oct 22 04:13:55 mail.server.tld mailman[9253]: self.add_entry(entry) Oct 22 04:13:55 mail.server.tld mailman[9253]: File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 613, in add_entry Oct 22 04:13:55 mail.server.tld mailman[9253]: for dist in find_distributions(entry, True): Oct 22 04:13:55 mail.server.tld mailman[9253]: File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2077, in find_on_path Oct 22 04:13:55 mail.server.tld mailman[9253]: for dist in factory(fullpath): Oct 22 04:13:55 mail.server.tld mailman[9253]: File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2142, in distributions_from_metadata Oct 22 04:13:55 mail.server.tld mailman[9253]: yield Distribution.from_location( Oct 22 04:13:55 mail.server.tld mailman[9253]: File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2606, in from_location Oct 22 04:13:55 mail.server.tld mailman[9253]: )._reload_version() Oct 22 04:13:55 mail.server.tld mailman[9253]: File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3004, in _reload_version Oct 22 04:13:55 mail.server.tld mailman[9253]: md_version = self._get_version() Oct 22 04:13:55 mail.server.tld mailman[9253]: File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2785, in _get_version Oct 22 04:13:55 mail.server.tld mailman[9253]: version = _version_from_file(lines) Oct 22 04:13:55 mail.server.tld mailman[9253]: File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2569, in _version_from_file Oct 22 04:13:55 mail.server.tld mailman[9253]: line = next(iter(version_lines), '') Oct 22 04:13:55 mail.server.tld mailman[9253]: File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2780, in _get_metadata Oct 22 04:13:55 mail.server.tld mailman[9253]: for line in self.get_metadata_lines(name): Oct 22 04:13:55 mail.server.tld mailman[9253]: File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1422, in get_metadata_lines Oct 22 04:13:55 mail.server.tld mailman[9253]: return yield_lines(self.get_metadata(name)) Oct 22 04:13:55 mail.server.tld mailman[9253]: File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1412, in get_metadata Oct 22 04:13:55 mail.server.tld mailman[9253]: value = self._get(path) Oct 22 04:13:55 mail.server.tld mailman[9253]: File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1616, in _get Oct 22 04:13:55 mail.server.tld mailman[9253]: with open(path, 'rb') as stream: Oct 22 04:13:55 mail.server.tld mailman[9253]: PermissionError: [Errno 13] Permission denied: '/opt/mailman/venv/lib/python3.10/site-packages/zope.i18nmessageid-5.0.1-py3.10.egg-info/PKG-INFO' Oct 22 04:13:55 mail.server.tld systemd[1]: mailman3.service: Control process exited, code=exited, status=1/FAILURE
It seems one of the dependent packages (zope) requires certain privileges that systemd does not have. This may be what was failing initially. How might one solve this?
Regards Onyeibo