No color (VT driver)

I am trying to modify the colors of the kernel and terminal messages, with the options specified in the VT driver manual.

Code:
options TERMINAL_NORM_ATTR
options TERMINAL_KERN_ATTR

With the valid options of sys/terminal.h I compiled a new kernel with the VT options, to no avail.

Also with the loader.conf options, to no avail.

Code:
kern.vt.color.<colornum>.rgb="<colorspec>

I have verified that you are using VT, but by default it is the driver that FreeBSD uses since when using SC the terminal pad is red.

Any idea what may be going on? I already opened another thread with compatibility problems, I don't know if the problem may be there.
Dell latitude 6500
GPU: Intel GMA45
FreeBSD 13.0

Thanks.[/file]
 
Simple test: Log in on the console in text mode. Say "echo ESC [ 31 m Hallo ESC [ 32 m world ESC [ 0 m" in your favorite shell. In that string, typing the escape character requires some quote character (in my shell it's control-V, and escape is typed as control-[, opening square bracket), and there are no spaces between Escape, [ 31 and m. If you do this, you should see Hallo in green and world in red, or the other way round (I can never remember the ANSI codes).

If this works: Then the terminal driver itself is OK, and your other changes don't. If this doesn't even work, then I think you need to go down to the hardware level (screen interface like VGA or HDMI, GPU driver).
 
freejlr According to this thread it only works if you are using, quote, "i915kms, radeonkms, or efifb". I tried that in my VM and it only worked when I switched from legacy to the UEFI boot. VGA boot is not supported. Example of the same VM with different boots:
VM with UEFI, works as expected:
Code:
root@freebsd13:~ # dmesg | grep -i vt
VT(efifb): resolution 1024x768
root@freebsd13:~ #
VM with BIOS/legacy boot, doesn't' work:
Code:
root@freebsd13:~ # dmesg | grep -i vt
VT(vga): text 80x25
vtvga0: <VT VGA driver>
root@freebsd13:~ #
 
It doesn't work, I have tried it with vga and efifb. The text stays light white, and I compiled them to appear blue. I'm going to leave it alone, my Dell latitude 6500 is definitely not going to work well under FreeBSD.
I will start my degree shortly, I will leave it for that task, I will look for a compatible computer with FreeBSD, and it will not be a laptop.
I never had this type of problem, if with wifi devices, bluetooth I thought that being an old machine I would not have problems. But I understand that FreeBSD is not specifically intended for laptops.

Thanks.
 
Hi

I am performing the same operation on a lenovo thinkpad t430 with the same result. In legacy mode and in uefi.

With vga and efifb, I can't change the color if with VT or SC. I only managed to change the normal text color with SC_NORM_ATTR

The SC_KERNEL option is ignored and the color remains white. by default. With a VT nothing did not get any results.

Any ideas?

Regards.
 
Now I just used a later version of FreeBSD in this case 11 on my virtual machine. Everything worked without any problem. By determining the terminal and kernel colors with the vt options.

So what is the difference between FreeBSD 11 and 13 so that the options do not work well? As I said before.

options TERMINAL_NORM_ATTR
options TERMINAL_KERN_ATTR

Those two options are completely ignored in FreeBSD 13, but in 11 everything is ok.

I don't understand where the problem may be, any ideas?

Thanks guys.
 
Are you using vanilla kernel or did you compile your own? For my tests I used vanilla kernel, I only changed the colors in /boot/loader.conf.
 
I am using a custom kernel, well the GENERIC file only has those two options to change the color. But it gives the same problem with an unmodified kernel I already tried it with kernel.old

When I compile the kernel with those two lines, the color is the same. The only difference is that the color of the terminal letters "not the kernel letters" is the TERMINAL_NORM option.

They remain in light white color, without respecting the color that I established, as I said before with Freebsd 11 that does not happen, everything works well.

What you can see in the VT manual on Freebsd 11 and FreeBSD 13 is that in version 13 the color option is added.

I guess that is the one you mean by kern.color.x.rgb = "xxxxxx"

Does that make me think that there is a change in VT? And the TERMINAL_NORM and TERMINAL_KERNEL options are no longer functional? Right now I'm running FreeBSD 13 on a virtual machine, I installed the i915kms driver, and it's loaded as kldstat shows it.

But I suppose that being in a virtual machine the driver is not effective, I added the lines kern.color.x.rgb = "xxxxxx" as they are in the link that you provided in loader.conf but without any result.

(You say that in the VM in Legacy mode it is not supported, but in theory in Legacy mode in an installation on the machine's disk it would have to work right?)

How would the kernel and terminal color change then? I'm quite frustrated that with version 11 I don't have any problems and with version 13 I do.

I don't understand the <"colorspec"> of kern.color, how it's supposed to be set.

Thanks.
 
Simple test: Log in on the console in text mode. Say "echo ESC [ 31 m Hallo ESC [ 32 m world ESC [ 0 m" in your favorite shell. In that string, typing the escape character requires some quote character (in my shell it's control-V, and escape is typed as control-[, opening square bracket), and there are no spaces between Escape, [ 31 and m. If you do this, you should see Hallo in green and world in red, or the other way round (I can never remember the ANSI codes).

If this works: Then the terminal driver itself is OK, and your other changes don't. If this doesn't even work, then I think you need to go down to the hardware level (screen interface like VGA or HDMI, GPU driver).
Nice trick -- echo needs the -e option to display plain text escape sequences now-- I'm not sure why, especially since the -e option isn't documented in echo(1).
Furthermore, this command: echo -e '\033[31mHello \033[32mWorld!\033[0m' works if /bin/sh is my shell, but not if /bin/csh is my shell. This is because sh implements echo with the external command /bin/echo, but csh implements echo as a builtin command. builtin(1)

Screenshot at 2021-10-02 16-18-23.png


To output in color as root, I can still use: /bin/sh -c "echo -e '\033[31mHello \033[32mWorld!\033[0m'"

Edited to add:
Rather than using hard-coded escape sequences, the preferred method nowadays is to use tput terminal control sequences. In FreeBSD, tput AF [0-255] changes the foreground color, and tput AB [0-255] changes the background color. In Linux, substitute "setaf" for "AF" and "setab" for "AB" -- this is because, by default, FreeBSD uses termcap terminal capability codes, whereas Linux uses terminfo capcodes. Furthermore, note that installing ncurses or other programs may change the terminal capability database used by the tput command. On the more positive side however, the tput method should work regardless of shell or echo program versions.

TERM must be set to "xterm-256color" to use a fuller range of 256 ANSI colors. "xterm" (and most other terminal types) will only use the first 8-16 colors. For non-ANSI terminals which only support 8-16 colors, it might be necessary to use the alternate capcodes Sf and Sb to set foreground and background colors (or, for terminfo, setf and setb).

Screenshot at 2021-10-02 17-15-34.png


Edited again to add: Instead of echo -e '\033[31mHello \033[32mWorld!\033[0m' you can also use this newer syntax, with a $ prefix before the single quote:
echo '$\033[31mHello \033[32mWorld!\033[0m' -- I believe this should work in more recent versions of FreeBSD regardless of shell or echo implementations.
 
If tput works fine, but I would like to be able to specify the options in the kernel, so that these are executed as soon as you start.

Since if you used tput I suppose you would have to wait for at least rc to run. (I'm a noob)

But what I do not understand, and it has practically been turned into my question, is why those options of the VT and SC drivers do not work correctly. Yes in FreeBSD11 but not in version 13. Ok, let's imagine that in the VT driver in version 13 the colors are managed with kern.color.x.rgb

But what about SC? With the options:

options SC_NORM_ATTR=(FG_LIGHTRED|BG_BLACK)
options SC_KERNEL_CONS_ATTR=(FG_LIGHTRED|BG_BLACK)

The results are wrong, and it is SC not VT:

SC Boot color

As you can see from the link photo, only the text color changed.

The kernel did not have any effect, why that error? With the VT configuration it does not respect the color of the terminal text.

The text turns light white. Why all these errors, sorry if I seem repetitive but I would like to solve this question. And I do not know what to do anymore .

Regards.
 
I am trying to modify the colors of the kernel and terminal messages, with the options specified in the VT driver manual.

Code:
options TERMINAL_NORM_ATTR
options TERMINAL_KERN_ATTR
Those options used to work up to FreeBSD 12.x, unfortunately despite still being documented, as of FreeBSD 13 they do not. There are some loader tunables available, but you will find they do not quite accomplish the thing you want:
Code:
teken.fg_color
teken.bg_color
Setting these will not only change the color of kernel messages, but the entire console.
 
mickey

I did not know that directive in loader.conf, and in /boot/defaults/loader.conf it does not appear either.

All those changes that appear in RELEASE NOTES? The truth is, I didn't know what to do anymore, and the VT manual shows the options and does not mention the teken directive.

How did you know all this? If now that I know about teken I could find a thread about it where you participated.

https://forums.freebsd.org/threads/from-12-2-to-13.79837/page-2

Thanks guys.
 
I came across this: Is There a New Loader in FreeBSD 13.0?

Given that these kernel options (TERMINAL_NORM_ATTR & TERMINAL_KERN_ATTR) do not seem to work (anymore) as advertised in vt(4), there doesn't seem to be a PR of it, at least I can't find it. Was it ever confirmed, reported or taken up as such by FreeBSD?

(I am on REL-12.2 and do not compile kernels).
 
Technically it should be possible to do this on legacy boot too -- if the driver supports it. I didn't go through the code, I'm assuming what was written in the thread I shared. Again though, this does work out of the box in the VM in EFI boot. The only thing I did was modify /boot/loader.conf and added kern.vt.color.0.rgb="#aabbee".
The echo escape sequences have nothing to do with what you are trying to achieve.
 
I did not know that directive in loader.conf, and in /boot/defaults/loader.conf it does not appear either.
Nope, I even grep'd through all the manpages in /usr/share/man and did not find anything related to those teken options, but it's clearly in the source code.

All those changes that appear in RELEASE NOTES? The truth is, I didn't know what to do anymore, and the VT manual shows the options and does not mention the teken directive.

How did you know all this?
The fact that my kernels now display in boring white/grey colors showed up pretty quickly when updating from 12.2 to 13.0, as I had used custom colors using the VT_* and SC_* options before that for decades. So I started digging to see why that is, but all I found was that message from january on one of the mailing lists.

If now that I know about teken I could find a thread about it where you participated.

https://forums.freebsd.org/threads/from-12-2-to-13.79837/page-2
That thread pretty much sums it up. I was hoping the teken.[bf]g_color options could be used to achieve the same thing, but as it turned out they work quite differently. If you set teken.fg_color for example you get blue text everywhere from boot to all your virtual terminals, which is most likely not what you want. It's a shame the old options dont work anymore and quite frankly I dont give a damn about consistency, non-configurability is rarely a good choice.
 
Another question, but I think this is not directly related to the problem.

I know that vidcontrol is not 100% compatible with vt according to I read in the newcons paper.

But putting the teken directives in loader.conf, and run:

vidcontrol show

it makes my terminal color become ANSI, it only affects the terminal where the command is executed.

Any idea what is happening?

I know it is possibly an incompatibility problem.

I was looking at vidcontrol for the sources, which from what it seems if it is compatible with vt.

Thanks.
 
Back
Top