From Fedora Project Wiki


Use kmscon as default VT console

Summary

This change is to replace the kernel console fbcon with the userspace console kmscon in Fedora, to provide an enhanced and more secure console for Fedora users.

The long term goal is also to deprecate fbcon/fbdev emulation in the kernel, and this is the first step in this direction.

Owner

Current status

Detailed Description

fbcon is a terminal emulator in the kernel, which is not well maintained (it lost scrolling support a few years ago due to a CVE), and requires a fbdev emulation layer in the kernel, as all GPU drivers are using the newer drm interface. It still requires userspace executable like getty and bash to be useful.

kmscon is a simple terminal emulator based on linux kernel mode setting (KMS). It can replace fbcon for VT console, and provide better keyboard support, and better security.

This change will do the following: Install kmscon by default, and update the symbolic link /usr/lib/systemd/system/autovt@.service to point to kmsconvt@.service, to start kmscon by default when switching VT. kmscon should be the default also on non-graphical installation, as it doesn't require any graphic library (only libdrm, to access the framebuffer).

This change won't affect the installation, the boot process (like encryption password fallback), as fbcon will still be compiled in the kernel. User can still revert to fbcon if they want, or if kmscon has issue on their setup. If kmscon fails to launch, it will fallback to getty/fbcon.

Currently kmscon depends on opengl/mesa, because it has an optional opengl backend. But we don't want that on non-graphical server installation. I will split the package in two, having something like kmscon and kmscon-gl for the optional gl renderer.

Feedback

Benefit to Fedora

kmscon is more configurable, and has more features than fbcon:

  • Uses xkbcommon for keyboard layout, so it supports multiple layout, and switching between them with configurable shortcut.
  • Has better unicode support.
  • Can use pango for font rendering, and has better compatibility with double-width character https://github.com/Aetf/kmscon/pull/135.
  • Scrolling.
  • Better security, as it's a userspace program, compared to fbcon running in the kernel.
  • A crash in kmscon will make the systemd service to restart it. A crash in fbcon triggers a kernel panic.

By the time Fedora 44 is released, it may also have these additional features:

Scope

  • Proposal owners:
    • Add kmscon in default installation target.
    • Enable kmscon systemd service, for all tty, by changing the symbolic link /usr/lib/systemd/system/autovt@.service, to point to kmsconvt@.service
    • Split the kmscon package in 2, to avoid direct dependencies on egl.
  • Other developers:
  • Policies and guidelines: N/A (not needed for this Change)
  • Trademark approval: N/A (not needed for this Change)
  • Alignment with the Fedora Strategy:

Upgrade/compatibility impact

Early Testing (Optional)

Do you require 'QA Blueprint' support? Y/N

How To Test

kmscon is available in the Fedora repository, but if you want to test the latest version with mouse support, rotation support, and kmscon-launch-gui, then use this copr instead, it has builds for F41 to F44 rawhide:
sudo dnf copr enable jfalempe/kmscon
Install kmscon with:
sudo dnf install kmscon kmscon-pango
If you want to test the opengl version also install the gl plugins:
sudo dnf install kmscon-gl
then make it the default VT with:
sudo ln -s /usr/lib/systemd/system/kmsconvt@.service /etc/systemd/system/autovt@.service
You can edit the file /etc/kmscon/kmscon.conf, to customize kmscon. Then restart the service with:
sudo systemctl restart kmsconvt@tty3
Press Ctrl+alt+F3 to switch to the VT console. Login and check if it's running kmscon with ps aux | grep tty3.
You should see a kmscon process, like this:
bash root 52095 0.0 0.0 115180 16868 ? Ssl 17:37 0:00 /usr/libexec/kmscon/kmscon --vt=tty3 --seats=seat0 --no-switchvt --login -- /sbin/agetty -o -p -- \u --noclear -- -

Check that you can scroll back with page up/page down.
Check that you can increase the font size with "ctrl +" and decrease with "ctrl -" (only with the pango plugin)
Check that your terminal applications like top, nano, vi, ... work as expected.


User Experience

Improvements

  • The look & feel of the VT console, will be much better.
  • Users will be able to configure special fonts, and use more unicode characters.
  • Users will have the same keyboard layout has what they have in graphical environment. (Currently the kernel keyboard layout are different).
  • Users will be able to scroll in the console.

Caveats

  • Starting graphical application from the console (like "startx") won't work, but you can work around it by using the script kmscon-launch-gui startx

Dependencies

No dependencies.


Contingency Plan

  • Contingency mechanism: (What to do? Who will do it?) N/A (not a System Wide Change)
  • Contingency deadline: N/A (not a System Wide Change)
  • Blocks release? N/A (not a System Wide Change), Yes/No

It should be easy to revert, just not install kmscon, and fbcon with getty service will be the default.

Documentation

kmscon is a bit different than fbcon, so some applications will not work on it.

Keyboard/Font

Tools that configure the kernel font/keyboard layout won't work: setfont, loadkeys, ...
Instead you can configure the font/keyboard settings in /etc/kmscon/kmscon.conf, (by default kmscon will use the keyboard config from localectl)

Mouse

Tools that override tty to add mouse support won't work too: gpm, consolation
Mouse support is now built-in kmscon main git branch.

Graphics

Starting a graphic application from kmscon also won't work directly, you need to use the kmscon-launch-gui script. (so for things like startx or startplasma).

Configuration

You can configure kmscon to your taste, by editing the file /etc/kmscon/kmscon.conf
Execute man kmscon.conf to see all option available.

Release Notes