How do I set the correct locale and keyboard layout for my Debian 12 containers?

Aug 30, 2023
88
12
8
Luxembourg
I've installed several Debian 12 based containers on my PVE host, which has the datacenter keyboard option set to "English (UK)", but all the container consoles, via the GUI or by SSH are set to US English. I can't get any standard commands for changing locale/keyboard to work.

How do I set them to be UK English?
 
I don't know about the keyboard layouts but does the usual dpkg-reconfigure locales and selecting EN_GB.UTF-8 and also a the default not work (for the locale)?
 
You have to set the layout for each Container. Which commands do not work?

dpkg-reconfigure keyboard-configuration should work

https://wiki.debian.org/Keyboard
 
Last edited:
I'd tried the manual way copying the file from the host to the container, the file did not exist, and still the same even after rebooting the container.

I then tried installing the "console-setup" as you mentioned and still the same, when I run the command it just drops me back to the prompt without showing anything.
 
Could it be that you give the container too little memory (less than 512MB) and every command just terminates because of lack of memory?

EDIT: Or that the filesystem is read-only or any other things that might cause stuff to not work? What does the container configuration look like (pct config )?
 
It had just 512 so I upped it to 4096 and still the same. I also tried it in the console of the main PVE (v8.1.4) host and the command does the same - on a full blown Debian 12 VM it works fine and brings up the list of layouts to choose.

Code:
arch: amd64
cores: 1
dev0: path=/dev/bus/usb/001/002,mode=0666
features: nesting=1
hostname: EDDIE
memory: 512
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=BC:xx:xx:xx:xx:CB,ip=dhcp,type=veth
onboot: 1
ostype: debian
rootfs: local-zfs:subvol-101-disk-0,size=8G
startup: order=1
swap: 512
tags: container;linux
timezone: Europe/Luxembourg
unprivileged: 1
 
Ok, after numerous attempts at "fixes", I think I may have it sorted but I won't mark this as solved until I test on another container when I have time at the weekend. I restored the container back to before I began to change things but it comes down to running one command:
  • Logged in as root
  • I ran dpkg-reconfigure locales - this appears to be already installed
  • I saw that unlike the host, no locales were pre-chosen which in this case was en_US.UTF-8 UTF-8
  • Selected en_US.UTF-8 UTF-8 then for the default en_US.UTF-8
  • Logged out and back in as root
  • Found my keyboard was working as English UK, just like the host console - I did not change anything in /etc/default or anywhere else
Like I said, I will try the exact same thing on the other containers over the weekend, and post back afterwards, hopefully marking this a solved.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!