This error occurs when apt-listchanges cannot find a valid locale configuration on your system. Your locale environment variables (LC_* and LANG) are either unset, invalid, or pointing to locales that haven't been generated.
The error means that apt-listchanges (a tool that displays changes for upgraded packages) tried to format output using your system's locale settings but failed. This happens because either no locales are generated on your system, the locale you're using doesn't exist, or your LANG and LC_* environment variables reference a non-existent locale. While the tools still function, the error prevents proper text formatting and makes the upgrade process uncomfortable.
First, see what locales are currently set and available:
locale
locale -aThe first command shows your current settings. The second lists all available (generated) locales. If LANG and LC_* variables reference locales not in the list from locale -a, that's your problem.
This is the recommended fix on Debian/Ubuntu. Run:
sudo dpkg-reconfigure localesA dialog will appear. Select at least one locale (en_US.UTF-8 is standard) by pressing SPACE to toggle it. Then press ENTER to confirm. In the next screen, select your preferred default locale. The system will generate the selected locales automatically.
If dpkg-reconfigure doesn't work, edit the locale generation file directly:
sudo nano /etc/locale.genUncomment (remove the #) from the locale you want (e.g., en_US.UTF-8 or C.UTF-8). Save the file, then run:
sudo locale-genThen set it as the default:
sudo update-locale LANG=en_US.UTF-8If you're seeing this error only over SSH, your SSH client may be forwarding unsupported locales. Check your SSH config:
grep -i sendenv ~/.ssh/configIf you see SendEnv LANG LC_*, either remove it or make sure your remote system supports the locales your local machine uses. Alternatively, restart SSH on the server:
sudo systemctl restart sshAfter making changes, run apt again:
sudo apt updateThe locale warning should be gone. You can also verify with:
localeYour LANG should now match one of the installed locales from locale -a.
In container environments (Docker, LXC, Kubernetes), locale generation may require installing the locales package first: apt-get install -y locales. Some minimal images skip this to reduce size. For headless servers where you don't care about locale-specific formatting, you can set LC_ALL=C.UTF-8 to use the minimal locale without generating others, though proper locale generation is preferred. On systems with strict resource constraints, consider installing locales-all instead of configuring individual locales.
E: Cannot set to hold: package 'package-name' is not installed
How to fix "Cannot set to hold" error when package is not installed in APT
debconf: unable to initialize frontend: Dialog
How to fix "debconf: unable to initialize frontend: Dialog" in APT
E: Could not connect to proxy server
Could not connect to proxy server
dpkg: serious warning: files list file for package 'package-name' contains empty filename
How to fix "files list file contains empty filename" in APT
E: Package 'package:i386' has no installation candidate
How to fix "Package package:i386 has no installation candidate" in apt