using kiwi_language results in non utf8 locale on ubuntu 24.04 image

10 views
Skip to first unread message

Sven Wölfel

unread,
Apr 15, 2025, 3:20:19 AMApr 15
to kiwi
Hello.
Im setting
 <locale>en_US</locale>
in my config.xml for an ubuntu 24.04 Image.
In the config.sh script I have the following line:
echo "LANG=${kiwi_language}" > /etc/locale.conf

I used this line for previous Ubuntu releases as well which always resulted in an /etc/locale.conf entry like LANG=en_US.utf8. But recently I get LANG=en_US in my locale.conf.

Is this a potential issue with kiwi? If I understood the documentation correctly I would assume kiwi_language should be set to en_US.utf8 right?

Marcus Schäfer

unread,
Apr 22, 2025, 4:21:04 AMApr 22
to kiwi-...@googlegroups.com
Hi Sven,

> Im setting
>
> <locale>en_US</locale>
> in my config.xml for an ubuntu 24.04 Image.

Yeah a known issue. kiwi uses the systemd tools to setup
locale, keyboard and timezone. But on Debian based distributions
this does not work. In one of the example image descriptions
I found this:

---

# On Debian based distributions the kiwi built in way
# to setup locale, keyboard and timezone via systemd tools
# does not work because not(yet) provided by the distribution.
# Thus the following manual steps to make the values provided
# in the image description effective needs to be done.
#
#=======================================
# Setup system locale
#---------------------------------------
echo "LANG=${kiwi_language}" > /etc/locale.conf

#=======================================
# Setup system keymap
#---------------------------------------
echo "KEYMAP=${kiwi_keytable}" > /etc/vconsole.conf
echo "FONT=eurlatgr.psfu" >> /etc/vconsole.conf
echo "FONT_MAP=" >> /etc/vconsole.conf
echo "FONT_UNIMAP=" >> /etc/vconsole.conf

#=======================================
# Setup system timezone
#---------------------------------------
rm -f /etc/localtime
ln -s /usr/share/zoneinfo/${kiwi_timezone} /etc/localtime

#=======================================
# Setup HW clock to UTC
#---------------------------------------
echo "0.0 0 0.0" > /etc/adjtime
echo "0" >> /etc/adjtime
echo "UTC" >> /etc/adjtime

---

Hope this helps

Regards,
Marcus
--
Public Key available via: https://keybase.io/marcus_schaefer/key.asc
keybase search marcus_schaefer
signature.asc

Sven Woelfel

unread,
Apr 22, 2025, 1:48:42 PMApr 22
to kiwi-...@googlegroups.com

Yes, I used the example you posted for basically all my Ubuntu images up till now.

But since Ubuntu 24.04 the line

echo "LANG=${kiwi_language}" > /etc/locale.conf

results in LANG=en_US and not LANG=en_US.utf8. In previous versions of Ubuntu I build with kiwi and the above line in config.sh I didn't had the problem. 
It is not a big issue I just changed the config line to 
echo "LANG=${kiwi_language}.utf8" > /etc/locale.conf
but I found it strange that it only happened in the recent build attempts. Hence my question if kiwi_language only contains e.g. en_US or if it should contain en_US.utf8 since the documentation states:
Please note only UTF-8 locales are supported here which also means that the encoding must not be part
of the locale information. 
That is why I assumed kiwi_language would result in en_US.utf8 not en_US.
 
But my guess is that the behavior I observed is more likely a change in how Ubuntu creates the system locales in the current version as to how it did before. So the fact that the above line in config.sh resulted in an utf8 compatible system was probably due to Ubuntu creating the appropriate utf8 locales to the set locale in /etc/locale.conf automatically.


Regards

Sven



On 22.04.25 10:20, Marcus Schäfer wrote:
echo "LANG=${kiwi_language}" > /etc/locale.conf

Marcus Schäfer

unread,
Apr 24, 2025, 10:10:46 AMApr 24
to kiwi-...@googlegroups.com
Hi,

> Yes, I used the example you posted for basically all my Ubuntu images
> up till now.
>
> But since Ubuntu 24.04 the line
> echo "LANG=${kiwi_language}" > /etc/locale.conf
>
> results in LANG=en_US and not LANG=en_US.utf8. In previous versions of
> Ubuntu I build with kiwi and the above line in config.sh I didn't had
> the problem.

Hmm, the value of kiwi_language is just the contents of what
you set in your kiwi description as

<locale>en_US</locale>

You can double check this via:

kiwi-ng image info --description /path/to/your/image/description --print-kiwi-env | grep kiwi_language

If you see LANG to have a different value in the environment
compared to the value in /etc/locale.conf, then I believe there is
some other distro specific locale processing active

> It is not a big issue I just changed the config line to
>
> echo "LANG=${kiwi_language}.utf8" > /etc/locale.conf

or just

<locale>en_US.utf8</locale>

> but I found it strange that it only happened in the recent build
> attempts. Hence my question if kiwi_language only contains e.g. en_US
> or if it should contain en_US.utf8 since the documentation states:
>
> Please note only UTF-8 locales are supported here which also means that the enco
> ding must not be part
> of the locale information.

correct and when using the systemd tools to setup the locale
the documentation should also match with the reality. In kiwi there
is

if 'POSIX' in self.preferences['locale'].split(','):
locale = 'POSIX'
else:
locale = '{0}.UTF-8'.format(
self.preferences['locale'].split(',')[0]
)

So we pass "systemd-firstboot --locale=en_US.UTF-8" to the
tooling to setup the locale. The actual value for locale is
without the extension and I believe it is the case since a
very long time

I'm happy you found a solution :)

Cheers,
signature.asc
Reply all
Reply to author
Forward
0 new messages