[systemd-devel] Unbuffered stderr for my systemd service?

Mantas Mikulėnas grawity at gmail.com
Mon Jul 15 09:55:58 PDT 2013

On Mon, Jul 15, 2013 at 5:32 PM, Vivek Goyal <vgoyal at redhat.com> wrote:
> This is important functionality for us. makeudmpfile utility (utility which
> filters kernel crash dump and shows the progress bar), run in kdump
> kernel. For large machines it displays the progress bar in kernel. Right
> now all the code runs from initramfs in the context of a service and
> we don't get progress messages. Just we get a 100% message at the end.
> Right now we bypassed journal by sending everything to /dev/console but
> it is a generic question that any serivce displaying some kind of
> progress bar, how is it handled with current journal mechanism.

The journal works the same way as syslog has worked for ages – have
you ever seen an animated progress bar in your /var/log/syslog? I'd
guess no, because syslog wouldn't accept it, and most services do not
display those in the first place – they either write periodic *full*
messages (e.g. every 10%) to the log, or have a way to check progress
via their own fooservicectl tools. systemd also provides a way to
display arbitrary text in `systemctl status` using the "notify"
feature; see systemd-notify(1) and sd_notify(3).

The only exception I can think of is the boot fsck service
(systemd-fsck at .service), which needs to run before `systemctl` or the
syslog become accessible. And it uses /dev/console for this:

        console = fopen("/dev/console", "w");
        while (!feof(f)) {
                p = percent(pass, cur, max);
                fprintf(console, "\r%s: fsck %3.1f%% complete...\r%n",
device, p, &m);

Mantas Mikulėnas <grawity at gmail.com>

More information about the systemd-devel mailing list