Skip to content

Instantly share code, notes, and snippets.

@daryltucker
Last active October 2, 2025 15:38
Show Gist options
  • Save daryltucker/d3d5f1e3a2959a56ab537629e8bec5af to your computer and use it in GitHub Desktop.
Save daryltucker/d3d5f1e3a2959a56ab537629e8bec5af to your computer and use it in GitHub Desktop.
kmscon with btop

kmscon w. btop

Create btopuser

sudo adduser --system --no-create-home --shell /usr/sbin/nologin btopuser
sudo addgroup --system procview
sudo usermod -a -G procview btopuser
sudo usermod -a -G video btopuser

Allow btopuser to view /proc

$ cat /etc/fstab | grep proc
proc                                            /proc           proc    defaults,hidepid=2,gid=1001        0       0

Configure kmscon Fonts

$ cat /usr/local/etc/kmscon/kmscon.conf
font-name=3270 Nerd Font Mono, DroidSansM Nerd Font Mono, Symbols Nerd Font
font-size=14

Create Wrapper to provide btop proper Environment

$ cat /usr/local/sbin/kmscon-btop
#!/bin/bash

export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
export XDG_CONFIG_HOME=/home/btopuser/

sudo -E -u btopuser bash -c 'exec /usr/bin/btop'

Edit [email protected] Service

# /etc/systemd/system/[email protected]/override.conf
sudo systemctl edit [email protected]
[Unit]
# Description=KMS System Console on %I
# Documentation=man:kmscon(1)
# After=systemd-user-sessions.service
# After=plymouth-quit-wait.service
# After=rc-local.service
# Before=getty.target
# Conflicts=getty@%i.service
# OnFailure=getty@%i.service
OnFailure=
# IgnoreOnIsolate=yes
# ConditionPathExists=/dev/tty0

[Service]
#User=btopuser
# Clear original ExecStart
ExecStart=
ExecStart=/usr/local/bin/kmscon --vt=%I --seats=current --session-max=2 --sb-size=0 --drm --hwaccel --login -- /usr/local/sbin/kmscon-btop
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
#Restart=on-failure
Restart=always
RuntimeMaxSec=300
RestartSec=0

[Install]
WantedBy=getty.target

Usage

sudo systemctl restart [email protected]
sudo systemctl enable [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment