Open danbst opened 8 years ago
The patch for 2)
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index 338b068..14a1ef1 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -185,7 +185,14 @@ let
makeJobScript = name: text:
let mkScriptName = s: (replaceChars [ "\\" ] [ "-" ] (shellEscape s) );
- x = pkgs.writeTextFile { name = "unit-script"; executable = true; destination = "/bin/${mkScriptName name}"; inherit text; };
+ realScriptText = ''
+ #! ${pkgs.stdenv.shell} -e
+ (
+ _DUMMY_=
+ ${text}
+ ) 2> >( while read line; do echo "<5>''${line}"; done)
+ '';
+ x = pkgs.writeTextFile { name = "unit-script"; executable = true; destination = "/bin/${mkScriptName name}"; text = realScriptText; };
in "${x}/bin/${mkScriptName name}";
unitConfig = { name, config, ... }: {
@@ -231,37 +238,31 @@ let
}
(mkIf (config.preStart != "")
{ serviceConfig.ExecStartPre = makeJobScript "${name}-pre-start" ''
- #! ${pkgs.stdenv.shell} -e
${config.preStart}
'';
})
(mkIf (config.script != "")
{ serviceConfig.ExecStart = makeJobScript "${name}-start" ''
- #! ${pkgs.stdenv.shell} -e
${config.script}
'' + " " + config.scriptArgs;
})
(mkIf (config.postStart != "")
{ serviceConfig.ExecStartPost = makeJobScript "${name}-post-start" ''
- #! ${pkgs.stdenv.shell} -e
${config.postStart}
'';
})
(mkIf (config.reload != "")
{ serviceConfig.ExecReload = makeJobScript "${name}-reload" ''
- #! ${pkgs.stdenv.shell} -e
${config.reload}
'';
})
(mkIf (config.preStop != "")
{ serviceConfig.ExecStop = makeJobScript "${name}-pre-stop" ''
- #! ${pkgs.stdenv.shell} -e
${config.preStop}
'';
})
(mkIf (config.postStop != "")
{ serviceConfig.ExecStopPost = makeJobScript "${name}-post-stop" ''
- #! ${pkgs.stdenv.shell} -e
${config.postStop}
'';
})
Current problems with patch: containers fail to start because of some fd error; some services log info messages to stderr; when stderr is appended to stdout line, we get ugly <5>
in info logs.
(triage) does this still happen?
Yes, however this should be tagged with "Feature request", I wouldn't call this a bug.
Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:
Issue description
I often do nixos-rebuild with wrong configuration. Malconfigured services (for example, nginx) output errors on system activation. Here is excerpt from one of my
nixops deploy
:The problem is, I don't get the root cause in this output, but lots of duplication. Here is my transcript of above message:
Would be much greater if I got the root cause in this output:
This isn't specific to nginx, I've seen this to many other services (for example, for containers).
Here are two issues: 1) too many duplicated "failed!" logs outputed 2)
stderr
isn't redirected aserr
priority to journaldPS. I have a fix for 2), but it requires lots of polishing
Steps to reproduce
Technical details
nixos 16.09