Re: [docs] [PATCH v2] ref-manual: use standardized method accross both ubuntu and debian for locale install

Antonin Godard
2024-11-27T08:34:48Z

Hi Guénaël,

On Mon Nov 25, 2024 at 3:39 PM CET, Guénaël MULLER wrote:
[...]
>> I assume this works correctly if one uses an interactive container. E.g.
>> I'm expecting this won't work with these instructions in a
>> Containerfile/Dockerfile for example.
>>
>> podman run --userns=keep-id --user root debian:bookworm sh -c 'apt-get
>> update && apt-get install -y locales; locale --all-locales | grep
>> en_US.utf8; dpkg-reconfigure locales; locale --all-locales | grep
>> en_US.utf8;'
>>
>> it'll fail when running dpkg-reconfigure. If you add --frontend
>> noninteractive, then it just does nothing.
>>
>> I'm not sure if we really need noninteractive instructions, but I would
>> at least mention that we know it doesn't work for noninteractive
>> terminals in a note below the instructions? I understand we may not want
>> to instruct users to modify their locales with a simple sed command
>> which is apparently the appropriate way?
>>
>
> I see 2 solutions to solve this issue there:
>
> - just add "(interactive mode only)" to the line before the command
> line.
> - add a complete note that explain all the stuff, something like:

I'd go with this approach (explain it all).

>
> - If your are not using the interactive mode, ``dpkg-reconfigure`` will
> not work as expected. To add the locale
> you will need to edit ``/etc/locale.gen`` file. A naive way to do this as
> root is::
>
> $ echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
> $ locale-gen

Yes, I would add this after the dpkg-reconfigure method (although maybe I
wouldn't echo into /etc/locale.gen, but rather instruct that "en_US.UTF-8" must
be present and uncommented in this file).

Also, before that, I would simply mention that the dpkg-reconfigure method is
interactive (followed by the /etc/locale.gen method above).

Antonin

--
Antonin Godard, Bootlin
Embedded Linux and Kernel engineering