[Bug 230757] [syscons] random wrong color for kernel messages

Koro koro at kzxiv.net
Tue Sep 11 03:12:07 UTC 2018


> In FreeBSD-11:
> - for boot messages, configure SC_KERNEL_CONS_ATTR to anything except its
>     default of FG_WHITE (0xf).
> - after booting, use the hw.syscons.kattr sysctl to change the array of
>     MAXCPU kernel attributes to whatever you want (all FG_WHITE to get the
>     old behaviour).  sysctl(8) doesn't handle arrays very well, so it takes
>     rarely-used options to even print the values in the array.

I tried doing this real quick, but it did not change a thing:

     #include <sys/types.h>
     #include <sys/sysctl.h>
     #include <string.h>
     #include <stdio.h>

     int main(int argc, char** argv)
     {
         char kattr[256];
         memset(kattr, 0x0f, 256);

         if (sysctlbyname("hw.syscons.kattr", NULL, 0, kattr, 256) == -1)
         {
             perror("sysctl");
             return 1;
         }

         return 0;
     }

It doesn't error out, but it does not change a thing, I still kept 
getting colored messages. Maybe I misunderstood your instructions? This 
is on 11.2-RELEASE by the way.

> But don't turn it off.  Try using better colors (don't use dark gray).
> Even I like colorized kernel messages, and I stopped using colorized ls
> 25 years ago.

It's not so bad with only dark gray (though it looks a bit broken), but 
once you add more CPUs, it starts looking like an xmas tree. I too, like 
my consoles to be gray and boring and disable colored ls.

And also, unless one actively works on the kernel, I fail to see the 
need to know from which CPU did a specific kernel message originate.

- Koro


More information about the freebsd-bugs mailing list