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 syslog-ng service fails to activate #20153

Closed
basvandijk opened this issue Nov 4, 2016 · 4 comments · Fixed by #22752
Closed

systemd syslog-ng service fails to activate #20153

basvandijk opened this issue Nov 4, 2016 · 4 comments · Fixed by #22752
Assignees
Labels
0.kind: bug 0.kind: regression Something that worked before working no longer 9.needs: package (update)
Milestone

Comments

@basvandijk
Copy link
Member

I'm upgrading my systems from NixOS 16.03 to 16.09 and I'm trying to get syslog-ng working again. It's currently configured as:

{ syslog-ng.enable = true; }

The issue is that systemd is not noticing that syslog-ng has started:

Nov 04 12:47:08 mymachine systemd[1]: syslog-ng.service: Start operation timed out. Terminating.
Nov 04 12:47:08 mymachine systemd[1]: Failed to start syslog-ng daemon.
Nov 04 12:47:08 mymachine systemd[1]: syslog-ng.service: Unit entered failed state.
Nov 04 12:47:08 mymachine systemd[1]: syslog-ng.service: Failed with result 'timeout'.
Nov 04 12:47:08 mymachine systemd[1]: syslog-ng.service: Service hold-off time over, scheduling restart.

I do see that syslog-ng is running:

# ps -AH a | grep syslog
/nix/store/kag473gb3w8zaqw09qkgsjg2qn4ra5zc-syslog-ng-3.6.2/sbin/syslog-ng --foreground --module-path=/nix/store/kag473gb3w8zaqw09qkgsjg2qn4ra5zc-syslog-ng-3.6.2/lib/syslog-ng --cfgfile=/nix/store/8f9npiv1fyc487haxj0ff957ag7zqzld-syslog-ng.conf --control=/run/syslog-ng/syslog-ng.ctl --persist-file=/var/syslog-ng/syslog-ng.persist --pidfile=/run/syslog-ng/syslog-ng.pid

Note that the systemd syslog-ng service is configured with Type = "notify"; This means that syslog-ng should notify systemd when it has started up. My current hypotheses is that with the systemd upgrade to 231 something in the notification protocol has changed causing the syslog-ng notification to fail.

@danbst
Copy link
Contributor

danbst commented Nov 5, 2016

It has strange config:

      wantedBy = [ "multi-user.target" ];
      after = [ "multi-user.target" ]; # makes sure hostname etc is set

how could this work ?

@basvandijk could you test this? syslog-ng at least starts for me

diff --git a/nixos/modules/services/logging/syslog-ng.nix b/nixos/modules/services/logging/syslog-ng.nix
index 21be286..fd6ab7d 100644
--- a/nixos/modules/services/logging/syslog-ng.nix
+++ b/nixos/modules/services/logging/syslog-ng.nix
@@ -82,9 +82,9 @@ in {
       description = "syslog-ng daemon";
       preStart = "mkdir -p /{var,run}/syslog-ng";
       wantedBy = [ "multi-user.target" ];
-      after = [ "multi-user.target" ]; # makes sure hostname etc is set
+      after = [ "network.target" ]; # makes sure hostname etc is set
       serviceConfig = {
-        Type = "notify";
+        Type = "simple";
         StandardOutput = "null";
         Restart = "on-failure";
         ExecStart = "${cfg.package}/sbin/syslog-ng ${concatStringsSep " " syslogngOptions}";

@basvandijk
Copy link
Member Author

thanks @danbst, with those changes syslog-ng starts up correctly.

@fpletz
Copy link
Member

fpletz commented Nov 9, 2016

how could this work ?

wantedBy means that the syslog-ng unit will be activated (started) if multi-user.target gets activated. By itself this relation defines no order. That's why you can add after and before relations as you wish.

As I've mention in #20211, the root problem is that our current version of syslog-ng can't be built with our current version of systemd and thus the sd-notify feature is not present.

@fpletz fpletz added 0.kind: regression Something that worked before working no longer and removed 9.needs: community feedback labels Nov 9, 2016
@fpletz fpletz added this to the 16.09 milestone Nov 9, 2016
@fpletz fpletz self-assigned this Jan 11, 2017
@basvandijk
Copy link
Member Author

Hi @fpletz, I did some work on the syslog-ng upgrade. I've managed to get syslog-ng-3.9.1 to build with LumiGuide@ee0826e. I will now test this a bit.

basvandijk added a commit to LumiGuide/nixpkgs that referenced this issue Feb 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug 0.kind: regression Something that worked before working no longer 9.needs: package (update)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants