systemctl can't always assume the PAGER supports handling and passthrough of ANSI escape sequences (e.g. for color and bold). For example, busybox less treats ESC as an unprintable character and escapes it.
Hi, we set the less options to LESS=FRSXMK. Special less'es which don't support those options are not something that is very common, so fixing this is definitely not high priority. In general systems supports color-less output, and extending this to systemctl shouldn't be too hard, it should be enough to add --no-color option, defaulting to !on_tty(), and use this new variable to determine whether color is enabled. We'd be happy to apply a patch, but at least I'm not going to work on this.
http://cgit.freedesktop.org/systemd/systemd/commit/?id=3001c745 is related.
http://man7.org/linux/man-pages/man5/terminal-colors.d.5.html is probably the way to do this.
terminal-colors.d/ really appears a bit over-the-top. I am really not convinced that that would be a good idea. We can add $SYSTEMD_COLOR=0 or so, but that's really all...
*** Bug 90464 has been marked as a duplicate of this bug. ***
There are thousands of embedded systems out there that use busybox and are now transitioning to systemd. The output from systemctl is nearly unreadable. The busybox 'less' command doesn't support the -R switch. Please, do things properly. Colors should be always be opt-in. If everyone did things the right way then we wouldn't have all these problems. For reference: https://bugs.busybox.net/show_bug.cgi?id=5546
This exists in systemd git now. Simply set the SYSTEMD_COLORS=0 env var.
Thank you for fixing this, but I do have a problem with the solution. Today, I finally got fed up with systemctl saying "WARNING: terminal is not fully functional" even though I already know that, having set $TERM to "dumb" in my rc file. One could argue that error is the fault of less, but systemctl/etc. also should respect $TERM, And, while it is handling the case of no color, it shouldn't call less unless $PAGER or $SYSTEMD_PAGER is set explicitly. It is unreasonable for users to have to discover and to configure Yet Another Environment Variable[1] when $TERM is set correctly to dumb, which has been a de facto standard on Unix since 1978. In my particular case, I use Emacs shells (not terminals) for system interactions. There are, of course, plenty of other reasons programs should respect $TERM. The primary one being: It's correct. :) [1] http://www.joelonsoftware.com/uibook/chapters/fog0000000059.html
systemd doesn't print "WARNING: terminal is not fully functional". Maybe your pager does that? less?
But yeah, it might make sense to skip invoking a pager if TERM is not set or set to "dumb".
The TERM=dumb check has been added now. https://github.com/systemd/systemd/pull/3392
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.