每次使用 apt-get 更新系统时都会出现此错误。这个错误是什么意思?有什么解决方法吗?(我正在运行 Ubuntu 11.10)
答案1
通常,此错误意味着您可能在不同的语言(区域设置)之间进行切换,并且某些原因错误地导致了此错误。
您可以尝试使用以下方法重新生成语言环境列表
sudo dpkg-reconfigure locales
对我来说结果是:
Generating locales...
en_AG.UTF-8... done
en_AU.UTF-8... done
en_BW.UTF-8... done
en_CA.UTF-8... done
en_DK.UTF-8... done
en_GB.UTF-8... done
en_HK.UTF-8... done
en_IE.UTF-8... done
en_IN.UTF-8... done
en_NG.UTF-8... done
en_NZ.UTF-8... done
en_PH.UTF-8... done
en_SG.UTF-8... done
en_US.UTF-8... up-to-date
en_ZA.UTF-8... done
en_ZM.UTF-8... done
en_ZW.UTF-8... done
Generation complete.
然后使用以下命令重置您的本地语言环境:
sudo update-locale LANG=en_US.UTF-8
即使用上面输出中的一个区域设置值
答案2
就我而言,问题在于/usr/share/initramfs-tools/hooks/root_locale
期望看到单独的语言环境目录/usr/lib/locale
但locale-gen
默认配置为生成存档文件。
我通过运行修复了它:
sudo locale-gen --purge --no-archive
答案3
答案4
重新安装locales
对我有用
sudo apt reinstall locales
在运行上述命令之前,我会看到这个
$ locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
C.UTF-8
POSIX
$ sudo dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
...
Generating locales (this might take a while)...
en_AG.UTF-8...[error] cannot open locale definition file `en_GB': No such file or directory
done
en_AU.UTF-8...[error] cannot open locale definition file `en_AU': No such file or directory
...
重新安装后locales
,我看到了正确的输出
$ locale -a
C
C.UTF-8
...
en_US.utf8
...
$ sudo dpkg-reconfigure locales
Generating locales (this might take a while)...
...
en_US.UTF-8... done
...
Generation complete.