Bug 1001411

Summary: systemd-vconsole-setup fails to set the keymap correctly
Product: [Fedora] Fedora Reporter: poma <pomidorabelisima>
Component: systemdAssignee: systemd-maint
Status: CLOSED INSUFFICIENT_DATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: adel.gadllah, awilliam, bioinfornatics, drago01, fdeutsch, fedora, harald, hhoyer, johannbg, lnykryn, msekleta, myllynen, plautrba, rstrode, systemd-maint, thomas, tpeplt, vpavlin, zbyszek
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-03 01:26:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Attachment described briefly.
none
As usual, attachment described briefly. none

Description poma 2013-08-27 02:34:39 UTC
Remove 'vconsole.keymap=<keymap>' from the boot loader's kernel 'append' line, and let the 'systemd-vconsole-setup.service' manage the system locale and keyboard layout settings.
.krow t'nseoD
The only solution is to "systemctl restart systemd-vconsole-setup.service".
This is the x86_64.
On i686 it's OK.
Welcome to Paradise.

Comment 1 poma 2013-09-18 17:43:12 UTC
I'll partially correct myself.
This doesn't work for i686, either.
And this is 'the' how it works,

/etc/systemd/system/actual-vconsole-setup-start.service
# Actual Virtual Console Setup Start

[Unit]
Description=Actual Virtual Console Setup Start

[Service]
Type=forking
ExecStart=/usr/lib/systemd/systemd-vconsole-setup

[Install]
WantedBy=rescue.target multi-user.target
EOF

Enabled SELinux isn't an issue,
sestatus 
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28

To recap, "localectl set-keymap <KEYMAP>" does work, however after reboot settings aren't applied cause of non functional 'systemd-vconsole-setup.service'.

I leave to the respected reader to contemplate. :)

p.s.
All these reports seem like the same problem:
https://bugzilla.redhat.com/show_bug.cgi?id=1000786
https://bugzilla.redhat.com/show_bug.cgi?id=983758
https://bugzilla.redhat.com/show_bug.cgi?id=975238
https://bugzilla.redhat.com/show_bug.cgi?id=963202

Comment 2 poma 2013-09-18 18:02:43 UTC
Tested with:
- systemd-204-11.fc19.x86_64
- systemd-207-2.fc21.x86_64
- systemd-204-11.fc19.i686
- systemd-207-2.fc21.i686

p.s.
Don't forget to "systemctl enable actual-vconsole-setup-start.service" before reboot. :)

Comment 3 Adam Williamson 2013-09-19 02:48:54 UTC
"p.s.
All these reports seem like the same problem:"

then maybe close your bug as a dupe of one of them? :)

Comment 4 poma 2013-09-19 10:11:53 UTC
> then maybe close your bug as a dupe of one of them? :)

Meanwhile versions have changed, so the details aren't identical.
That's why I prefer to leave it to the maintainer to decide.
Yabba dabba doo! :)

Comment 5 Lennart Poettering 2013-09-29 18:05:27 UTC
*** Bug 1000786 has been marked as a duplicate of this bug. ***

Comment 6 Lennart Poettering 2013-09-29 18:07:54 UTC
Hmm, if you run /usr/lib/systemd/systemd-vconsole-setup manually from a console shell, do things work then?

Comment 7 Lennart Poettering 2013-09-29 18:08:37 UTC
*** Bug 975238 has been marked as a duplicate of this bug. ***

Comment 8 Lennart Poettering 2013-09-29 18:09:52 UTC
*** Bug 963202 has been marked as a duplicate of this bug. ***

Comment 9 Lennart Poettering 2013-09-29 18:14:11 UTC
Also, if this happens, what's the precise contents of /proc/cmdline?

(background: the kernel command line setting always overrides system config, hence you can use localectl as many times as you wish to set the locale settings, as long as something is specified in /proc/cmdline to override it it is ignored...)

Comment 10 Lennart Poettering 2013-09-29 18:16:43 UTC
Also, I have the vague suspicion that systemd-vconsole-setup is invoked only in the initrd where some keymaps/fonts might be missing and then not refreshed in the real system...

Comment 11 Lennart Poettering 2013-09-29 18:17:01 UTC
*** Bug 983758 has been marked as a duplicate of this bug. ***

Comment 12 Adam Williamson 2013-10-01 07:34:41 UTC
Lennart: from my somewhat, ahem, less cryptic 'dupe' report:

"If you run 'systemctl restart systemd-vconsole-setup.service' , the correct keymap is loaded."

Comment 13 drago01 2013-10-01 07:53:16 UTC
(In reply to Adam Williamson from comment #12)
> Lennart: from my somewhat, ahem, less cryptic 'dupe' report:
> 
> "If you run 'systemctl restart systemd-vconsole-setup.service' , the correct
> keymap is loaded."

This confirms what said in comment 10 (i.e it is run to early). 

Lennart is there a way to specify that a service should run *after* switching to the real root?

Comment 14 Adam Williamson 2013-10-01 20:06:21 UTC
*** Bug 1014310 has been marked as a duplicate of this bug. ***

Comment 15 poma 2013-10-02 08:24:15 UTC
(In reply to Lennart Poettering from comment #6)
> Hmm, if you run /usr/lib/systemd/systemd-vconsole-setup manually from a
> console shell, do things work then?

Through the "localectl" or directly in this way, both works.
However point of this story is to engage locale settings after reboot.

Comment 16 poma 2013-10-02 08:45:18 UTC
(In reply to Lennart Poettering from comment #9)
> Also, if this happens, what's the precise contents of /proc/cmdline?
> 
> (background: the kernel command line setting always overrides system config,
> hence you can use localectl as many times as you wish to set the locale
> settings, as long as something is specified in /proc/cmdline to override it
> it is ignored...)

We know this already, and not just from the "man 5 locale.conf", 
"… Note that the kernel command line options locale.… may be used to override the locale settings at boot. …" :)

$ cat /proc/cmdline 
root=UUID=cc995be2-84dd-4a7e-ad2e-2b5ce3ae58eb  initrd=/initramfs-3.12.0-0.rc3.git0.1.fc21.i686+PAE.img BOOT_IMAGE=/vmlinuz-3.12.0-0.rc3.git0.1.fc21.i686+PAE

$ cat /boot/extlinux/extlinux.conf
ui menu.c32
menu title Fedora 21 Boot Options.
timeout 50

label Fedora (3.12.0-0.rc3.git0.1.fc21.i686+PAE) 21 (Rawhide)
	kernel /vmlinuz-3.12.0-0.rc3.git0.1.fc21.i686+PAE
	append root=UUID=cc995be2-84dd-4a7e-ad2e-2b5ce3ae58eb 
	initrd /initramfs-3.12.0-0.rc3.git0.1.fc21.i686+PAE.img
…

The very essence of this endeavor is to relieve the kernel command line, i.e. not to lock the settings within.

Comment 17 poma 2013-10-02 09:00:41 UTC
(In reply to Lennart Poettering from comment #10)
> Also, I have the vague suspicion that systemd-vconsole-setup is invoked only
> in the initrd where some keymaps/fonts might be missing and then not
> refreshed in the real system...

Dunno is it related, 

$ cat /etc/dracut.conf.d/omit-i18n-dracut-module.conf 
# dracut modules to omit
omit_dracutmodules+=" i18n "

# dracut -v -N -f
Executing: /sbin/dracut -v -N -f
dracut module 'i18n' will not be installed, because it's in the list to be omitted!
…

also has no effect on the outcome.

Comment 18 Adam Williamson 2013-10-02 12:24:21 UTC
I think we're pretty clear on what's going on here now (per c#13), but just for the record, I happened to spot this while going through journalctl for unrelated reasons this morning:

Oct 02 13:39:56 vaioz.happyassassin.net systemd[1]: Starting Local File Systems.
Oct 02 13:39:56 vaioz.happyassassin.net systemd[1]: Reached target Local File Systems.
Oct 02 13:39:56 vaioz.happyassassin.net systemd[1]: Started Create list of required static device nodes for the current kernel.
Oct 02 13:39:56 vaioz.happyassassin.net systemd[1]: Starting Create static device nodes in /dev...
Oct 02 13:39:56 vaioz.happyassassin.net dracut-cmdline[97]: dracut-20 (Heisenbug) dracut-033-3.git20130913.fc20
Oct 02 13:39:56 vaioz.happyassassin.net systemd-vconsole-setup[101]: Cannot open font file True
Oct 02 13:39:56 vaioz.happyassassin.net systemd[1]: Started Create static device nodes in /dev.
Oct 02 13:39:56 vaioz.happyassassin.net systemd-vconsole-setup[101]: /usr/bin/setfont failed with error code 66.
Oct 02 13:39:56 vaioz.happyassassin.net systemd[1]: Started Setup Virtual Console.
Oct 02 13:39:56 vaioz.happyassassin.net systemd[1]: Started dracut cmdline hook.
Oct 02 13:39:56 vaioz.happyassassin.net systemd[1]: Starting dracut pre-udev hook...
Oct 02 13:39:56 vaioz.happyassassin.net systemd[1]: Started dracut pre-udev hook.
Oct 02 13:39:56 vaioz.happyassassin.net systemd[1]: Starting udev Kernel Device Manager...

You can indeed see that a) it's getting started very early (I think we are in dracut, there) and b) it's failing.

Comment 19 Marko Myllynen 2013-10-02 14:00:40 UTC
>> Also, if this happens, what's the precise contents of /proc/cmdline?
>> 
>> (background: the kernel command line setting always overrides system config,
>> hence you can use localectl as many times as you wish to set the locale
>> settings, as long as something is specified in /proc/cmdline to override it
>> it is ignored...)
> 
> Oct 02 13:39:56 vaioz.happyassassin.net systemd-vconsole-setup[101]: Cannot
> open font file True
> Oct 02 13:39:56 vaioz.happyassassin.net systemd-vconsole-setup[101]: 
> /usr/bin/setfont failed with error code 66.

FWIW, I installed F20 using the default English (US) for language and Finnish for keyboard, then after booting I only changed LANG in /etc/locale.conf from en_US.UTF-8 to es_ES.utf8 and now after rebooting I have:

/proc/cmdline:
... vconsole.font=latarcyrheb-sun16 vconsole.keymap=fi-latin1 LANG=en_US.UTF-8 ...

initramfs/etc/locale.conf:
LC_ALL="C"
LANG="en_US.UTF-8"

initramfs/etc/vconsole.conf:
KEYMAP="fi-latin1"
UNICODE="1"
FONT="latarcyrheb-sun16"

/etc/locale.conf:
LANG=es_ES.utf8

/etc/vconsole.conf:
KEYMAP="fi-latin1"
FONT="latarcyrheb-sun16"

The end result at console being US keymap in use and Spanish used as language but no above errors in logs - initramfs contains /usr/lib/kbd/consolefonts/latarcyrheb-sun16.psfu and /usr/lib/kbd/keymaps/legacy/i386/qwerty/fi-latin1.map (but note that "loadkeys fi-latin1" on console uses /lib/kbd/keymaps/i386/qwerty/fi-latin1.map.gz).

Comment 20 Lennart Poettering 2013-10-02 14:22:33 UTC
hmm, so Harald, what's the plan here? If vconsole-setup is run in dracut we probably should also include the fonts and things in dracut. Or if it is run in the host OS, then dracut shouldn't run it?

Comment 21 poma 2013-10-04 05:26:33 UTC
Y'all pulled a good conclusion.
This one IS related, and the problem is solved within,

/etc/dracut.conf.d/omit_dracut-module-systemd.conf 
# dracut modules to omit
omit_dracutmodules+=" systemd "

# dracut -v -f
Executing: /sbin/dracut -v -f
dracut module 'systemd' will not be installed, because it's in the list to be omitted!
…

Tested with:
systemd-208-1.fc21.x86_64/i686
dracut-033-3.git20130913.fc21.x86_64/i686

Comment 22 poma 2013-10-05 01:22:04 UTC
Created attachment 807992 [details]
Attachment described briefly.

Comment 24 poma 2013-10-08 03:11:33 UTC
Created attachment 809056 [details]
As usual, attachment described briefly.

Comment 25 poma 2013-10-08 03:13:20 UTC
- F18 doesn't have this problem
- F19/20/21 after applying 'gtf2oh' patch, vconsole-setup.servo is reborn.

Comment 26 poma 2013-10-08 03:18:17 UTC
Feel free to reopen.
Godspeed.

Comment 27 Adam Williamson 2013-10-08 19:12:20 UTC
Why are you closing this if you had to apply a patch to fix it? It'll still be broken for anyone who doesn't manually apply a patch.

Comment 28 Adel Gadllah 2013-10-08 19:17:56 UTC
(In reply to poma from comment #26)
> Feel free to reopen.
> Godspeed.

WTF?

Comment 29 Harald Hoyer 2013-10-15 09:19:45 UTC
(In reply to poma from comment #23)
> I think this commit is causing all the trouble.
> http://cgit.freedesktop.org/plymouth/commit/scripts/plymouth-populate-initrd.
> in?id=8be792a5a7914f742f188493df37c0e967f8e847

Well, this turns off plymouth in the initramfs.

It would show that, if plymouth is running, systemd-vconsole-setup can't set anything, because plymouth is keeping the terminal busy.

Comment 30 Marko Myllynen 2013-10-22 07:11:32 UTC
Fedora 20 Alpha installed yesterday and updated today (incl. kernel) seems to work fine for me now.

Comment 31 Christian Stadelmann 2013-10-25 11:33:17 UTC
Running Fedora 20 Alpha (fedup from F19 ~5 days ago; updated today) on 2 machines. In both cases this bug is still present.

On one machine:
$ localectl 
   System Locale: LANG=de_DE.UTF-8
       VC Keymap: de-neo
      X11 Layout: de,de,us
     X11 Variant: neo,,
     X11 Options: grp:sclk_toggle

on the other one:
$ localectl 
   System Locale: LANG=de_DE.UTF-8
       VC Keymap: de-neo
      X11 Layout: de,de,us
     X11 Variant: neo,,

in both cases:
$ cat /etc/vconsole.conf 
KEYMAP="de-neo"
FONT="latarcyrheb-sun16"

even adding "vconsole.keymap=de-neo" to kernel cmdline does not change the keyboard layout. Only workaround is using the default (de) layout for cryptsetup password prompt and tty login and then running
$ loadkeys de-neo
which works fine.
There are no log entries related to 'vconsole', 'de-neo', 'kbd', 'xkb' or 'keyboard'.

Comment 32 Adam Williamson 2013-10-25 17:05:55 UTC
It's always going to happen with the Alpha package set, but as of Beta it may be fixed; at least, doing a clean install with Beta TC5 using a non-US layout to enter an encryption password, the correct non-US layout is used to decrypt the partition at boot time.

Comment 33 MERCIER Jonathan 2013-10-28 23:13:46 UTC
from F20 i think i have same problem
I have a bépo kyboard then i do:
- localectl set-locale LANG=fr_FR.utf
- localectl set-keymap --no-convert fr-bepo

#  cat /etc/vconsole.conf
KEYMAP=fr-bepo
FONT=lat9-16

my gnome environnement and terminal works fine with my bépo keyboard but not for tty

tty load a qwerty keymap

I see this error message

#  journalctl -b | grep loadkey
oct. 28 23:33:21 localhost.localdomain systemd-vconsole-setup[125]: /usr/bin/loadkeys failed with error code 1.

any help to fix it are welcome

Comment 34 Christian Stadelmann 2013-10-31 08:45:25 UTC
@Adam Williamson: You are right, works fine for me now.
At every stage from boot (asking for HDD pw; ttys at login; ttys after login (default); gdm; …) the keyboard layout is now set correctly on F20. Adding vconsole.keymap to kernel cmdline overrides this behavior as expected.

@MERCIER Jonathan:
What does running
$ loadkeys fr-bepo
do? Seems like systemd-vconsole-setup failed to execute that program.

Comment 35 poma 2014-02-02 14:00:24 UTC
(In reply to Harald Hoyer from comment #29)
> (In reply to poma from comment #23)
> > I think this commit is causing all the trouble.
> > http://cgit.freedesktop.org/plymouth/commit/scripts/plymouth-populate-initrd.
> > in?id=8be792a5a7914f742f188493df37c0e967f8e847
> 
> Well, this turns off plymouth in the initramfs.
> 
> It would show that, if plymouth is running, systemd-vconsole-setup can't set
> anything, because plymouth is keeping the terminal busy.

Round and around and around and around we go
Oh now, tell me now, tell me now, tell me now you know.

Ooh, ooh, ooh, the reason I hold on
Ooh, ooh, ooh, 'cause I need this hole gone
Funny you're the broken one but I'm the only one who needed saving
'Cause when you never see the light it's hard to know which one of us is caving.

Comment 36 Adam Williamson 2014-02-02 16:53:37 UTC
poma: can you please stop posting stuff like that? I've been holding off from asking you since I figured you might work it out yourself, but it's not cute and it's not clever and it's not helping anyone. This is a bug tracker, a place where we come to fix bugs. If what you're posting is not helping to fix a bug, please leave it out.

This applies to devel@ and so on as well. These little gnomic things you post are just distracting and polluting the discussion spaces. I don't mean to be mean, but please, can you just keep it to productive stuff? Thanks.

Comment 37 poma 2014-02-03 01:16:46 UTC
How do I remove my bugzilla.redhat account?

Comment 38 Red Hat Bugzilla 2023-09-14 01:49:43 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days