Hello, mailman list:
Trying to add the mailman3.service unit so that mailman3 will start on system boots/reboots. Seeing different behavior with the mailman3.service unit commands vs. with the "/opt/mailman3/venv/bin/mailman" command line. Everyone on this list is more experienced than I with reading systemd error messages and Python code, so your ideas are appreciated. I am using letters and numbers to navigate the six screenshots in this email, I hope this is helpful, without being too much info.
Running the following OS and Python versions. Mailman was installed with "pip install wheel mailman psycopg2-binary" per the virtual environment instructions:
(venv) [keithchristian@localhost ~]$ cat /etc/redhat-release AlmaLinux release 9.4 (Seafoam Ocelot)
(venv) [keithchristian@localhost ~]$ python3 -V Python 3.9.18
To begin: here is the current mailman3.service unit file, taken from the "Starting Mailman automatically" portion of: https://docs.mailman3.org/en/latest/install/virtualenv.html, with all /opt/mailman/ paths set to /opt/mailman3/ for my sandbox system.
A 1 [mailman3@localhost ~]$ cat /etc/systemd/system/mailman3.service A 2 [Unit] A 3 Description=GNU Mailing List Manager A 4 After=syslog.target network.target postgresql.service A 5 A 6 [Service] A 7 Type=forking A 8 PIDFile=/opt/mailman3/mm/var/master.pid A 9 User=mailman3 A 10 Group=mailman3 A 11 ExecStart=/opt/mailman3/venv/bin/mailman start A 12 ExecReload=/opt/mailman3/venv/bin/mailman restart A 13 ExecStop=/opt/mailman3/venv/bin/mailman stop A 14 A 15 [Install] A 16 WantedBy=multi-user.target
Below in line B-6, systemd thinks mailman isn't running, but with the "/opt/mailman3/venv/bin/mailman" commands, line B-2 says it is. I could be misinterpreting the systemd output, however. Python not happy about some directories.
B 1 [mailman3@localhost ~]$ /opt/mailman3/venv/bin/mailman status B 2 GNU Mailman is running (master pid: 10004) B 3 [mailman3@localhost ~]$ systemctl status mailman3.service B 4 mailman3.service - GNU Mailing List Manager B 5 Loaded: loaded (/etc/systemd/system/mailman3.service; enabled; preset: disabled) B 6 Active: failed (Result: exit-code) since Sat 2024-06-08 09:35:57 MDT; 7min ago B 7 Process: 10342 ExecStart=/opt/mailman3/venv/bin/mailman start (code=exited, status=1/FAILURE) B 8 CPU: 762ms B 9 B 10 Jun 08 09:35:57 localhost.localdomain mailman[10342]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/mailman/config/config.py", line 256, in ensure_directories_exist B 11 Jun 08 09:35:57 localhost.localdomain mailman[10342]: makedirs(directory) B 12 Jun 08 09:35:57 localhost.localdomain mailman[10342]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/mailman/utilities/filesystem.py", line 68, in makedirs B 13 Jun 08 09:35:57 localhost.localdomain mailman[10342]: os.makedirs(path, mode) B 14 Jun 08 09:35:57 localhost.localdomain mailman[10342]: File "/usr/lib64/python3.9/os.py", line 225, in makedirs B 15 Jun 08 09:35:57 localhost.localdomain mailman[10342]: mkdir(name, mode) B 16 Jun 08 09:35:57 localhost.localdomain mailman[10342]: PermissionError: [Errno 13] Permission denied: '//var/templates' B 17 Jun 08 09:35:57 localhost.localdomain systemd[1]: mailman3.service: Control process exited, code=exited, status=1/FAILURE B 18 Jun 08 09:35:57 localhost.localdomain systemd[1]: mailman3.service: Failed with result 'exit-code'. B 19 Jun 08 09:35:57 localhost.localdomain systemd[1]: Failed to start GNU Mailing List Manager.
Below, we stop mailman with the command line and check status with systemd. C-1, C-2, show stopped. I'd think systemctl status should show stopped but it doesn't.
C 1 [mailman3@localhost ~]$ /opt/mailman3/venv/bin/mailman stop C 2 Shutting down Mailman's master runner C 3 [mailman3@localhost ~]$ systemctl status mailman3.service C 4 mailman3.service - GNU Mailing List Manager C 5 Loaded: loaded (/etc/systemd/system/mailman3.service; enabled; preset: disabled) C 6 Active: failed (Result: exit-code) since Sat 2024-06-08 09:35:57 MDT; 8min ago C 7 Process: 10342 ExecStart=/opt/mailman3/venv/bin/mailman start (code=exited, status=1/FAILURE) C 8 CPU: 762ms C 9 C 10 Jun 08 09:35:57 localhost.localdomain mailman[10342]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/mailman/config/config.py", line 256, in ensure_directories_exist C 11 Jun 08 09:35:57 localhost.localdomain mailman[10342]: makedirs(directory) C 12 Jun 08 09:35:57 localhost.localdomain mailman[10342]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/mailman/utilities/filesystem.py", line 68, in makedirs C 13 Jun 08 09:35:57 localhost.localdomain mailman[10342]: os.makedirs(path, mode) C 14 Jun 08 09:35:57 localhost.localdomain mailman[10342]: File "/usr/lib64/python3.9/os.py", line 225, in makedirs C 15 Jun 08 09:35:57 localhost.localdomain mailman[10342]: mkdir(name, mode) C 16 Jun 08 09:35:57 localhost.localdomain mailman[10342]: PermissionError: [Errno 13] Permission denied: '//var/templates' C 17 Jun 08 09:35:57 localhost.localdomain systemd[1]: mailman3.service: Control process exited, code=exited, status=1/FAILURE C 18 Jun 08 09:35:57 localhost.localdomain systemd[1]: mailman3.service: Failed with result 'exit-code'. C 19 Jun 08 09:35:57 localhost.localdomain systemd[1]: Failed to start GNU Mailing List Manager.
Below, we start mailman, the "/opt/mailman3/venv/bin/mailman" command line works, D-1 through D-5. Line D-6, the systemd status command (erroneously) shows otherwise.
D 1 [mailman3@localhost ~]$ /opt/mailman3/venv/bin/mailman start D 2 Starting Mailman's master runner D 3 Generating MTA alias maps D 4 [mailman3@localhost ~]$ /opt/mailman3/venv/bin/mailman status D 5 GNU Mailman is running (master pid: 10457) D 6 [mailman3@localhost ~]$ systemctl status mailman3.service D 7 mailman3.service - GNU Mailing List Manager D 8 Loaded: loaded (/etc/systemd/system/mailman3.service; enabled; preset: disabled) D 9 Active: failed (Result: exit-code) since Sat 2024-06-08 09:35:57 MDT; 10min ago D 10 Process: 10342 ExecStart=/opt/mailman3/venv/bin/mailman start (code=exited, status=1/FAILURE) D 11 CPU: 762ms D 12 D 13 Jun 08 09:35:57 localhost.localdomain mailman[10342]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/mailman/config/config.py", line 256, in ensure_directories_exist D 14 Jun 08 09:35:57 localhost.localdomain mailman[10342]: makedirs(directory) D 15 Jun 08 09:35:57 localhost.localdomain mailman[10342]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/mailman/utilities/filesystem.py", line 68, in makedirs D 16 Jun 08 09:35:57 localhost.localdomain mailman[10342]: os.makedirs(path, mode) D 17 Jun 08 09:35:57 localhost.localdomain mailman[10342]: File "/usr/lib64/python3.9/os.py", line 225, in makedirs D 18 Jun 08 09:35:57 localhost.localdomain mailman[10342]: mkdir(name, mode) D 19 Jun 08 09:35:57 localhost.localdomain mailman[10342]: PermissionError: [Errno 13] Permission denied: '//var/templates' D 20 Jun 08 09:35:57 localhost.localdomain systemd[1]: mailman3.service: Control process exited, code=exited, status=1/FAILURE D 21 Jun 08 09:35:57 localhost.localdomain systemd[1]: mailman3.service: Failed with result 'exit-code'. D 22 Jun 08 09:35:57 localhost.localdomain systemd[1]: Failed to start GNU Mailing List Manager.
E 1 [mailman3@localhost ~]$ /opt/mailman3/venv/bin/mailman status E 2 GNU Mailman is running (master pid: 10457) E 3 [mailman3@localhost ~]$ /opt/mailman3/venv/bin/mailman stop E 4 Shutting down Mailman's master runner E 5 [mailman3@localhost ~]$ /opt/mailman3/venv/bin/mailman start E 6 Starting Mailman's master runner E 7 Generating MTA alias maps E 8 [mailman3@localhost ~]$ systemctl status mailman3.service E 9 mailman3.service - GNU Mailing List Manager E 10 Loaded: loaded (/etc/systemd/system/mailman3.service; enabled; preset: disabled) E 11 Active: failed (Result: exit-code) since Sat 2024-06-08 09:35:57 MDT; 2h 21min ago E 12 Process: 10342 ExecStart=/opt/mailman3/venv/bin/mailman start (code=exited, status=1/FAILURE) E 13 CPU: 762ms E 14 E 15 Jun 08 09:35:57 localhost.localdomain mailman[10342]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/mailman/config/config.py", line 256, in ensure_directories_exist E 16 Jun 08 09:35:57 localhost.localdomain mailman[10342]: makedirs(directory) E 17 Jun 08 09:35:57 localhost.localdomain mailman[10342]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/mailman/utilities/filesystem.py", line 68, in makedirs E 18 Jun 08 09:35:57 localhost.localdomain mailman[10342]: os.makedirs(path, mode) E 19 Jun 08 09:35:57 localhost.localdomain mailman[10342]: File "/usr/lib64/python3.9/os.py", line 225, in makedirs E 20 Jun 08 09:35:57 localhost.localdomain mailman[10342]: mkdir(name, mode) E 21 Jun 08 09:35:57 localhost.localdomain mailman[10342]: PermissionError: [Errno 13] Permission denied: '//var/templates' E 22 Jun 08 09:35:57 localhost.localdomain systemd[1]: mailman3.service: Control process exited, code=exited, status=1/FAILURE E 23 Jun 08 09:35:57 localhost.localdomain systemd[1]: mailman3.service: Failed with result 'exit-code'. E 24 Jun 08 09:35:57 localhost.localdomain systemd[1]: Failed to start GNU Mailing List Manager. E 25 [mailman3@localhost ~]$ systemctl stop mailman3.service E 26 ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ==== E 27 Authentication is required to stop 'mailman3.service'. E 28 Multiple identities can be used for authentication: E 29 1. keith christian (keithchristian) E 30 2. mailman3 E 31 Choose identity to authenticate as (1-2): 2 E 32 Password: E 33 ==== AUTHENTICATION COMPLETE ==== E 34 [mailman3@localhost ~]$ systemctl status mailman3.service E 35 mailman3.service - GNU Mailing List Manager E 36 Loaded: loaded (/etc/systemd/system/mailman3.service; enabled; preset: disabled) E 37 Active: failed (Result: exit-code) since Sat 2024-06-08 09:35:57 MDT; 2h 21min ago E 38 Process: 10342 ExecStart=/opt/mailman3/venv/bin/mailman start (code=exited, status=1/FAILURE) E 39 CPU: 762ms E 40 E 41 Jun 08 09:35:57 localhost.localdomain mailman[10342]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/mailman/config/config.py", line 256, in ensure_directories_exist E 42 Jun 08 09:35:57 localhost.localdomain mailman[10342]: makedirs(directory) E 43 Jun 08 09:35:57 localhost.localdomain mailman[10342]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/mailman/utilities/filesystem.py", line 68, in makedirs E 44 Jun 08 09:35:57 localhost.localdomain mailman[10342]: os.makedirs(path, mode) E 45 Jun 08 09:35:57 localhost.localdomain mailman[10342]: File "/usr/lib64/python3.9/os.py", line 225, in makedirs E 46 Jun 08 09:35:57 localhost.localdomain mailman[10342]: mkdir(name, mode) E 47 Jun 08 09:35:57 localhost.localdomain mailman[10342]: PermissionError: [Errno 13] Permission denied: '//var/templates' E 48 Jun 08 09:35:57 localhost.localdomain systemd[1]: mailman3.service: Control process exited, code=exited, status=1/FAILURE E 49 Jun 08 09:35:57 localhost.localdomain systemd[1]: mailman3.service: Failed with result 'exit-code'. E 50 Jun 08 09:35:57 localhost.localdomain systemd[1]: Failed to start GNU Mailing List Manager. E 51 [mailman3@localhost ~]$ systemctl start mailman3.service E 52 ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ==== E 53 Authentication is required to start 'mailman3.service'. E 54 Multiple identities can be used for authentication: E 55 1. keith christian (keithchristian) E 56 2. mailman3 E 57 Choose identity to authenticate as (1-2): 2 E 58 Password: E 59 ==== AUTHENTICATION COMPLETE ==== E 60 Job for mailman3.service failed because the control process exited with error code. E 61 See "systemctl status mailman3.service" and "journalctl -xeu mailman3.service" for details. E 62 [mailman3@localhost ~]$ journalctl -xeu mailman3.service|tail -20 E 63 Defined-By: systemd E 64 Support: https://wiki.almalinux.org/Help-and-Support E 65 E 66 An ExecStart= process belonging to unit mailman3.service has exited. E 67 E 68 The process' exit code is 'exited' and its exit status is 1. E 69 Jun 08 11:58:52 localhost.localdomain systemd[1]: mailman3.service: Failed with result 'exit-code'. E 70 Subject: Unit failed E 71 Defined-By: systemd E 72 Support: https://wiki.almalinux.org/Help-and-Support E 73 E 74 The unit mailman3.service has entered the 'failed' state with result 'exit-code'. E 75 Jun 08 11:58:52 localhost.localdomain systemd[1]: Failed to start GNU Mailing List Manager. E 76 Subject: A start job for unit mailman3.service has failed E 77 Defined-By: systemd E 78 Support: https://wiki.almalinux.org/Help-and-Support E 79 E 80 A start job for unit mailman3.service has finished with a failure. E 81 E 82 The job identifier is 9400 and the job result is failed. E 83 E 84 [mailman3@localhost ~]$ journalctl -xeu mailman3.service|grep -a "Jun 08 11:5[0-9]:[0-9][0-9]" E 85 Jun 08 11:58:51 localhost.localdomain systemd[1]: Starting GNU Mailing List Manager... E 86 Jun 08 11:58:52 localhost.localdomain mailman[11160]: Traceback (most recent call last): E 87 Jun 08 11:58:52 localhost.localdomain mailman[11160]: File "/opt/mailman3/venv/bin/mailman", line 33, in <module> E 88 Jun 08 11:58:52 localhost.localdomain mailman[11160]: sys.exit(load_entry_point('mailman==3.3.9', 'console_scripts', 'mailman')()) E 89 Jun 08 11:58:52 localhost.localdomain mailman[11160]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/click/core.py", line 1157, in __call__ E 90 Jun 08 11:58:52 localhost.localdomain mailman[11160]: return self.main(*args, **kwargs) E 91 Jun 08 11:58:52 localhost.localdomain mailman[11160]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/click/core.py", line 1077, in main E 92 Jun 08 11:58:52 localhost.localdomain mailman[11160]: with self.make_context(prog_name, args, **extra) as ctx: E 93 Jun 08 11:58:52 localhost.localdomain mailman[11160]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/click/core.py", line 943, in make_context E 94 Jun 08 11:58:52 localhost.localdomain mailman[11160]: self.parse_args(ctx, args) E 95 Jun 08 11:58:52 localhost.localdomain mailman[11160]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/click/core.py", line 1644, in parse_args E 96 Jun 08 11:58:52 localhost.localdomain mailman[11160]: rest = super().parse_args(ctx, args) E 97 Jun 08 11:58:52 localhost.localdomain mailman[11160]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/click/core.py", line 1408, in parse_args E 98 Jun 08 11:58:52 localhost.localdomain mailman[11160]: value, args = param.handle_parse_result(ctx, opts, args) E 99 Jun 08 11:58:52 localhost.localdomain mailman[11160]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/click/core.py", line 2400, in handle_parse_result E 100 Jun 08 11:58:52 localhost.localdomain mailman[11160]: value = self.process_value(ctx, value) E 101 Jun 08 11:58:52 localhost.localdomain mailman[11160]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/click/core.py", line 2362, in process_value E 102 Jun 08 11:58:52 localhost.localdomain mailman[11160]: value = self.callback(ctx, self, value) E 103 Jun 08 11:58:52 localhost.localdomain mailman[11160]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/mailman/bin/mailman.py", line 95, in initialize_config E 104 Jun 08 11:58:52 localhost.localdomain mailman[11160]: initialize(value) E 105 Jun 08 11:58:52 localhost.localdomain mailman[11160]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/mailman/core/initialize.py", line 228, in initialize E 106 Jun 08 11:58:52 localhost.localdomain mailman[11160]: initialize_1(config_path) E 107 Jun 08 11:58:52 localhost.localdomain mailman[11160]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/mailman/core/initialize.py", line 122, in initialize_1 E 108 Jun 08 11:58:52 localhost.localdomain mailman[11160]: mailman.config.config.load(config_path) E 109 Jun 08 11:58:52 localhost.localdomain mailman[11160]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/mailman/config/config.py", line 141, in load E 110 Jun 08 11:58:52 localhost.localdomain mailman[11160]: self._post_process() E 111 Jun 08 11:58:52 localhost.localdomain mailman[11160]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/mailman/config/config.py", line 163, in _post_process E 112 Jun 08 11:58:52 localhost.localdomain mailman[11160]: self.ensure_directories_exist() E 113 Jun 08 11:58:52 localhost.localdomain mailman[11160]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/mailman/config/config.py", line 256, in ensure_directories_exist E 114 Jun 08 11:58:52 localhost.localdomain mailman[11160]: makedirs(directory) E 115 Jun 08 11:58:52 localhost.localdomain mailman[11160]: File "/opt/mailman3/venv/lib64/python3.9/site-packages/mailman/utilities/filesystem.py", line 68, in makedirs E 116 Jun 08 11:58:52 localhost.localdomain mailman[11160]: os.makedirs(path, mode) E 117 Jun 08 11:58:52 localhost.localdomain mailman[11160]: File "/usr/lib64/python3.9/os.py", line 225, in makedirs E 118 Jun 08 11:58:52 localhost.localdomain mailman[11160]: mkdir(name, mode) E 119 Jun 08 11:58:52 localhost.localdomain mailman[11160]: PermissionError: [Errno 13] Permission denied: '//var/templates' E 120 Jun 08 11:58:52 localhost.localdomain systemd[1]: mailman3.service: Control process exited, code=exited, status=1/FAILURE E 121 Jun 08 11:58:52 localhost.localdomain systemd[1]: mailman3.service: Failed with result 'exit-code'. E 122 Jun 08 11:58:52 localhost.localdomain systemd[1]: Failed to start GNU Mailing List Manager. E 123 [mailman3@localhost ~]$
For the PermissionError: [Errno 13] Permission denied: '//var/templates' in Line E-119 above, every /var/tamplates directory except the last one has write permissions for mailman3, I doubt that the "/home/keithchristian/var/templates directory" had been tried.
F 1 1716996947 drwxr-xr-x. 2 mailman3 mailman3 6 May 29 09:35 /opt/mailman3/var/templates F 2 1716999414 drwxr-xr-x. 2 mailman3 mailman3 6 May 29 10:16 /opt/mailman3/mailman_install_documentation_edits/var/templates F 3 1717774226 drwxr-xr-x. 2 mailman3 mailman3 6 Jun 7 09:30 /opt/mailman3/venv/var/templates F 4 1717779523 drwxr-xr-x. 2 keithchristian keithchristian 6 Jun 7 10:58 /home/keithchristian/var/templates