Fixing locale: Cannot set LC_CTYPE to default locale: No such file or directory
If you encounter the following error:
locale: Cannot set LC_CTYPE to default locale: No such file or directory
You can fix this by invoking the following command on a Debian-based system:
sudo dpkg-reconfigure locales
This will then prompt you for a selection of locales and regenerate them.
Note
I have encountered this issue on a fresh installation of Raspberry Pi OS (Build 2021-01-11). But this command should also work for Debian-based operating systems (e.g. Ubuntu).