Post-installation tweaks for Debian stretch

This post gives a few tweaks I like to apply to a freshly installed Debian system. There is now an updated post for Debian bullseye.

CPU microcode

It is important for modern CPUs to install the microcode. This can be easily done by installing the intel-microcode or amd-microcode packages, which are in the non-free repository. Add the contrib and non-free repositories to the /etc/apt/sources.list and install the microcode package. After the next boot you should see a log message at the beginning of your dmesg log:

microcode: microcode updated early to revision 0xba, date = 2017-04-09

Hard disk optimisations

Linux file systems record the last access time for all read operations to file. This means that read operations of files are generally followed by a write operation on the inode of that file. Disabling the atime option can significantly speed up a hard disk throughput, and is a good thing to do for the vast majority of systems on all partitions. Add the noatime option to the fourth field in /etc/fstab.

Consider mounting the /tmp directory as a RAM file system. Temporary files are then kept in memory and not written to hard disk. This is a good idea if you have plenty of memory spare. But remember that files will be deleted after a reboot! To enable the RAM file system enable the tmp.mount service:

cp /usr/share/systemd/tmp.mount /etc/systemd/system/
sudo systemctl enable tmp.mount

If you are using a SSD, consider enabling FS trimming to let the hard disk reclaim unused blocks:

cp /usr/share/doc/util-linux/examples/fstrim.{service,timer} /etc/systemd/system
systemctl enable fstrim.timer

Finally reduce the number of swap operations by reducing the vm.swappiness parameter:

echo vm.swappiness=1 >> /etc/sysctl.d/80-local.conf

Persistent logging

To enable persistent logging, create /var/log/journal:

mkdir /var/log/journal
systemd-tmpfiles --create --prefix /var/log/journal
systemctl restart systemd-journald

Flat Volumes

If your audio volume settings seem to jump to max whenever a sound is being played, then the flat volumes setting in Pulseaudio might be the culprit. This user experience improvement was copied from Windows Vista and can be disabled by setting flat-volumes = no in /etc/pulse/daemon.conf.

Disable PC speaker

When working on the console the PC beeper can be quite a nuisance. The bell can be disabled in programs like Bash, vim, less etc., but this is tedious. A simpler way is to disable the beeper altogether by blacklisting the pcspkr module:

echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf