Skip to contentSkip to conversation

vconsole: properly set terminal UTF-8 mode

PATCH Andrey Borzenkov 2 participants 3 messages Feb 17, 2011 – Feb 18, 2011 8 messages not in the archive

lore
Share & tools
lore
#6 lore raw
In reply to a message not in the archive
Quoted 20 lines · Lennart Poettering
Quoted 18 lines · Andrey Borzenkov
Quoted 7 lines
Quoted 7 lines

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.

Quoted 5 lines
Quoted 3 lines

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.

Quoted 2 lines

We can safely assume that the kernel we rely on is utf8 by default.

Quoted 9 lines
Quoted 1 line

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 <[email protected]>
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.

#8 lore raw
In reply to a message not in the archive

Am 17.02.2011 19:52, schrieb Andrey Borzenkov:

Quoted 12 lines

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}
}
Quoted 2 lines

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.

You are right... UNICODE should default to 1 in dracut. Will change.

#10 lore raw
In reply to a message not in the archive

Am 18.02.2011 09:13, schrieb Harald Hoyer:

Quoted 9 lines

Am 17.02.2011 19:52, schrieb Andrey Borzenkov:

Quoted 8 lines

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

Quoted 8 lines
Quoted 6 lines
    [ "${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.

You are right... UNICODE should default to 1 in dracut. Will change.

changed to vconsole.font.unicode=1 alias UNICODE=1 and fixed the hostonly mode legacy configuration file parsing.