Terminal log messages color, not console

I have just the console, I get messages logged to the screen. I was able to change the terminal text color output to yellow. But then the log messages pop up still in default white color. How can I change ALL text colors seen on console screen to some color?

This is really important. The reason I need all of text to be yellow is because the screen is on all the time, and at night it needs to be yellow (not blue or white) in order to not to disrupt people's circadian clocks. This is basically a circadian clock emergency for humanity.
 
Please tell us what you tried. If I set the foreground color with​
Bash:
vidcontrol green # invoked from the configured device as reported by conscontrol(8)
and trigger some log message, it seems to work.

Another method: If you use an external monitor its firmware usually offers a “color calibration” via the HUD menu so just kill the blue channel; but I suppose you want to change the foreground color based on time, so this method is really inconvenient.
 
Please tell us what you tried. If I set the foreground color with​
Bash:
vidcontrol green # invoked from the configured device as reported by conscontrol(8)
and trigger some log message, it seems to work.

Another method: If you use an external monitor its firmware usually offers a “color calibration” via the HUD menu so just kill the blue channel; but I suppose you want to change the foreground color based on time, so this method is really inconvenient.
That's what I did.
Bash:
vidcontrol yellow black
But the log messages are white.

Oh, maybe I need to do it from the root account?

This is not an external monitor, using an in-built one.
 
I don't know how to do it directly, by changing the configuration of the virtual terminal.

But there is another way to get there: By default, FreeBSD is configured so certain classes of log messages (see syslog) automatically get printed to the console. For that configuration, see /etc/syslog.conf, and read man syslog.conf. What you could do is edit syslog.conf, and disable anything going directly to the console: no more white messages.

But you probably want to actually see these messages, just in a color of your choice. So what you do is to write a little program (can be a shell script, can be in an interpreted language like perl or python, or can be in a compiled language) that receives messages from syslog and then prints them, and colorizes them the way you like. To start with, look in man syslog.conf for how the output of certain messages can be sent to programs, with the pipe operator.
 
[…] Or would something need to be changed in the kernel?
Right, so ralphbsz’s post reminded me there are syslog(3) messages (which I tested when writing my prior post) and kernel messages (which I did not test). Now I confirm your observation: Changing the text color with vidcontrol(1) has no effect on kernel messages.

Indeed, vt(4) explains there is a build option TERMINAL_KERN_ATTR. Apparently you cannot redefine the default color for kernel messages on the fly, so you guessed it right, something needs to be changed in the kernel.

A quick’n’dirty workaround is to re‑define the color definitions in /boot/loader.conf but in the long term this just creates confusion:​
Bash:
# “white”
kern.vt.color.7.rgb="223,223,0"
# bright “white” [← default choice for kernel messages]
kern.vt.color.15.rgb="255,255,0"
[…] disable […]
Apropos disabling, one could of course just disable the display of kernel messages. Maybe this is ultimately the “best” solution.​
Bash:
conscontrol mute on
 
I was able to change the terminal text color output to yellow. But then the log messages pop up still in default white color. How can I change ALL text colors seen on console screen to some color?
How to colorize the text in system console and virtual consoles depends on your platforms firmware. BIOS - VT(vga), or UEFI framebuffer - VT(efifb).
Code:
 # sysctl machdep.bootmethod

 # dmesg | grep 'VT('
There was also a VESA BIOS Extension (VBE) framebuffer support - VT(vbefb), but this was removed from 14.2 and upwards (including stable/13). It can be enabled again, reverting the changes, see https://forums.freebsd.org/threads/freebsd-14-2-bootsplash-gone.96142/post-684017 .

If UEFI (and VBE), setting in /boot/loader.conf (besides kern.vt.color.colornum.rgb) teken.fg_color="yellow" will colorize on all consoles the text yellow. Kernel messages in bright yellow, all other messages dark yellow.

teken.fg_color-01.png teken.fg_color-02.png

If BIOS, set in /etc/rc.conf allscreens_flags="yellow". This will colorize the text on all screens after /etc/rc.conf is read. Here with a login and NFS bad exports list log messages.

BIOS_allscreens_text_yellow.png

Note that BIOS doesn't support vt(4) color override:
Code:
     kern.vt.color.colornum.rgb
             ...
             Note: The vt VGA hardware driver does not support palette
             configuration.
 
How to colorize the text in system console and virtual consoles depends on your platforms firmware. BIOS - VT(vga), or UEFI framebuffer - VT(efifb).
Code:
 # sysctl machdep.bootmethod

 # dmesg | grep 'VT('
There was also a VESA BIOS Extension (VBE) framebuffer support - VT(vbefb), but this was removed from 14.2 and upwards (including stable/13). It can be enabled again, reverting the changes, see https://forums.freebsd.org/threads/freebsd-14-2-bootsplash-gone.96142/post-684017 .

If UEFI (and VBE), setting in /boot/loader.conf (besides kern.vt.color.colornum.rgb) teken.fg_color="yellow" will colorize on all consoles the text yellow. Kernel messages in bright yellow, all other messages dark yellow.

View attachment 21355 View attachment 21356

If BIOS, set in /etc/rc.conf allscreens_flags="yellow". This will colorize the text on all screens after /etc/rc.conf is read. Here with a login and NFS bad exports list log messages.

View attachment 21357

Note that BIOS doesn't support vt(4) color override:
Code:
     kern.vt.color.colornum.rgb
             ...
             Note: The vt VGA hardware driver does not support palette
             configuration.
Thanks, I'll try this.
 
If BIOS, set in /etc/rc.conf allscreens_flags="yellow". This will colorize the text on all screens after /etc/rc.conf is read. Here with a login and NFS bad exports list log messages.
This doesn't work. This is now officially a circadian rhythm apocalypse. The log messages still get printed in white color.
(I have BIOS).
Is this a kernel config issue?
 
Is the kernel GENERIC or a custom built?

So far, on a test 14.2-RELEASE (GENERIC kernel, BIOS firmware) VM, the message logs are colorized yellow when allscreens_flags="yellow" is set.
Ok, this is interesting then.
It's GENERIC kernel. It's 14.1. It's i386. It's bare metal, not VM.
Could 14.2 vs 14.1 version be the reason? Or maybe it's because you're on a VM?
 
Back
Top