Configuring the console

From Elvanör's Technical Wiki
Jump to navigation Jump to search

Framebuffer driver

  • Support for HD resolution virtual consoles is achieved on Linux via framebuffer drivers.
  • On modern (2025) systems, the standard framebuffer driver is the EFI one (it requires the system to be booted into UEFI mode, which should be the case). Configure it according to the corresponding instructions below.
  • Historically, the "base driver" for the console was VGA (it seems to be built-in to the kernel and does not need any additional module compiled). It has a fixed resolution of 640x480, which is very low.
  • The nvidia binary proprietary drivers do not come with a framebuffer driver. You should use another driver, depending on the boot mode of the system.
    • If the machine is booted in UEFI mode: use the standard EFI framebuffer driver.
    • If the machine is booted in BIOS mode (deprecated): vesafb (and uvesafb) can normally be used. They can have some issues with the nvidia drivers, but they usually work fine (VESA is recommended over UVESA, as it is simpler and has less problems).
  • Another option is to use the DRM subsystem of the nvidia driver, with an emulation for a console (boot with nvidia-drm.modeset=1 and nvidia-drm.fbdev=1). I did not try it so cannot say if this works. Note that it will only load after the nvidia module was loaded, so I think the EFI driver is a better choice anyway.
  • In any case, never build the nvidiafb driver; it was intended for very old hardware.
  • Intel framebuffer drivers (for GPU integrated with the CPU) and AMD framebuffer drivers (open-source) are available and work well.

EFI Framebuffer

  • The following modules should be built into the kernel. Don't forget any one of those, or it won't work!
Device Drivers -> Character Devices
CONFIG_VT=y
CONFIG_TTY=y
CONFIG_VT_CONSOLE=y
Device Drivers -> Graphic Support -> Frame Buffer Devices -> Support for frame buffer device drivers
CONFIG_FB=y
CONFIG_FB_EFI=y
Device Drivers -> Graphic Support -> Console display driver support
CONFIG_FRAMEBUFFER_CONSOLE=y
  • After that, the EFI framebuffer should work automatically. To set the resolution of the console screen, you need to configure GRUB.

VESA Framebuffer (Deprecated)

  • You must compile it in the kernel, and then you should load it via a kernel argument (on GRUB boot command line), vga=. Example:
linux   /boot/kernel-4.4.43-vesa root=/dev/sda1 vga=0x031b ro
  • To obtain a correct mode, use hwinfo --framebuffer.
  • You can use the tool fbset (fbset -i) to check the current resolution and display information about the framebuffer configuration. Note that fbset does not work with the default, basic VGA console.

GRUB configuration

  • When using the EFI framebuffer driver, you need to configure GRUB to set the correct resolution. The framebuffer driver inherits this resolution and will use it, efifb does not set it on its own.
  • First boot into GRUB command line interface and issue the videoinfo command. Note down the available resolutions (actually, only the best one is needed).
  • Then the following instructions need to be added to /boot/grub/grub.cfg. Here we use a resolution of 3840x2160 (4K).
if loadfont $font ; then
  set gfxmode=3840x2160
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
load_video
set gfxpayload=keep
  • Note that I add those instructions directly to /boot/grub/grub.cfg. Normally, the correct way would be to edit /etc/default/grub and regenerate the actual GRUB configuration, but I don't like to proceed this way as it usually does not generate the file the way I want (does not add Windows boot entries, etc).

Mouse emulation

  • Support for mouse emulation on the console (which allows stuff like copy and paste) is done via the gpm package. It is a service daemon, so you need to start it via /etc/init.d/gpm start.
  • Unfortunately this does not work under VirtualBox (additions do not work on the console).