1

As dhcpd negotiates it prints its output on the login prompt, which clutters (messes up, wrangles, uglifies, writes over, obscures [synonyms for googlers]) the console login prompt. How to inhibit dhcpd from outputting over the console login prompt?

Running Void Linux with runit, /etc/sv/dhcpd/run looks like this:

#!/bin/sh
[ -r conf ] && . ./conf
exec dhcpcd -B ${OPTS:=-M} 1>&2

/etc/sv/dhcpd/conf is empty.

2 Answers2

2

I'm not sure why your dhcpcd isn't using syslog, as that's the default behavior of the utility (maybe Void Linux is using a special version). Anyway the output is going to the console because that's where the init manager sends its output, and unless redirected, applications started by the init manager inherit STDOUT & STDERR. Meaning the fix is to simply redirect the output.
Assuming you have a syslog daemon running on your system, I personally would change that script to something like:

#!/bin/bash
[ -r conf ] && . ./conf
exec dhcpcd -B ${OPTS:=-M} > >(exec logger -t dhcpd -p daemon.info) 2> >(exec logger -t dhcpd -p daemon.err)

This will send STDOUT output to syslog with the info level, and STDERR output to syslog with the err level.

phemmer
  • 70,657
  • 19
  • 188
  • 223
  • This answer has missed the part of the question where the questioner points out that xe is using runit. This is an entirely wrongheaded way of doing this when using runit, and the statements about a purported "init manager" and its behaviour are just plain wrong for a runit system. – JdeBP Jun 29 '16 at 07:38
  • @JdeBP Welcome to unix.stackexchange.com, if you think you have a better answer to the question, you're more than welcome to post it as a new answer. Also, linux has numerous different init systems, including ones like sysvinit, systemd, upstart, and in this case runit. An init manager is the process which is responsible for starting system level services. – phemmer Jun 29 '16 at 12:27
0

Duncaen on #voidlinux at freenode gave me this link. Apparently this chaotic outputting comes from dmesg, not dhcpcd. Solution is to add dmesg -n 1 to /etc/rc.local.