[systemd-devel] [PATCH] vconsole: properly set terminal UTF-8 mode

Andrey Borzenkov arvidjaar at gmail.com
Thu Feb 17 10:52:51 PST 2011


On Thu, Nov 11, 2010 at 1:44 AM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Fri, 05.11.10 19:14, Andrey Borzenkov (arvidjaar at gmail.com) wrote:
>
>> >> It is rather interesting. I was testing unrelated patch for dracut
>> >> using dracut tip. It turned out, dracut now installs
>> >> systemd-vconsole-setup when available. Unfortunately it also also
>> >> changed parsing of configuration files so no locale config was
>> >> installed. Which caused vconsole-setup assume we are in non-UNICODE
>> >> mode and disable it.
>> >>
>> >> I still believe we should not make any assumption about console state
>> >> at the time of systemd startup and ensure it is configured as
>> >> requested.
>> >
>> > I see, then we should fix the vconsole setup if stuff goes wrong here.
>>
>> That is basically what my patch does.
>>
>> > We can safely assume that the kernel we rely on is utf8 by default.
>> >
>>
>> OK, do you want me to resubmit with fixed description?
>
> I think it is safe to assume that the kernel enables UTF8 by default. I
> see little need to redo what the kernel has been doing anyway already.
>
> Or, in other words: if vconsole-setup for reason didn't work properly in
> the initrd we probably should fix that, not then try to work-around this
> be enabling UTF8 a second time.
>

As it stands now, dracut 008 in generic (not hostonly) mode explicitly
disables UTF-8 because UNICODE is not set:

modules.d/10i18n/console_init:

set_keyboard() {
    local param

    [ "${UNICODE}" = 1 ] && param=-u || param=-a
    kbd_mode ${param}
}

The problem is, you do not know whether UNICODE is not set because
system is configured for non-UNICODE or because we do not know yet.

That's basically the same problem we already had in the past, and that
was fixed (for hostonly) by

commit 161da365e23cd4ac85f06e928a799f3427d8009d
Author: Andrey Borzenkov <arvidjaar at gmail.com>
Date:   Sun Nov 7 00:14:49 2010 +0300

    i18n: do not use systemd-vconsole-setup

    systemd-vconsole-setup was not designed to be run from udevd.
    It checks locale environment to decide, whether UNICODE should
    be enabled or disabled. Normally environment is setup by
    systemd; but the only environment available in udev rules is
    those from device properties. It means systemd-vconsole-setup
    always assumes default C locale and disables UNICODE.

    Revert to using built-in console_init which explicitly
    imports locale settings from /etc/vconsole.conf. Alternative
    is to revert 6545b9d7 and call console_init directly :)

I do not really see how to fix it in dracut given current
configuration. May be we should gradually move to using UNICODE=0 or
UNICODE=no to *disable* it, but still right now generic dracut image +
systemd is broken:

Feb 19 03:20:51 localhost kernel: systemd-vconsole-setup[341]:
loadkeys: warning: loading Unicode keymap on non-Unicode console
Feb 19 03:20:51 localhost kernel: systemd-vconsole-setup[341]:
(perhaps you want to do `kbd_mode -u'?)

So I humbly ask to revise whether my patch is acceptable.


More information about the systemd-devel mailing list