Living with Systemd

Arthur Dent misc.lists at blueyonder.co.uk
Wed Aug 3 13:23:13 UTC 2011


On Wed, 2011-08-03 at 02:46 -0700, T.C. Hollingsworth wrote:
> On 7/22/11, Arthur Dent <misc.lists at blueyonder.co.uk> wrote:
> > I was really hoping that someone would reply saying something like "You
> > idiot! - Don't you know, all you need to do is to use the
> > --tellmewhatswrong switch with systemctl and all will be revealed!" But
> > alas, no-one has said anything...
> 
> Not quite as easy as that, but here's what you can do:
> 
> Edit /etc/systemd/system.conf and set "DefaultStandardOutput" to one
> of "syslog", "kmsg", "kmsg+console", or "syslog+console".  That will
> redirect stdout from it's default destination of /dev/null to the
> place you set.  You may set "DefaultStandardError" too if you wish,
> but by default it goes to the same place as DefaultStandardOutput.
> (Note that you can also do this per-service by editing it's unit file
> [see "man systemd.exec" for details] or at boot-time via the kernel
> argument "systemd.default_standard_output".)
> 
> Then, just run systemctl daemon-reexec (in the case of editing
> system.conf) to make your change take effect, start the service, and
> check the output where you told it to send it along to.

Wow! really useful advice! Thank You. 
As Hiisi says - Tip of the Day and I also agree that syslog+console
should be the default.

However, I just tried this by causing a deliberate error in a
Mod_Security configuration and attempting to restart HTTPD using
systemctl restart httpd.service.

I still only got:
"Job failed. See system logs and 'systemctl status' for details."
at the command line. However, at least now in /var/log/messages I do get
this:

Aug  3 14:06:53 mydomain httpd[1977]: /etc/rc.d/init.d/functions: line 58: /dev/stderr: No such device or address
Aug  3 14:06:57 mydomain httpd[1977]: Stopping httpd: #033[60G[#033[0;32m  OK  #033[0;39m]
Aug  3 14:06:57 mydomain httpd[1988]: /etc/rc.d/init.d/functions: line 58: /dev/stderr: No such device or address
Aug  3 14:06:59 mydomain httpd[1988]: Starting httpd: #033[60G[#033[0;32m  OK  #033[0;39m]
Aug  3 14:10:37 mydomain httpd[2035]: /etc/rc.d/init.d/functions: line 58: /dev/stderr: No such device or address
Aug  3 14:10:38 mydomain httpd[2035]: Stopping httpd: #033[60G[#033[0;32m  OK  #033[0;39m]
Aug  3 14:10:38 mydomain httpd[2043]: /etc/rc.d/init.d/functions: line 58: /dev/stderr: No such device or address
Aug  3 14:10:38 mydomain httpd[2043]: Starting httpd: Syntax error on line 91 of /etc/httpd/modsecurity.d/base_rules/modsecurity_crs_20_protocol_violations.conf:
Aug  3 14:10:38 mydomain httpd[2043]: Error creating rule: Unknown variable: REQBODY_ERROR
Aug  3 14:10:38 mydomain httpd[2043]: #033[60G[#033[0;31mFAILED#033[0;39m]
Aug  3 14:10:38 mydomain systemd[1]: httpd.service: control process exited, code=exited status=1
Aug  3 14:10:38 mydomain systemd[1]: Unit httpd.service entered failed state.

Which tells me exactly what I want to know.
Thank You.

I presume that the reason I got no output to the console was because of
the problem with /etc/rc.d/init.d/functions. Lines 56-62 say:

if [ -z "${CONSOLETYPE:-}" ]; then
  if [ -r "/dev/stderr" ]; then
    CONSOLETYPE="$(/sbin/consoletype < /dev/stderr)"
  else
    CONSOLETYPE="$(/sbin/consoletype)"
  fi
fi

How can I fix this?

(Although I am a much happier bunny already!)

Thanks again

Mark



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20110803/a57c24a2/attachment.bin 


More information about the users mailing list