OSInside / kiwi

KIWI - Appliance Builder Next Generation
https://osinside.github.io/kiwi
GNU General Public License v3.0
282 stars 142 forks source link

Kiwi variables not coherent with configs #2560

Closed mbugni closed 4 weeks ago

mbugni commented 1 month ago

Problem description

I wrote my first Fedora live system using kiwi-ng. I created a localization profile name Localization-it_IT (see the localization.xml file). My preferences are:

<preferences profiles="Localization-it_IT">
  <locale>it_IT</locale>
  <keytable>it</keytable>
  <timezone>Europe/Rome</timezone>
</preferences>

Localization works fine in my target system, for example I see in /etc/locale.conf:

LANG=it_IT.UTF-8

However, in my image-root.log I get these variables:

kiwi_keytable=us
kiwi_language=en_US

So, it's not simple to manage locale using custom scripts (eg one need to parse locale.conf, like I did in config.sh).

Expected behaviour

Kiwi variables should be coherent with preference, so:

kiwi_keytable=it
kiwi_language=it_IT

Steps to reproduce the behaviour

Use my README.md instructions (with or without podman), eg:

$ sudo kiwi-ng --profile=Minimal-it_IT --type=iso \
--shared-cache-dir=/live/target/cache system build \
--description=/live/source/kiwi-descriptions --target-dir=/live/target

OS and Software information

schaefi commented 1 month ago

I'm not sure if I can follow you. The information about keytable and locale in the build log matches the data provided with the image description. For the setup of locale and keytable inside of the system, kiwi runs systemd-firstboot --keymap MAP_VALUE and systemd-firstboot --locale LOCALE_VALUE. MAP_VALUE and LOCALE_VALUE matches the values you provided with the image description. However, what settings exactly are configured by these calls inside of the system is outside of kiwi's control. We expect the calls to do the "right thing" :)

Thus the expectation that the settings in the kiwi image description matches with the exact configuration values done by the tooling (systemd-firstboot in this case) cannot be guaranteed

Unless I misunderstand your point, I don't see an issue that we could fix in the scope of kiwi

mbugni commented 1 month ago

I'm not sure if I can follow you. The information about keytable and locale in the build log matches the data provided with the image description.

I think is the opposite, in my image description I have:

<preferences profiles="Localization-it_IT">
  <locale>it_IT</locale>
  <keytable>it</keytable>
  <timezone>Europe/Rome</timezone>
</preferences>

while, from my build log I always get (regardless the selected profile):

kiwi_keytable=us
kiwi_language=en_US

so I think those variables are not coherent.

Despite that, the final .iso image locale is correct (ie in english for default and italian when I select the profile).

schaefi commented 1 month ago

Oh, now I understand, yes that sounds like a bug to be honest. I'll check

mbugni commented 1 month ago

@schaefi feel free to ask for more clarifications. You can find the source code here.

schaefi commented 4 weeks ago

@mbugni Hi, I tried to reproduce this with a simple image description (https://github.com/OSInside/kiwi/blob/main/build-tests/x86/tumbleweed/test-image-disk-simple/appliance.kiwi) I modified this file and added the locale setting you are using. Next I build the image and checked the log. My Image build uses --target-dir /tmp/mytest. The log I was looking at was /tmp/mytest/build/image-root.log. I searched for kiwi_keytable in the log and all I could find was

[ DEBUG   ]: 09:05:52 | --> kiwi_keytable='it'
[ DEBUG   ]: 09:05:52 | --> kiwi_language='it_IT'

which looked correct to me

Can you give me a bit more details on your image description ? It seems you are using profiles, maybe there is another section which clobbers the settings.

Thanks

schaefi commented 4 weeks ago

Ah never mind I saw you already provided the sources. I'll check those

schaefi commented 4 weeks ago

ok I checked the result image description from your fedora-remix as follows

ms@asterix:/home/ms/__foo/fedora-remix/kiwi-descriptions
(main)> kiwi-ng --profile Minimal-it_IT --type iso image info --description . --print-xml

If you do this you see the complete description including the profiles and includes. From that result you also see that we have a generic preferences section which always applies. This one sets "US" and the one you added profiled by the IT profile. Building against such a description allowed me to reproduce the error. In the log I see

[ DEBUG   ]: 09:20:38 | --> kiwi_keytable='us'
[ DEBUG   ]: 09:20:38 | --> kiwi_language='en_US'

.... and later

[ INFO    ]: 09:20:27 | Setting up keytable: it
...
[ DEBUG   ]: 09:20:27 | EXEC: [chroot /tmp/mytest/build/image-root systemd-firstboot --keymap=it]

So your system is correctly configured but the values kiwi writes into the profile are wrong. This is a bug... I'm on it

schaefi commented 4 weeks ago

Bug found and fixed, thanks for reporting