* [PATCH] Set default locale in /etc/locale.conf
@ 2022-10-20 10:51 Schaffner, Tobias
2022-10-20 11:00 ` Henning Schild
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Schaffner, Tobias @ 2022-10-20 10:51 UTC (permalink / raw)
To: isar-users
Cc: Schild, Henning, MOESSBAUER, FELIX JONATHAN, jan.kiszka, Bezdeka,
Florian
Debian bookworm introduced systemd-firstboot [1] which asks the user to
configure some basic settings like hostname, timezone or locale if not already
configured.
It asks the user interactively to select a locale on first boot as we do not
have it set in /etc/locale.conf [2].
Create the /etc/locale.conf with the default locale setting to allow booting
bookworm images without user interaction.
[1] https://www.freedesktop.org/software/systemd/man/systemd-firstboot.html
[2] https://man7.org/linux/man-pages/man5/locale.conf.5.html
Signed-off-by: Tobias Schaffner <tobias.schaffner@siemens.com>
---
meta/classes/image-locales-extension.bbclass | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/meta/classes/image-locales-extension.bbclass
b/meta/classes/image-locales-extension.bbclass
index 25af540..964793a 100644
--- a/meta/classes/image-locales-extension.bbclass
+++ b/meta/classes/image-locales-extension.bbclass
@@ -44,7 +44,7 @@ __EOF__
locales locales/locales_to_be_generated multiselect
${@get_locale_gen(d, ', ')}
locales locales/default_environment_locale select ${LOCALE_DEFAULT}
__EOF__
- cat<<__EOF__ > ${WORKDIR}/locale.default
+ cat<<__EOF__ > ${WORKDIR}/locale.conf
LANG=${LOCALE_DEFAULT}
__EOF__
cat<<__EOF__ > ${WORKDIR}/locale.nopurge
@@ -63,7 +63,7 @@ __EOF__
cat '${WORKDIR}/locale.gen' >> '${ROOTFSDIR}/etc/locale.gen'
cat '${WORKDIR}/locale.default' > '${ROOTFSDIR}/etc/default/locale'
cat '${WORKDIR}/locale.nopurge' > '${ROOTFSDIR}/etc/locale.nopurge'
- cat '${WORKDIR}/locale.debconf' > '${ROOTFSDIR}/tmp/locale.debconf'
+ cat '${WORKDIR}/locale.conf' > '${ROOTFSDIR}/etc/locale.conf'
# Enter image and trigger locales config and localepurge:
chroot '${ROOTFSDIR}' /bin/sh <<'EOSH'
@@ -78,8 +78,7 @@ __EOF__
fi
echo 'running locale debconf-set-selections'
- debconf-set-selections /tmp/locale.debconf
- rm -f '/tmp/locale.debconf'
+ debconf-set-selections /etc/locale.conf
echo 'reconfigure locales'
dpkg-reconfigure -f noninteractive locales
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Set default locale in /etc/locale.conf
2022-10-20 10:51 [PATCH] Set default locale in /etc/locale.conf Schaffner, Tobias
@ 2022-10-20 11:00 ` Henning Schild
2022-10-20 12:12 ` Uladzimir Bely
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Henning Schild @ 2022-10-20 11:00 UTC (permalink / raw)
To: Schaffner, Tobias (T CED SES-DE)
Cc: isar-users, Moessbauer, Felix (T CED INW-CN), Kiszka, Jan (T CED),
Bezdeka, Florian (T CED SES-DE)
Am Thu, 20 Oct 2022 12:51:57 +0200
schrieb "Schaffner, Tobias (T CED SES-DE)"
<tobias.schaffner@siemens.com>:
> Debian bookworm introduced systemd-firstboot [1] which asks the user
> to configure some basic settings like hostname, timezone or locale if
> not already configured.
>
> It asks the user interactively to select a locale on first boot as we
> do not have it set in /etc/locale.conf [2].
>
> Create the /etc/locale.conf with the default locale setting to allow
> booting bookworm images without user interaction.
>
> [1]
> https://www.freedesktop.org/software/systemd/man/systemd-firstboot.html
> [2] https://man7.org/linux/man-pages/man5/locale.conf.5.html
>
> Signed-off-by: Tobias Schaffner <tobias.schaffner@siemens.com>
> ---
> meta/classes/image-locales-extension.bbclass | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/meta/classes/image-locales-extension.bbclass
> b/meta/classes/image-locales-extension.bbclass
> index 25af540..964793a 100644
> --- a/meta/classes/image-locales-extension.bbclass
> +++ b/meta/classes/image-locales-extension.bbclass
For all changes in that file we need to switch-case old vs new, not
support only new.
So some sort of if systemd and systemd version >= 0815
Henning
> @@ -44,7 +44,7 @@ __EOF__
> locales locales/locales_to_be_generated multiselect
> ${@get_locale_gen(d, ', ')}
> locales locales/default_environment_locale select
> ${LOCALE_DEFAULT} __EOF__
> - cat<<__EOF__ > ${WORKDIR}/locale.default
> + cat<<__EOF__ > ${WORKDIR}/locale.conf
> LANG=${LOCALE_DEFAULT}
> __EOF__
> cat<<__EOF__ > ${WORKDIR}/locale.nopurge
> @@ -63,7 +63,7 @@ __EOF__
> cat '${WORKDIR}/locale.gen' >> '${ROOTFSDIR}/etc/locale.gen'
> cat '${WORKDIR}/locale.default' >
> '${ROOTFSDIR}/etc/default/locale' cat '${WORKDIR}/locale.nopurge' >
> '${ROOTFSDIR}/etc/locale.nopurge'
> - cat '${WORKDIR}/locale.debconf' >
> '${ROOTFSDIR}/tmp/locale.debconf'
> + cat '${WORKDIR}/locale.conf' > '${ROOTFSDIR}/etc/locale.conf'
>
> # Enter image and trigger locales config and localepurge:
> chroot '${ROOTFSDIR}' /bin/sh <<'EOSH'
> @@ -78,8 +78,7 @@ __EOF__
> fi
>
> echo 'running locale debconf-set-selections'
> - debconf-set-selections /tmp/locale.debconf
> - rm -f '/tmp/locale.debconf'
> + debconf-set-selections /etc/locale.conf
>
> echo 'reconfigure locales'
> dpkg-reconfigure -f noninteractive locales
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Set default locale in /etc/locale.conf
2022-10-20 10:51 [PATCH] Set default locale in /etc/locale.conf Schaffner, Tobias
2022-10-20 11:00 ` Henning Schild
@ 2022-10-20 12:12 ` Uladzimir Bely
2022-10-24 8:08 ` Schaffner, Tobias
2022-10-24 15:07 ` [PATCH v2 0/1] " Schaffner, Tobias
2022-10-24 15:07 ` [PATCH v2 1/1] " Schaffner, Tobias
3 siblings, 1 reply; 8+ messages in thread
From: Uladzimir Bely @ 2022-10-20 12:12 UTC (permalink / raw)
To: isar-users, Schaffner, Tobias
In mail from четверг, 20 октября 2022 г. 13:51:57 +03 user Schaffner, Tobias
wrote:
Hello.
I've just tried your changes with both 'bullseye' and 'bookworm' under qemu
and it they both booted properly (before, bookworm boot too, much more time
and resulted in some kind of error).
Just a question: How did you send this patch? Because both 'mbox'-es, one
generated by our patchwork ( https://patchwork.isar-build.org/project/isar/
patch/78c228a7-1a11-119d-8fe9-03f62d47c752@siemens.com/ ) and another I saved
in the mail client, couldn't be applied. So, I had to apply this changes
manually, line by line.
Probably, the patch was sent from some client that broke lines?
> Debian bookworm introduced systemd-firstboot [1] which asks the user to
> configure some basic settings like hostname, timezone or locale if not
> already configured.
>
> It asks the user interactively to select a locale on first boot as we do not
> have it set in /etc/locale.conf [2].
>
> Create the /etc/locale.conf with the default locale setting to allow booting
> bookworm images without user interaction.
>
> [1] https://www.freedesktop.org/software/systemd/man/systemd-firstboot.html
> [2] https://man7.org/linux/man-pages/man5/locale.conf.5.html
>
> Signed-off-by: Tobias Schaffner <tobias.schaffner@siemens.com>
> ---
> meta/classes/image-locales-extension.bbclass | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/meta/classes/image-locales-extension.bbclass
> b/meta/classes/image-locales-extension.bbclass
> index 25af540..964793a 100644
> --- a/meta/classes/image-locales-extension.bbclass
> +++ b/meta/classes/image-locales-extension.bbclass
> @@ -44,7 +44,7 @@ __EOF__
> locales locales/locales_to_be_generated multiselect
> ${@get_locale_gen(d, ', ')}
> locales locales/default_environment_locale select ${LOCALE_DEFAULT}
> __EOF__
> - cat<<__EOF__ > ${WORKDIR}/locale.default
> + cat<<__EOF__ > ${WORKDIR}/locale.conf
> LANG=${LOCALE_DEFAULT}
> __EOF__
> cat<<__EOF__ > ${WORKDIR}/locale.nopurge
> @@ -63,7 +63,7 @@ __EOF__
> cat '${WORKDIR}/locale.gen' >> '${ROOTFSDIR}/etc/locale.gen'
> cat '${WORKDIR}/locale.default' >
> '${ROOTFSDIR}/etc/default/locale' cat '${WORKDIR}/locale.nopurge' >
> '${ROOTFSDIR}/etc/locale.nopurge' - cat '${WORKDIR}/locale.debconf'
> > '${ROOTFSDIR}/tmp/locale.debconf' + cat '${WORKDIR}/locale.conf' >
> '${ROOTFSDIR}/etc/locale.conf'
>
> # Enter image and trigger locales config and localepurge:
> chroot '${ROOTFSDIR}' /bin/sh <<'EOSH'
> @@ -78,8 +78,7 @@ __EOF__
> fi
>
> echo 'running locale debconf-set-selections'
> - debconf-set-selections /tmp/locale.debconf
> - rm -f '/tmp/locale.debconf'
> + debconf-set-selections /etc/locale.conf
>
> echo 'reconfigure locales'
> dpkg-reconfigure -f noninteractive locales
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Set default locale in /etc/locale.conf
2022-10-20 12:12 ` Uladzimir Bely
@ 2022-10-24 8:08 ` Schaffner, Tobias
2022-10-24 12:04 ` Jan Kiszka
0 siblings, 1 reply; 8+ messages in thread
From: Schaffner, Tobias @ 2022-10-24 8:08 UTC (permalink / raw)
To: Uladzimir Bely, isar-users
On 20.10.22 14:12, Uladzimir Bely wrote:
> In mail from четверг, 20 октября 2022 г. 13:51:57 +03 user Schaffner, Tobias
> wrote:
>
> Hello.
> I've just tried your changes with both 'bullseye' and 'bookworm' under qemu
> and it they both booted properly (before, bookworm boot too, much more time
> and resulted in some kind of error).
Hello Uladzimir,
thanks for testing. I will send a v2 that removes the conf file for older
systemd versions.
> Just a question: How did you send this patch? Because both 'mbox'-es, one
> generated by our patchwork ( https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.isar-build.org%2Fproject%2Fisar%2F&data=05%7C01%7Ctobias.schaffner%40siemens.com%7C4dd8f14b423943ca93c908dab2946d89%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C638018647803542876%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=APsJwt9XO0LTShE6xR5UB%2Fz2SWefuxfNxx2egkXebvk%3D&reserved=0
> patch/78c228a7-1a11-119d-8fe9-03f62d47c752@siemens.com/ ) and another I saved
> in the mail client, couldn't be applied. So, I had to apply this changes
> manually, line by line.
>
> Probably, the patch was sent from some client that broke lines?
I temporarily hat not access to smtp and tried to copy everything together in
thunderbird. Looks like it added some newlines. I will send the next version
with git directly.
All the best
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Set default locale in /etc/locale.conf
2022-10-24 8:08 ` Schaffner, Tobias
@ 2022-10-24 12:04 ` Jan Kiszka
0 siblings, 0 replies; 8+ messages in thread
From: Jan Kiszka @ 2022-10-24 12:04 UTC (permalink / raw)
To: Schaffner, Tobias, Uladzimir Bely, isar-users
On 24.10.22 10:08, Schaffner, Tobias wrote:
> On 20.10.22 14:12, Uladzimir Bely wrote:
>> In mail from четверг, 20 октября 2022 г. 13:51:57 +03 user Schaffner, Tobias
>> wrote:
>>
>> Hello.
>> I've just tried your changes with both 'bullseye' and 'bookworm' under qemu
>> and it they both booted properly (before, bookworm boot too, much more time
>> and resulted in some kind of error).
>
> Hello Uladzimir,
>
> thanks for testing. I will send a v2 that removes the conf file for older
> systemd versions.
>
>> Just a question: How did you send this patch? Because both 'mbox'-es, one
>> generated by our patchwork ( https://patchwork.isar-build.org/project/isar/
>> patch/78c228a7-1a11-119d-8fe9-03f62d47c752@siemens.com/ ) and another I saved
>> in the mail client, couldn't be applied. So, I had to apply this changes
>> manually, line by line.
>>
>> Probably, the patch was sent from some client that broke lines?
>
> I temporarily hat not access to smtp and tried to copy everything together in
> thunderbird. Looks like it added some newlines. I will send the next version
> with git directly.
If you do that in TB, you want https://addons.thunderbird.net/de/thunderbird/addon/toggle-line-wrap :D
Jan
--
Siemens AG, Technology
Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 0/1] Set default locale in /etc/locale.conf
2022-10-20 10:51 [PATCH] Set default locale in /etc/locale.conf Schaffner, Tobias
2022-10-20 11:00 ` Henning Schild
2022-10-20 12:12 ` Uladzimir Bely
@ 2022-10-24 15:07 ` Schaffner, Tobias
2022-10-24 15:07 ` [PATCH v2 1/1] " Schaffner, Tobias
3 siblings, 0 replies; 8+ messages in thread
From: Schaffner, Tobias @ 2022-10-24 15:07 UTC (permalink / raw)
To: isar-users
Cc: Schild, Henning, MOESSBAUER, FELIX JONATHAN, Kiszka, Jan,
Bezdeka, Florian, Uladzimir Bely
Changes since v1:
- Debian started packaging systemd-firstboot with version 251. Only create /etc/locale.conf with systemd v251 or higher.
- Symlink to /etc/default/locale as it has the same format and we do not want to maintain two different files.
Tobias Schaffner (1):
Set default locale in /etc/locale.conf
meta/classes/image-locales-extension.bbclass | 8 ++++++++
1 file changed, 8 insertions(+)
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/1] Set default locale in /etc/locale.conf
2022-10-20 10:51 [PATCH] Set default locale in /etc/locale.conf Schaffner, Tobias
` (2 preceding siblings ...)
2022-10-24 15:07 ` [PATCH v2 0/1] " Schaffner, Tobias
@ 2022-10-24 15:07 ` Schaffner, Tobias
2022-10-25 8:36 ` Henning Schild
3 siblings, 1 reply; 8+ messages in thread
From: Schaffner, Tobias @ 2022-10-24 15:07 UTC (permalink / raw)
To: isar-users
Cc: Schild, Henning, MOESSBAUER, FELIX JONATHAN, Kiszka, Jan,
Bezdeka, Florian, Uladzimir Bely
Debian bookworm introduced systemd-firstboot [1] which asks the user to
configure some basic settings like hostname, timezone or locale if not already
configured.
It asks the user interactively to select a locale on first boot as we do not
have it set in /etc/locale.conf [2].
/etc/locale.conf has the same format as /etc/default/locale.
Symlink /etc/locale.conf to /etc/default/locale for bookworm images to allow
booting without user interaction.
[1] https://www.freedesktop.org/software/systemd/man/systemd-firstboot.html
[2] https://man7.org/linux/man-pages/man5/locale.conf.5.html
Signed-off-by: Tobias Schaffner <tobias.schaffner@siemens.com>
---
meta/classes/image-locales-extension.bbclass | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/meta/classes/image-locales-extension.bbclass b/meta/classes/image-locales-extension.bbclass
index 2db6d4a..9def316 100644
--- a/meta/classes/image-locales-extension.bbclass
+++ b/meta/classes/image-locales-extension.bbclass
@@ -82,6 +82,14 @@ __EOF__
debconf-set-selections /tmp/locale.debconf
rm -f '/tmp/locale.debconf'
+ SYSTEMD_VERSION=$(dpkg-query \
+ --showformat='${source:Upstream-Version}' \
+ --show systemd || echo "0" )
+
+ if dpkg --compare-versions "$SYSTEMD_VERSION" "ge" "251"; then
+ ln -s /etc/default/locale /etc/locale.conf
+ fi
+
echo 'reconfigure locales'
dpkg-reconfigure -f noninteractive locales
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/1] Set default locale in /etc/locale.conf
2022-10-24 15:07 ` [PATCH v2 1/1] " Schaffner, Tobias
@ 2022-10-25 8:36 ` Henning Schild
0 siblings, 0 replies; 8+ messages in thread
From: Henning Schild @ 2022-10-25 8:36 UTC (permalink / raw)
To: Schaffner, Tobias (T CED SES-DE)
Cc: isar-users, Moessbauer, Felix (T CED INW-CN), Kiszka, Jan (T CED),
Bezdeka, Florian (T CED SES-DE),
Uladzimir Bely
Am Mon, 24 Oct 2022 17:07:11 +0200
schrieb "Schaffner, Tobias (T CED SES-DE)"
<tobias.schaffner@siemens.com>:
> Debian bookworm introduced systemd-firstboot [1] which asks the user
> to configure some basic settings like hostname, timezone or locale if
> not already configured.
>
> It asks the user interactively to select a locale on first boot as we
> do not have it set in /etc/locale.conf [2].
>
> /etc/locale.conf has the same format as /etc/default/locale.
>
> Symlink /etc/locale.conf to /etc/default/locale for bookworm images
> to allow booting without user interaction.
>
> [1]
> https://www.freedesktop.org/software/systemd/man/systemd-firstboot.html
> [2] https://man7.org/linux/man-pages/man5/locale.conf.5.html
>
> Signed-off-by: Tobias Schaffner <tobias.schaffner@siemens.com>
> ---
> meta/classes/image-locales-extension.bbclass | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/meta/classes/image-locales-extension.bbclass
> b/meta/classes/image-locales-extension.bbclass index 2db6d4a..9def316
> 100644 --- a/meta/classes/image-locales-extension.bbclass
> +++ b/meta/classes/image-locales-extension.bbclass
> @@ -82,6 +82,14 @@ __EOF__
> debconf-set-selections /tmp/locale.debconf
> rm -f '/tmp/locale.debconf'
>
> + SYSTEMD_VERSION=$(dpkg-query \
> + --showformat='${source:Upstream-Version}' \
> + --show systemd || echo "0" )
> +
> + if dpkg --compare-versions "$SYSTEMD_VERSION" "ge"
> "251"; then
> + ln -s /etc/default/locale /etc/locale.conf
> + fi
> +
I would want to bet that we can create that as a file (not a
symlink) instead of some other files we used to create. But for now
that looks like a good quick fix for a problem that might come back in
some form.
Henning
> echo 'reconfigure locales'
> dpkg-reconfigure -f noninteractive locales
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-10-25 8:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-20 10:51 [PATCH] Set default locale in /etc/locale.conf Schaffner, Tobias
2022-10-20 11:00 ` Henning Schild
2022-10-20 12:12 ` Uladzimir Bely
2022-10-24 8:08 ` Schaffner, Tobias
2022-10-24 12:04 ` Jan Kiszka
2022-10-24 15:07 ` [PATCH v2 0/1] " Schaffner, Tobias
2022-10-24 15:07 ` [PATCH v2 1/1] " Schaffner, Tobias
2022-10-25 8:36 ` Henning Schild
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox