Linux daemon errors and corrupt device files

Recently my tmux installation broke and kept exiting with a message server exited unexpectedly. I tried to install several different versions, from 3.1b all the way down to 2.7, but all of them failed the same way. Reading the error log, I discorvered the following suspicious line:


1600341056.922267 fatal: daemon failed: No such device

After reading this, I decided to try and verify the devices in /dev:

find /dev | xargs file | grep -v special | less

It appears that /dev/null had somehow become a regular empty file. In order to fix it, remove it and recreate it using mknod:

rm -f /dev/null
mknod /dev/null c 1 3
chmod 777 /dev/null