Mailman status from systemctl not working, but mailman status from command line works

Opensuse 15.6.
mailman3-3.3.9-bp156.1.2.noarch

tutatis:~ # sudo -u mailman mailman info
GNU Mailman 3.3.9 (Tom Sawyer)
Python 3.11.10 (main, Sep 18 2024, 22:14:32) [GCC]
config file: /etc/mailman.cfg
db url: sqlite:////var/lib/mailman/data/mailman.db
devmode: DISABLED
REST root url: http://localhost:8001/3.1/
REST credentials: restadmin:restpass
tutatis:~ #


tutatis:~ # cat /etc/mailman.cfg
# This is the absolute bare minimum base configuration file.  User supplied
# configurations are pushed onto this.

[mailman]
# This address is the "site owner" address.  Certain messages which must be
# delivered to a human, but which can't be delivered to a list owner (e.g. a
# bounce from a list owner), will be sent to this address.  It should point to
# a human.
site_owner: admin@elemariamoliner.com

# Set the paths to be fhs compliant
layout: fhs
[paths.fhs]
ext_dir: /etc/mailman.d
bin_dir: /usr/bin
var_dir: /var/lib/mailman
queue_dir: /var/spool/mailman
log_dir: /var/log/mailman
lock_dir: /run/lock/mailman
pid_file: /run/mailman/master.pid

### ADD NEW SECTIONS AFTER THIS LINE ###

[mta]
incoming: mailman.mta.postfix.LMTP
outgoing: mailman.mta.deliver.deliver
lmtp_host: mydomain.com
#lmtp_host: 127.0.0.1
lmtp_port: 8024
smtp_host: mydomaincom
#smtp_host: 127.0.0.1
smtp_port: 25


# [webservice]
# admin_user: restadmin
# admin_pass: secret

if I enable mailman in systemctl, it fails

tutatis:~ # systemctl status mailman
× mailman.service - GNU Mailing List Manager
     Loaded: loaded (/usr/lib/systemd/system/mailman.service; enabled; preset: disabled)
     Active: failed (Result: timeout) since Thu 2025-01-02 11:29:13 CET; 3min 53s ago
    Process: 1681 ExecStart=/usr/bin/mailman start --force (code=killed, signal=TERM)
        CPU: 2.159s

Jan 02 11:28:00 tutatis systemd[1]: Starting GNU Mailing List Manager...
Jan 02 11:29:13 tutatis systemd[1]: mailman.service: start operation timed out. Terminating.
Jan 02 11:29:13 tutatis systemd[1]: mailman.service: Failed with result 'timeout'.
Jan 02 11:29:13 tutatis systemd[1]: Failed to start GNU Mailing List Manager.
Jan 02 11:29:13 tutatis systemd[1]: mailman.service: Consumed 2.159s CPU time.

and

tutatis:~ # sudo -u mailman mailman status
GNU Mailman is not running

But if I launch mailman from mailman command it works

tutatis:~ # sudo -u mailman mailman start
Starting Mailman's master runner
Generating MTA alias maps
tutatis:~ # sudo -u mailman mailman status
GNU Mailman is running (master pid: 5305)

The service file is

tutatis:~ # cat /usr/lib/systemd/system/mailman.service
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades.  If you want to customize, the
# best way is to create a file "/etc/systemd/system/mailman3.service",
# containing
#       .include /usr/lib/systemd/system/mailman3.service
#       ...make your changes here...
# For more info about custom unit files, see
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F


[Unit]
Description=GNU Mailing List Manager
After=syslog.target network.target

[Service]
Type=forking
PIDFile=/run/mailman/master.pid
User=mailman
Group=mailman
ExecStart=/usr/bin/mailman start --force
ExecReload=/usr/bin/mailman restart
ExecStop=/usr/bin/mailman stop

[Install]
WantedBy=multi-user.target

Maybe I have to copy it to a new mailman3 file and change the ExecStart, etc. To be run by user mailman?

Are you sure it is correct? Apparently systemd waits for your program to fork and it never happens.

No, but i did not change anything there, it is the original file from the opensuse oss repo.

In the service script the user and group is ok, and the command and path is ok, it works if i use it from command line

tutatis:~ # sudo -u mailman /usr/bin/mailman start --force
Starting Mailman's master runner
Generating MTA alias maps
tutatis:~ # sudo -u mailman /usr/bin/mailman status
GNU Mailman is running (master pid: 66578)

I have copied mailman.service to mailman3.service and changed to simple

tutatis:~ # joe /usr/lib/systemd/system/mailman3.service
^K  IW   /usr/lib/systemd/system/mailman3.service (Modified)                                                    Row 16   Col 12  
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades.  If you want to customize, the
# best way is to create a file "/etc/systemd/system/mailman3.service",
# containing
#       .include /usr/lib/systemd/system/mailman3.service
#       ...make your changes here...
# For more info about custom unit files, see
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F


[Unit]
Description=GNU Mailing List Manager
After=syslog.target network.target

[Service]
Type=simple
PIDFile=/run/mailman/master.pid
User=mailman
Group=mailman
ExecStart=/usr/bin/mailman start --force
ExecReload=/usr/bin/mailman restart
ExecStop=/usr/bin/mailman stop

[Install]
WantedBy=multi-user.target
File /usr/lib/systemd/system/mailman3.service saved
tutatis:~ # sudo -u mailman mailman stop
Shutting down Mailman's master runner
tutatis:~ # systemctl mailman3 start
Unknown command verb mailman3.
tutatis:~ # systemctl start mailman3
tutatis:~ # systemctl status mailman3
○ mailman3.service - GNU Mailing List Manager
     Loaded: loaded (/usr/lib/systemd/system/mailman3.service; disabled; preset: disabled)
     Active: inactive (dead)

Jan 02 23:40:22 tutatis systemd[1]: Started GNU Mailing List Manager.
Jan 02 23:40:23 tutatis mailman[67215]: Starting Mailman's master runner
Jan 02 23:40:23 tutatis mailman[67215]: Generating MTA alias maps
Jan 02 23:40:25 tutatis mailman[67221]: Shutting down Mailman's master runner
Jan 02 23:40:25 tutatis systemd[1]: mailman3.service: Deactivated successfully.
Jan 02 23:40:25 tutatis systemd[1]: mailman3.service: Consumed 10.122s CPU time.
tutatis:~ # sudo -u mailman mailman status
GNU Mailman is not running

Then I have tried also to change type to exec with same error, then notify and I had other error

tutatis:~ # systemctl start mailman3
Job for mailman3.service failed because the service did not take the steps required by its unit configuration.
See "systemctl status mailman3.service" and "journalctl -xeu mailman3.service" for details.

Then changed again to forking and I had a new error:

tutatis:~ # systemctl start mailman3
Warning: The unit file, source configuration file or drop-ins of mailman3.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Job for mailman3.service failed because the service did not take the steps required by its unit configuration.
See "systemctl status mailman3.service" and "journalctl -xeu mailman3.service" for details.

The I run

tutatis:~ # systemctl daemon-reload

And now it works …

tutatis:~ # systemctl start mailman3
tutatis:~ # systemctl status mailman3
● mailman3.service - GNU Mailing List Manager
     Loaded: loaded (/usr/lib/systemd/system/mailman3.service; disabled; preset: disabled)
     Active: active (running) since Thu 2025-01-02 23:45:38 CET; 7s ago
    Process: 67827 ExecStart=/usr/bin/mailman start --force (code=exited, status=0/SUCCESS)
   Main PID: 67828 (python3.11)
      Tasks: 18 (limit: 19076)
        CPU: 23.170s
     CGroup: /system.slice/mailman3.service
             ├─67828 /usr/bin/python3.11 /usr/bin/master --force -C /etc/mailman.cfg
             ├─67835 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=archive:0:1
             ├─67836 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=bounces:0:1
             ├─67837 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=command:0:1
             ├─67838 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=in:0:1
             ├─67839 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=lmtp:0:1
             ├─67840 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=nntp:0:1
             ├─67841 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=out:0:1
             ├─67842 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=pipeline:0:1
             ├─67843 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=rest:0:1
             ├─67844 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=retry:0:1
             ├─67845 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=task:0:1
             ├─67846 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=virgin:0:1
             ├─67847 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=digest:0:1
             ├─67863 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=rest:0:1
             └─67864 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=rest:0:1

Jan 02 23:45:35 tutatis systemd[1]: Starting GNU Mailing List Manager...
Jan 02 23:45:37 tutatis mailman[67827]: Starting Mailman's master runner
Jan 02 23:45:37 tutatis mailman[67827]: Generating MTA alias maps
Jan 02 23:45:37 tutatis systemd[1]: mailman3.service: Can't open PID file /run/mailman/master.pid (yet?) after start: No such fi>
Jan 02 23:45:38 tutatis systemd[1]: Started GNU Mailing List Manager.


tutatis:~ # sudo -u mailman mailman status
GNU Mailman is running (master pid: 67828)


but why?

So what? It cannot have bugs?

Because now the unit file matches what the program does.

Sorry, I realized that you put forking back.

Well, the usual reason for a service to fail during boot is (mising) networking. What are you using - wicked or NetworkManager?

I’m using wicked, with static IPv4 (and ipv6 disabled)

Yesterday, after checking that with forking back in the file /usr/lib/systemd/system/mailman3.service it worked, I disabled mailman3 service stopped it and started mailman service … I checked it and it was working (in fact mailman.service and mailman3.service are identical)

Now I have just rebooted the system to check if it works and…

tutatis:~ # systemctl status mailman
● mailman.service - GNU Mailing List Manager
     Loaded: loaded (/usr/lib/systemd/system/mailman.service; enabled; preset: disabled)
     Active: activating (start) since Fri 2025-01-03 15:57:17 CET; 35s ago
  Cntrl PID: 1658 (mailman)
      Tasks: 1 (limit: 19076)
        CPU: 411ms
     CGroup: /system.slice/mailman.service
             └─1658 /usr/bin/python3.11 /usr/bin/mailman start --force


after maybe a couple minutes I check again

tutatis:~ # systemctl status mailman
× mailman.service - GNU Mailing List Manager
     Loaded: loaded (/usr/lib/systemd/system/mailman.service; enabled; preset: disabled)
     Active: failed (Result: timeout) since Fri 2025-01-03 15:58:31 CET; 2min 37s ago
    Process: 1658 ExecStart=/usr/bin/mailman start --force (code=killed, signal=TERM)
        CPU: 3.541s

Jan 03 15:57:17 tutatis systemd[1]: Starting GNU Mailing List Manager...
Jan 03 15:58:31 tutatis systemd[1]: mailman.service: start operation timed out. Terminating.
Jan 03 15:58:31 tutatis systemd[1]: mailman.service: Failed with result 'timeout'.
Jan 03 15:58:31 tutatis systemd[1]: Failed to start GNU Mailing List Manager.
Jan 03 15:58:31 tutatis systemd[1]: mailman.service: Consumed 3.541s CPU time.
tutatis:~ # systemctl start mailman

I would have bet that yesterday I rebooted the system with mailman3 service enabled and it worked.

And I am sure I have tried to launch mailman a lot of times with

tutatis:~ # systemctl start mailman

And it didn’t work, but now

tutatis:~ # systemctl start mailman
tutatis:~ # systemctl status mailman
● mailman.service - GNU Mailing List Manager
     Loaded: loaded (/usr/lib/systemd/system/mailman.service; enabled; preset: disabled)
     Active: active (running) since Fri 2025-01-03 16:01:36 CET; 14s ago
    Process: 5245 ExecStart=/usr/bin/mailman start --force (code=exited, status=0/SUCCESS)
   Main PID: 5246 (python3.11)
      Tasks: 18 (limit: 19076)
        CPU: 23.347s
     CGroup: /system.slice/mailman.service
             ├─5246 /usr/bin/python3.11 /usr/bin/master --force -C /etc/mailman.cfg
             ├─5251 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=archive:0:1
             ├─5252 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=bounces:0:1
             ├─5253 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=command:0:1
             ├─5254 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=in:0:1
             ├─5255 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=lmtp:0:1
             ├─5256 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=nntp:0:1
             ├─5257 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=out:0:1
             ├─5258 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=pipeline:0:1
             ├─5259 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=rest:0:1
             ├─5260 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=retry:0:1
             ├─5261 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=task:0:1
             ├─5262 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=virgin:0:1
             ├─5263 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=digest:0:1
             ├─5266 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=rest:0:1
             └─5267 /usr/bin/python3.11 /usr/bin/runner -C /etc/mailman.cfg --runner=rest:0:1

Jan 03 16:01:33 tutatis systemd[1]: Starting GNU Mailing List Manager...
Jan 03 16:01:35 tutatis mailman[5245]: Starting Mailman's master runner
Jan 03 16:01:35 tutatis mailman[5245]: Generating MTA alias maps
Jan 03 16:01:35 tutatis systemd[1]: mailman.service: Can't open PID file /run/mailman/master.pid (yet?) after start: No such file or directory
Jan 03 16:01:36 tutatis systemd[1]: Started GNU Mailing List Manager.