You are here
toomanylogins - Thu, 2025/05/01 - 20:44
I have installed the stalwart-mail https://github.com/stalwartlabs email server on a postgres appliance. There is a service present in /etc/systemd/system/stalwart-mail.service. However I cannot figure out how to launch the service at start-up. I've tried systemctl enable stalwart-mail.service but this did not work. Is there something specific I have to do for a turnkey appliance?
Thanks
Paul
Forum:
Hi Paul, it should "just work"
Assuming that 'systemctl start stalwart-mail.service' makes it run manually, 'systemctl enable stalwart-mail.service' should make it auto start at boot time. So I assume that something is causing it to fail to start at boot. My guess is that it's trying to start too early - perhaps before networking has been configured, or something else it depends on.
If I'm correct and you can work out what it needs to wait for, then the service file can be adjusted to ensure that it only starts after whatever it depends on has already started.
The first thing I'd suggest is checking the journal and see if anything jumps out there. To get all messages related to the stalwart service since the last boot:
If that's too noisy and/or nothing jumps out, I recommend rebooting and straight away check the status; 'systemctl status stalwart-mail.service'. Hopefully that will confirm my suspicion and might give some useful info on why it failed. That will only show the last few lines of log, so if you can't see anything there, I'd the journal again (as above).
It might also be useful to manually start it and compare the log entries from the initial (failed) start at boot time vs the successful start after boot.
If you need more guidance, post back with log info. It would also be useful to see a copy of the service file too. Even if you do get it to work yourself, it'd be great if you could share a bit about how you fixed it.
I've just had a quick poke around in their repo
I've just had a quick poke around in their repo - specifically looking at their install script. I'm guessing that you used that to install? So you have their default 'stalwart-mail.service'?
Assuming so, then it should wait for networking to start. But I see that it conflicts with postfix. We have postfix enabled by default to send system emails. If postfix starts first, then it should work because stalwart-mail.service will kill it. But if it starts before postfix, then I suspect that postfix will kill stalwart instead! That would certainly explain why it works ok when started manually but not at boot.
TL;DR if my above troubleshooting steps (i.e. my previous post) don't show anything obvious - or they confirm my latest suspicion - then try disabling postfix (systemctl disable postfix), reboot and see if that helps.
Thanks Nailed it.
Cheers, Paul
Contents of service file as follows
Can we edit comments
No problem, I'm sorry about our site...
Firstly, glad to hear that fixed the issue! :)
I updated the formatting in your earlier post so that's all good.
Because of our crappy old website, to format posts you have 2 options:
Either are a bit of a PITA. #2 (plain text) is probably easier - particularly if you aren't that familiar with html. Although unfortunately it has to be manually selected each time you post ("Filtered HTML" is the default).
The default "Filtered HTML" (#1) is a bit more involved and only supports a subset of html - the supported options should be noted the drop down - but it does support code blocks. The common tags are <p> to start a new paragraph, <pre> for a code block (code blocks honor newlines but need to be closed with a trailing </pre>), <h1>/<h2>/etc (with closing </h1>/</h2>/etc) for headings, <b> & <i> for bold and italic respectively (again with closing </b> or <h2>).
So if I were you, I'd probably just select plain text. If you do want to format a code block then you need to do the whole post in html although I'd just use the <p> (to separate text into paragraphs) and <pre> & <pre> for the code block/s. No need to worry about the others (unless you really want to).
Or just wait for me to fix it! :)
Add new comment