0

This is the systemd service template /usr/local/lib/systemd/system/journal-split.service:

[Unit]
Description=Journal Splitter Service / System Init Messages
Documentation=man:journalctl(1) man:systemd-journal-remote(8)
#RefuseManualStart=true

[Service]
Type=oneshot
RemainAfterExit=yes
User=root
Group=systemd-journal
ExecStart=/usr/local/lib/systemd/journal-split.sh
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target default.target

Service installation:

$ systemd-analyze verify journal-split.service
$ sudo systemctl daemon-reload
$ sudo systemctl enable journal-split.service
Created symlink /etc/systemd/system/multi-user.target.wants/journal-split.service → /usr/local/lib/systemd/system/journal-split.service.
Created symlink /etc/systemd/system/default.target.wants/journal-split.service → /usr/local/lib/systemd/system/journal-split.service.
$ sudo reboot

After reboot, the service gets loaded but not executed:

$ systemctl status journal-split
○ journal-split.service - Journal Splitter Service / System Init Messages
     Loaded: loaded (/usr/local/lib/systemd/system/journal-split.service; enabled; vendor preset: disabled)
     Active: inactive (dead)

What may prevent execution?

I can execute the service manually using sudo systemctl start journal-split and it runs successfully.

duise
  • 21
  • 3
  • What does _the journal_ say about what happened during system boot when systemd tried to execute the service? – u1686_grawity Apr 30 '23 at 12:10
  • Journal should have info on what actually caused this. Since it's loaded + inactive, it seems systemd faced difficulty while trying to start the service and then chose to skip it. – sajinmp Apr 30 '23 at 12:33
  • It turned out that /usr/local gets mounted only after systemd has been started. So at the time systemd is trying to read the service definition, it is not availble. I'd like to post a remark to [this post](https://unix.stackexchange.com/questions/224992/where-do-i-put-my-systemd-unit-file) but I don't have the needed 50 credits yet. – duise Apr 30 '23 at 13:08

0 Answers0