Modernizing the console with kmscon

Article Summary:

For decades, the Linux virtual console has relied on the kernel fbcon driver, to handle drawing the framebuffer, font management and keyboard layout handling.
Starting with Fedora 45, a userspace utility called kmscon is replacing it.
Depending on your usage of virtual console, this may impact your workflow.

Article Description:

If you’re not a developer or a system administrator, chances you probably never heard about fbcon or virtual terminal (VT), in this case you’re probably not impacted.
You can still read the rest if you’re curious about minimal text interfaces, and maybe you’ll start using it.

Why is kmscon replacing fbcon ?

The legacy fbcon driver runs directly in the kernel space, and has significant drawback:

  • Security: each bug in fbcon can be exploited in the kernel directly, and each crash is a kernel panic.
  • fbcon relies on the old fbdev interface, but all GPU drivers are now using drm, this means a fbdev emulation layer between drm driver and fbcon is required.
  • The keyboard layouts supported by the kernel are different that what userspace is using. That means with kmscon, you will have the same layout as in Gnome, Kde, or Sway, whereas with fbcon, you have slightly different layout, which can be a problem when writing password, or foreign languages. keyboard layout can be changed dynamically using localectl set-keymap.
  • fbcon only use bitmap font, which are looking small on HiDPI display, and you can’t resize them at runtime. They also don’t use antialiasing, and have limited unicode support. Kmscon can use freetype, to render any monospace font, and can be scaled at any size using Ctrl+, or Ctrl+<+>.
  • fbcon doesn’t support scrolling anymore, due to CVE. Kmscon does, with page up/down, or mouse wheel.
  • fbcon don’t have mouse support, it can be added with gpm, but is a bit clumsy. Kmscon uses transparent hardware cursor when available.

What this will change for users and administrators ?

  • Kmscon uses pseudo-tty (pts) device. So when you run tty it will return /dev/pts/0 instead of /dev/tty1, like when you use a graphic terminal. So some scripts or configuration that uses this information will need to be adapted.
  • Kmscon uses the exclusive drm interface to the GPU to draw the terminal, so if you want to run a graphic session or a program that wants to use the GPU, it won’t work like it used to with fbcon. The reason is that fbcon runs in the kernel and can let any userspace application take the GPU. Kmscon can’t do that, so you have to tell it to release the GPU. This is done with a script called kmscon-launch-gui. For example you can run kmscon-launch-gui kmscube -c 100 or kmscon-launch-gui startx to start a graphic session.
  • Kmscon will replace the default console in F45, for tty1-6. If you want to keep a tty to fbcon, just in case, you can run sudo systemctl mask kmsconvt@tty5 and sudo systemctl enable --now getty@tty5. Then pressing Ctrl+Alt+F5 will get you to you’re good old fbcon console.

How to configure kmscon the way you like

Kmscon uses /etc/kmscon/kmscon.conf for configuration.

[TODO]

Please report any bug to Issues · kmscon/kmscon · GitHub

I have read and understand the Ai-Assisted Contributions Policy


For Editor Use Only

Editor:

Image Editor:

Publication Date:

Preview Link:

+1. Thanks!

+1 from me.

The overall Magazine work flow is described at this link as well as other helpful information.

This site might contain some items of interest

The articles are published using the WordPress Engine instance for the Fedora Magazine.

From the menu in the left column of that page, select
*Posts>Add Post
to open the new article to edit and start writing.

When you have your article ready to review in the Fedora Magazine WordPress site, please leave a comment in this topic, with a preview link, and we will start the review process.

The editors use comments on this topic to communicate and we’re always happy to help, should it be needed.

Thanks for volunteering to write for the Fedora Magazine!