Summary: | if unit's process exits non-zero no more logging for that unit until reboot | ||
---|---|---|---|
Product: | systemd | Reporter: | Piotr Staszewski <p.staszewski> |
Component: | general | Assignee: | systemd-bugs |
Status: | RESOLVED WONTFIX | QA Contact: | systemd-bugs |
Severity: | normal | ||
Priority: | low | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Piotr Staszewski
2014-07-07 22:40:25 UTC
What precisely do you mean by "logging"? syslog()? or stdout/stderr logging? My logging always works fine ehre, regardless if syslo() or stdout/stderr style logging, and regardless how many times i restart a service... Can you tell me exactly what I need to do to reproduce the issue? I did some more testing today, and my results are weird, but I suspect it's due to my peculiar setup. I have /var/log as a tmpfs ('tmpfs /var/log tmpfs defaults,noatime,nodiratime,mode=0755,size=16M 0 0'). 0. Testing software Simple printf() loop, binary at /home/user/test-logging: #include <stdio.h> #include <unistd.h> int main(int argc, char *argv[]) { int counter = 0; while (1) { printf("<5>Counter: %d\n", counter); fflush(stdout); sleep(3); counter++; } } Service file, saved at /etc/systemd/system/test-logging.service: [Unit] Description=Logging tester After=network.target [Service] ExecStart=/home/user/test-logging WorkingDirectory=/home/user Restart=always [Install] WantedBy=multi-user.target 1. Test one Systemd and journald have been running since boot, where journald.conf has: [Journal] Storage=persistent SyncIntervalSec=30m SystemMaxUse=8M At shell: systemctl start test-logging systemctl status test-logging - did it a couple of times, no counter output logged whatsoever systemctl stop test-logging 2. Test two Modified journald.conf to have only: [Journal] SystemMaxUse=8M At shell: systemctl restart systemd-journald systemctl start test-logging systemctl status test-logging - did it a couple of times, counter output is being logged as intended systemctl restart test-logging systemctl status test-logging - still logging as it should systemctl stop test-logging 3. Test three So I added back my two custom options to journald.conf: [Journal] Storage=persistent SyncIntervalSec=30m SystemMaxUse=8M At shell: systemctl restart systemd-journald systemctl start test-logging systemctl status test-logging - did it a couple of times, logging well as in the previous test! systemctl stop test-logging In a way my problem seems to be solved, though I do not understand exactly why the logging works as the above tests show. My guess is that the tmpfs /var/log with Storage=persistent causes some trouble on boot and systemd is not logging; then restarting it without the Storage options invokes some setup code, so that from that point the logging works regardless of Storage or SyncIntervalSec values... Please feel free to close this issue if the above behaviour is a known condition/intended feature etc. Hmm, btw, we log to /run/log/journal (which is a tmpfs) if you leave Storage=volatile... It's weird, to make /var/log/ a tmpfs, if there's already /run/log for that... Closing all stale bugs with NEEDINFO. Please open a new bug at https://github.com/systemd/issues if the problem still occurs. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.