Locale errors when using pct command

greg91

Member
Jan 25, 2020
7
3
23
32
Hello,

I'm trying to interact with my container with pct, and when I use apt to install a new package or upgrade I get a warning and errors concerning locale (see below). I do not have any problem when I interact with the container through the local console of this container or with ssh. Can you help me, I did a lot of research but can't find the answer. Thank you!

Code:
root@pve-test:~# pct exec 103 apt install unzip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  zip
The following NEW packages will be installed:
  unzip
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 172 kB of archives.
After this operation, 580 kB of additional disk space will be used.
Get:1 http://ftp.debian.org/debian buster/main amd64 unzip amd64 6.0-23+deb10u2 [172 kB]
Fetched 172 kB in 0s (1672 kB/s)
apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct!
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
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_ALL to default locale: No such file or directory
Selecting previously unselected package unzip.
(Reading database ... 20552 files and directories currently installed.)
Preparing to unpack .../unzip_6.0-23+deb10u2_amd64.deb ...
Unpacking unzip (6.0-23+deb10u2) ...
Setting up unzip (6.0-23+deb10u2) ...
Processing triggers for mime-support (3.62) ...
Processing triggers for man-db (2.8.5-2) ...
 
Hello, thank you for the answer. I tried this and it doesn't change anything, I still get the same error. Please let me know if I can provide more info.
 
Thank you, indeed that solves the issue. Do you know why is it like that by default?
 
dpkg-reconfigure locales and selecting en_US.UTF-8 and my native language, with en_US.UTF-8 as the default, always solves these issues for me on Debian (and Proxmox) systems.

Somehow since PVE 7.3 this doesn't seem to work anymore.

When logging in via SSH, I am still getting this output:

Code:
root@carrier-2:~# pveversion
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
pve-manager/7.3-4/d69b70d4 (running kernel: 5.15.83-1-pve)
 
Somehow since PVE 7.3 this doesn't seem to work anymore.

When logging in via SSH, I am still getting this output:

Code:
root@carrier-2:~# pveversion
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
pve-manager/7.3-4/d69b70d4 (running kernel: 5.15.83-1-pve)
Same. Cannot set locale. Any other tips?
 
Below will uncomment en_US.UTF-8 in /etc/locale.gen then generate the locale. Works in Debian 11 LXC.

Bash:
pct exec 900 -- bash -c 'sed -i "/# en_US.UTF-8/s|^# ||" /etc/locale.gen && locale-gen'