Skip to content

Commit 293f2ea

Browse files
committed
base_image: fix locale warnings in custom images
Fix "cannot change locale" warnings during SSH connections by configuring locales in the virt-builder template. Changes: - Add locales-all package for comprehensive locale support - Configure locales during both image build (run-command) and first boot (firstboot-command) to handle both new and existing cached images - Remove failing dpkg-reconfigure command This ensures en_US.UTF-8 locale is available at boot, eliminating SSH warnings. Generated-by: Claude AI Signed-off-by: Daniel Gomez <[email protected]>
1 parent d585585 commit 293f2ea

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

kconfigs/Kconfig.libvirt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,16 @@ config LIBVIRT_MEM_MB
458458
help
459459
How much MiB of RAM to use per guest.
460460

461+
config LIBVIRT_IMAGE_SIZE
462+
string "VM image size"
463+
output yaml
464+
default "20G"
465+
depends on GUESTFS
466+
help
467+
The size of the VM disk image for all libvirt images, whether they
468+
are base images (created with virt-builder) or custom images
469+
(downloaded and resized with qemu-img resize).
470+
461471
config HAVE_LIBVIRT_PCIE_PASSTHROUGH
462472
bool
463473
default $(shell, scripts/check_pciepassthrough_kconfig.sh passthrough_libvirt.generated)

playbooks/roles/base_image/tasks/base-image.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
- "-o"
4545
- "{{ base_image_pathname }}"
4646
- "--size"
47-
- "20G"
47+
- "{{ libvirt_image_size }}"
4848
- "--format"
4949
- "raw"
5050
- "--commands-from-file"
@@ -63,7 +63,7 @@
6363
- "-o"
6464
- "{{ base_image_pathname }}"
6565
- "--size"
66-
- "20G"
66+
- "{{ libvirt_image_size }}"
6767
- "--format"
6868
- "raw"
6969
- "--commands-from-file"

playbooks/roles/base_image/tasks/custom-image.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,21 @@
4141
url: "{{ guestfs_custom_raw_image_url }}"
4242
dest: "{{ custom_image_dir }}"
4343
mode: "u=rw,g=r,o=r"
44+
register: custom_image_download
4445
when:
4546
- not custom_image_stat.stat.exists
4647
- guestfs_has_custom_raw_image_url|bool
4748

49+
- name: Resize custom image to match configured size
50+
become: true
51+
become_method: ansible.builtin.sudo
52+
ansible.builtin.command:
53+
cmd: "qemu-img resize {{ custom_image }} {{ libvirt_image_size }}"
54+
changed_when: true
55+
when:
56+
- custom_image_download is changed or custom_image_stat.stat.exists
57+
- guestfs_has_custom_raw_image_url|bool
58+
4859
- name: Check if the custom image sentinel file already exists
4960
ansible.builtin.stat:
5061
path: "{{ custom_image_ok }}"

0 commit comments

Comments
 (0)