Skip to content

Commit 41f22e0

Browse files
committed
base_image: fix locale warnings in custom images
Fix "cannot change locale" warnings during SSH connections by properly configuring locales in the virt-builder template: - Add locales-all package to main install command for comprehensive locale support - Change locale generation from firstboot-command to run-command to execute during image build instead of first boot - Remove problematic dpkg-reconfigure command that was failing in non-interactive environment This ensures en_US.UTF-8 locale is properly configured and available when guests boot, eliminating locale warnings during SSH sessions. Generated-by: Claude AI Signed-off-by: Daniel Gomez <[email protected]>
1 parent a0f7b52 commit 41f22e0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

playbooks/roles/base_image/templates/virt-builder.j2

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mkdir {{ target_dir }}
1111
copy-in {{ guestfs_distro_source_and_dest_file }}:{{ target_dir }}
1212
{% endif %}
1313

14-
install sudo,qemu-guest-agent,python3,bash
14+
install sudo,qemu-guest-agent,python3,bash,locales-all
1515
run-command useradd {{ kdevops_uid }} -s /bin/bash -m kdevops
1616
append-line /etc/sudoers.d/kdevops:kdevops ALL=(ALL) NOPASSWD: ALL
1717
edit /etc/default/grub:s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0"/
@@ -63,9 +63,8 @@ uninstall cloud-init
6363
write /etc/default/locale:LANG=en_US.UTF-8
6464
append-line /etc/default/locale:LANGUAGE=en_US:en
6565
write /etc/locale.gen:en_US.UTF-8 UTF-8
66-
firstboot-command locale-gen en_US.UTF-8
67-
firstboot-command update-locale LANG=en_US.UTF-8
68-
firstboot-command DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true dpkg-reconfigure -p low --force locales
66+
run-command locale-gen en_US.UTF-8
67+
run-command update-locale LANG=en_US.UTF-8
6968
firstboot-command systemctl stop ssh
7069
firstboot-command systemctl start ssh
7170

0 commit comments

Comments
 (0)