Skip to content

Instantly share code, notes, and snippets.

@mariosal
Last active October 21, 2023 01:40
Show Gist options
  • Save mariosal/825cf964e1f0d49061bac563ae393cb5 to your computer and use it in GitHub Desktop.
Save mariosal/825cf964e1f0d49061bac563ae393cb5 to your computer and use it in GitHub Desktop.
Debian Buster Tips 'n' Tricks

APT Sources

Use HTTPS

In order to use HTTPS source, you first need to install the following package:

sudo apt install apt-transport-https

Use fast CDN mirror

Debian provies deb.debian.org which automatically selects the closest mirror. More info: https://deb.debian.org/

Your /etc/apt/sources.list file should look like this:

deb https://deb.debian.org/debian/ buster main contrib non-free
deb-src https://deb.debian.org/debian/ buster main contrib non-free

deb https://deb.debian.org/debian/ buster-updates main contrib non-free
deb-src https://deb.debian.org/debian/ buster-updates main contrib non-free

deb https://deb.debian.org/debian-security buster/updates main contrib non-free
deb-src https://deb.debian.org/debian-security buster/updates main contrib non-free

Editorconfig

Editorconfig is a file that can be placed in the filesystem, which is read by many editors either automatically, or by using a plugin.

You can add this file in the root directory. Edit /.editorconfig:

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 80

Firmware

First, make sure you have enabled the non-free repositories in APT Sources. Then you can install all firmware (free & non-free), such as the Intel Microcode, using:

sudo apt install firmware-linux

Fonts

Antialias, Subpixel Rendering

You need to configure the following:

  • Hinting and set it to Slight. You want hinting so that the fonts are aligned with the display's pixels, but only to the bare minimum because it changes the way fonts are displayed.
  • Antialias and set it to Grayscale. Nobody wants rainbow-ish colours around their letters anyway...
  • Disable Autohinter. Instead, use the native hinting information of the font.

Fontconfig

Run:

sudo dpkg-reconfigure fontconfig-config

Select:

  1. Native
  2. Slight
  3. Never (Disables RGBA)
  4. No (Default)

X applications not respecting Fontconfig (e.g. Firefox)

Add the following to /etc/X11/Xresources/x11-common:

Xft.antialias: 1
Xft.hinting: 1
Xft.hintstyle: hintslight
Xft.autohint: 0
Xft.rgba: none

LightDM

LightDM doesn't read either Xresources, nor Fontconfig... Add the following to /etc/lightdm/lightdm-gtk-greeter.conf:

xft-antialias=true
xft-hintstyle=slight
xft-rgba=none

Read Clear Font cache

Color Emoji

sudo apt install fonts-noto-color-emoji

Read Clear Font cache

Microsoft Fonts

Skroutz uses Microsoft Fonts, such as Verdana, Arial. Thus you need to install them to render the website correctly.

sudo apt install ttf-mscorefonts-installer

Read Clear Font cache

Clear Font cache

sudo sh -c 'fc-cache -f && dpkg-reconfigure fontconfig'
fc-cache -f
rm -rf ~/.cache/fontconfig

Graphics

Debian suggests using the built-in modesetting driver, instead of the xserver-xorg-video-intel .

Just remove it:

sudo apt purge xserver-xorg-video-intel

Hardware Video Acceleration

Applications use two kinds of video acceleration, VAAPI (new) and VDPAU (old).

VAAPI

Debian installs the i965-va-driver by default, however, which is the old Intel driver. You can install the new one called iHD:

sudo apt install intel-media-va-driver-non-free

Add the following to /etc/environment:

LIBVA_DRIVER_NAME=iHD

If you are using GStreamer, install the VAAPI package and disable driver whitelist, because it only accepts the old driver.

sudo apt install gstreamer1.0-vaapi

Add the following to /etc/environment:

GST_VAAPI_ALL_DRIVERS=1

VDPAU

VDPAU is still used by Firefox, Flash, Thunderbird and other apps, but it is not configured. What you can do is just forward VDPAU to VAAPI.

sudo apt install libvdpau-va-gl1

Add the following to /etc/environment:

VDPAU_DRIVER=va_gl

Check if it works

sudo apt install vainfo vdpauinfo

It should look like this:

$ vainfo
libva info: VA-API version 1.4.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'iHD'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_4
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.4 (libva 2.4.0)
vainfo: Driver version: Intel iHD driver - 1.0.0
$ vdpauinfo
display: :0   screen: 0
libva info: VA-API version 1.4.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'iHD'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_4
libva info: va_openDriver() returns 0
API version: 1
Information string: OpenGL/VAAPI backend for VDPAU

i3wm

Exec --no-startup-id

The applications in the default configuration don't actually use startup id, thus it is unnecessary to wait for it.

~/.config/i3/config:

  1. Replace all exec with $execi
  2. Define $execi on top: set $execi exec --no-startup-id

Audio

If you are using i3blocks, keep the && pkill part. Otherwise, just use the rest of the command. -RTMIN+10 number should match the signal in volume (/etc/i3blocks.conf)

bindsym XF86AudioRaiseVolume $execi amixer -q -D pulse sset Master 5%+ unmute && pkill -RTMIN+10 i3blocks
bindsym XF86AudioLowerVolume $execi amixer -q -D pulse sset Master 5%- unmute && pkill -RTMIN+10 i3blocks
bindsym XF86AudioMute $execi amixer -q -D pulse sset Master toggle && pkill -RTMIN+10 i3blocks
bindsym XF86AudioMicMute $execi amixer -q -D pulse sset Capture toggle

Brightness

sudo apt install brightnessctl

Reboot and add the following in ~/.config/i3/config:

bindsym XF86MonBrightnessDown $execi brightnessctl set 5%-
bindsym XF86MonBrightnessUp $execi brightnessctl set +5%

Player

sudo apt install playerctl

Add the following in ~/.config/i3/config:

bindsym XF86AudioPlay $execi playerctl play-pause
bindsym XF86AudioNext $execi playerctl next
bindsym XF86AudioPrev $execi playerctl previous

Compton (VSync)

Compton is probably not needed. Check if you experience any tearing first, before using it.

To avoid tearing you can use Compton:

sudo apt install compton

And create a file called ~/.config/compton.conf with the contents of Picom (Compton fork) provided by Arch Linux: https://github.com/yshui/picom/blob/next/picom.sample.conf

Then, change the backend option from xrender to glx to use the OpenGL backend.

Gnome Keyring

You can save your SSH key passphrase in Gnome Keyring and have unlock automatically when logging in.

sudo apt install gnome-keyring

Add the following in your shell config file, e.g. ~/.zshrc:

if [ -n "$DESKTOP_SESSION" ];then
  eval $(gnome-keyring-daemon --start)
  export SSH_AUTH_SOCK
fi

Locale

If you are using en_US.UTF-8, but you would like to use the metric system, Monday as the start of the week and A4 as the paper size, you can do the following:

Run the following command and select en_GB.UTF-8 and en_US.UTF-8 (should be already selected)

sudo dpkg-reconfigure locales

Then edit the /etc/default/locale and add the following:

#  File generated by update-locale
LANG="en_US.UTF-8"
LANGUAGE="en_US:en"
LC_TIME="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"

MariaDB

In order to force a UTF-8 connection you can edit /etc/mysql/mariadb.cnf and add the following after [client-server]:

[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_520_ci

Node

Enable Emoji

First, follow the instructions in the Color Emoji section above. Then add the following to~/.yarnrc:

"--emoji" true

Run Yarn in parallel

Get the output of nproc, e.g. 4, and then add the following to~/.yarnrc:

child-concurrency 4

PulseAudio

Disable Flat Volume

Flat volume is the most annoying feature of PulseAudio. An application, such as Viber, can increase set its volume to 100% and decrease all other applications. Thus, there are cases where the other applications stay at less than 100% volume and you need to manually increase them to 100% again...

Uncomment flat-volumes and set it to false in /etc/pulse/daemon.conf:

flat-volumes = no

Change the volume immediately

You can uncomment enable-deferred-volume and set it to false in/etc/pulse/daemon.conf if you want the volume change to happen immediately instead of being deferred:

enable-deferred-volume = no

Ruby

Avoid installing Documentation

Add the following to /etc/environment:

RUBY_CONFIGURE_OPTS=--disable-install-doc

And to ~/.gemrc:

gem: --no-document

Run Bundle in parallel

You can use nproc to get the number of available threads and pass it to bundle config.

bundle config --global jobs $(nproc)

Systemd

To kill user processes when logging out, add to following to /etc/systemd/logind.conf:

KillUserProcesses=yes

This matches the upstream configuration of Systemd.

Tuned

RedHat recently released tuned which helps you tune your computer based on some predefined profiles.

sudo apt install tuned

Reboot and then run:

sudo tuned-adm profile throughput-performance

You can check throughput-performance here: https://github.com/redhat-performance/tuned/blob/master/profiles/throughput-performance/tuned.conf

UEFI BIOS updates

You can use fwupdmgr to update to the latest UEFI firmware and many more!

sudo apt install fwupd fwupdate

And run:

sudo sh -c 'fwupdmgr refresh && fwupdmgr update'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment