Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Systemd service fails to start #1310

Closed
runningnoodle opened this issue May 7, 2023 · 7 comments
Closed

Systemd service fails to start #1310

runningnoodle opened this issue May 7, 2023 · 7 comments
Labels
needs-investigation Potential bug. Needs investigation

Comments

@runningnoodle
Copy link
Contributor

Version: v2.4.0
OS: Ubuntu 22.04

Description of the bug

The systemd service created with the listmonk@.service file fails to start.

Steps to reproduce

  1. Make sure that the listmonk binary is at /usr/bin/listmonk and that the config file is at /etc/listmonk/mailer.toml
  2. Download the listmonk@.service file in /etc/systemd/system
    cd /etc/systemd/system
    wget https://raw.githubusercontent.com/knadh/listmonk/c10c03178ba6da1e2f8cb61f624b4e691c85af27/listmonk%40.service
  3. Load the listmonk@.service file
    systemctl daemon-reload
  4. Try to start the listmonk service
    systemctl start listmonk@mailer

Expected result

Listmonk should start. It should start sending emails and the dashboard should become available.

This is the result you get when using Listmonk v2.3.0.

Actual result

The dashboard and listmonk itself don't start. You get the following error:
Job for listmonk@mailer.service failed because a fatal signal was delivered causing the control process to dump core. See "systemctl status listmonk@mailer.service" and "journalctl -xeu listmonk@mailer.service" for details.

Proposed fix

#1309

@knadh knadh added the needs-investigation Potential bug. Needs investigation label May 8, 2023
@mr-karan
Copy link
Collaborator

mr-karan commented May 8, 2023

Can you post the complete logs under journalctl -xeu listmonk@mailer.service?

@rhnvrm
Copy link
Collaborator

rhnvrm commented May 8, 2023

Could this be related to this? NixOS/nixpkgs#197443

image

@runningnoodle
Copy link
Contributor Author

As requested, here is the output from journalctl -xeu listmonk@mailer.service after trying to start listmonk with @resources disallowed: journal.txt

In order to investigate this further, I have added SystemCallLog=@resources to both the systemd service files. This allowed me to get logs of any system calls attempted by listmonk that are part of the @resources group.

When running listmonk with @resources allowed, I noticed the following lines in the resulting log file:
May 9 16:41:54 lm kernel: [ 255.860803] audit: type=1326 audit(1683664914.251:36): auid=4294967295 uid=63407 gid=63407 ses=4294967295 subj=unconfined pid=1097 comm="listmonk" exe="/usr/bin/listmonk" sig=0 arch=c000003e syscall=160 compat=0 ip=0x40394e code=0x7ffc0000
May 9 16:41:54 lm kernel: [ 256.036426] audit: type=1326 audit(1683664914.427:37): auid=4294967295 uid=63407 gid=63407 ses=4294967295 subj=unconfined pid=1103 comm="listmonk" exe="/usr/bin/listmonk" sig=0 arch=c000003e syscall=160 compat=0 ip=0x40394e code=0x7ffc0000

With @resources disallowed, I see similar lines, but more of them.

It looks like the culprit is system call 160 (setrlimit). This is the same system call as in the other case found by @rhnvrm. I believe that upgrading to Go 1.19 was the reason that this system call gets used by v2.4.0.

@stargazer33
Copy link

stargazer33 commented May 10, 2023

Version: v2.4.0 OS: Ubuntu 22.04

Description of the bug

The systemd service created with the listmonk@.service file fails to start.

Indeed, to run Listmonk as systemd service was not so easy, it failed many times until I removed a few lines from .service (see below). OK, my Ubuntu is not the latest one, but still, it should be supported. Here the software versions:

Ubuntu 18.04.2 LTS
systemd 237
listmonk v2.4.0 (c668523 2023-03-20T13:50:31Z) (just the binary, without Docker)

I managed to run Listmonk by removing a few things from the .service file
My service file attached (renamed to listmonk.service.txt - otherwise github does not allow it):
listmonk.service.txt
...it might be useful when you decide to support older Ubuntu versions
I removed these lines (and may be something else) and added a few minor things:

SystemCallFilter=
DeviceAllow=

By the way, when troubleshooting systemd issues - always specify the systemd version!
Many systems have old systemd - it just does not know about the latest features/parameters in .service file!

@knadh knadh closed this as completed Aug 3, 2023
@gdevenyi
Copy link

This is still broken, why was it closed?

@gdevenyi
Copy link

Providing the proper reference for the fix, #1309

@knadh
Copy link
Owner

knadh commented Feb 29, 2024

Hi @gdevenyi. There's an open PR (unresolved) pertaining to this: #1614

I've been unable to delve into the nuances of this issue, unfortunately. Would be happy to merge a PR that addresses the unresolved issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-investigation Potential bug. Needs investigation
Projects
None yet
Development

No branches or pull requests

6 participants