Keyboard layout in TTY changed after fresh boot [Solved]

If you are new to Linux or new to Sabayon Linux and just not sure where to post, here ya go. Post without fear of being told to RTFM :-)

Moderator: Moderators

Keyboard layout in TTY changed after fresh boot [Solved]

Postby Honeyman » Tue Jul 16, 2013 23:18

I had to realize that when switching to TTY1-6 for system maintenance say, the keyboard layout has changed from German to US English (already before logging in as user or root in a TTY terminal). Strangely the keyboard layout on the graphical desktop has stayed the same, thus is correct. The graphical login to my MATE desktop also uses the German keymap. The 'locale' is set to EN_us, but it was set this way before and I still had a German keyboard. I know from my experiences with Debian, where I had pretty much the same issue, that a slow and dirty workaround is to create an init-script which manually loads the correct keymap at boot time. Is there a more elegant way to solve this? Let me know, if more information is needed.
Last edited by Honeyman on Tue Jul 23, 2013 11:58, edited 1 time in total.
Je me regarde pour me désoler,
je me compare pour me consoler

Maurice de Talleyrand
Honeyman
Growing Hen
 
Posts: 159
Joined: Sun Apr 08, 2012 2:25
Location: Berlin, Germany

Re: Keyboard layout in TTY changed after fresh boot

Postby Fitzcarraldo » Wed Jul 17, 2013 11:20

If you're using OpenRC, make sure /etc/conf.d/keymaps has keymap="de" (this is for the console). If you're using systemd then I believe the file to edit would be /etc/vconsole.conf, although I don't use systemd so you'll have to check.
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7981
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Re: Keyboard layout in TTY changed after fresh boot

Postby Honeyman » Wed Jul 17, 2013 12:26

I'm using systemd, but there is no file /etc/vconsole.conf, unfortunately. I checked /etc/conf.d/keymaps where the keymap is set correctly (although I do not use OpenRC). Then I checked all *.conf files in /etc/systemd but there was no mention of keymap settings, only the number of virtual terminals was defined in /etc/systemd/logind.conf.

Searching for 'console' in file names on my system brought up only two matches (/etc/init.d/consolefont
& /etc/conf.d/consolefont) which both handle fonts but not keymaps on tty. The file /etc/init.d/keymaps reads the file /etc/conf.d/keymaps but that one is set correctly as I said.

I guess I will have to search for the place systemd configures the keymap to be used in tty.
Je me regarde pour me désoler,
je me compare pour me consoler

Maurice de Talleyrand
Honeyman
Growing Hen
 
Posts: 159
Joined: Sun Apr 08, 2012 2:25
Location: Berlin, Germany

Re: Keyboard layout in TTY changed after fresh boot

Postby Fitzcarraldo » Wed Jul 17, 2013 12:35

I suggest you create the file, then. See: https://wiki.gentoo.org/wiki/Systemd for details. Notice on that Wiki page that the systemd service that reads the vconsole.conf file is named systemd-vconsole-setup.service. Do you have that service running? If not, launch it and add it to the systemd services to be started.
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7981
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom


Re: Keyboard layout in TTY changed after fresh boot

Postby Honeyman » Thu Jul 18, 2013 11:11

Thanks a lot Fitzcarraldo for providing the links. Looks like there is a lot for me to read, so it may take a while before I can either report success or need to request some more help here. :wink:
Je me regarde pour me désoler,
je me compare pour me consoler

Maurice de Talleyrand
Honeyman
Growing Hen
 
Posts: 159
Joined: Sun Apr 08, 2012 2:25
Location: Berlin, Germany

Re: Keyboard layout in TTY changed after fresh boot

Postby Honeyman » Tue Jul 23, 2013 11:58

Thanks Faitzcarraldo, I got it fixed by creating that /etc/vconsole.conf file. The corresponding systemd service "systemd-vconsole-setup.service" was running but as the configuration file in question was not present there was nothing to read and I assume it fell back to default settings.

I realized that there is also an issue with my locale settings when using the terminal
Code: Select all
invalid filesystem encoding ANSI_X3.4-1968, must be UTF-8.
Make sure to set LC_ALL, LANG, LANGUAGE to valid UTF-8 values


I guess it also has to do with systemd so I should find a solution as to why the locale settings are not loaded on boot-up but have to be set manually each and every time.
Je me regarde pour me désoler,
je me compare pour me consoler

Maurice de Talleyrand
Honeyman
Growing Hen
 
Posts: 159
Joined: Sun Apr 08, 2012 2:25
Location: Berlin, Germany

Re: Keyboard layout in TTY changed after fresh boot [Solved]

Postby Fitzcarraldo » Wed Jul 24, 2013 1:51

Once the configuration file for the console keymap is correct, try the following:

Add the following to /etc/X11/xorg.conf:

Code: Select all
Section "InputClass"
    Identifier             "Keyboard Defaults"
    MatchIsKeyboard        "yes"
    Option                 "XkbLayout" "de"
EndSection

Edit the file /etc/env.d/02locale and make it:

Code: Select all
LANG="de_DE.UTF-8"
LANGUAGE="de_DE.UTF-8"
LC_ALL="de_DE.UTF-8"

then update the environment:

Code: Select all
env-update && source /etc/profile

Edit the file /etc/locale.gen and make it the following (you can just comment out the other locales rather than deleting them if you want):

Code: Select all
de_DE ISO-8859-1
de_DE.UTF-8 UTF-8

Enter the command:

Code: Select all
locale-gen

If you're using KDE, make sure you have selected German and the German keyboard layout via, respectively, Kickoff > System Settings > Locale | Languages | Preferred Languages and Kickoff > System Settings > Input Devices > Keyboard | Layouts | Add Layout.

P.S. You need to add "[Solved]" at the end of the Subject, not at the beginning. I've fixed it for you.
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7981
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Re: Keyboard layout in TTY changed after fresh boot [Solved]

Postby Honeyman » Wed Jul 24, 2013 10:41

Fitzcarraldo wrote:
P.S. You need to add "[Solved]" at the end of the Subject, not at the beginning. I've fixed it for you.



Thanks for the help and I apologize for putting the [Solved] tag at the beginning of the subject. Some other forums do that and I did not pay enough attention to the fact that here it is done differently.
Je me regarde pour me désoler,
je me compare pour me consoler

Maurice de Talleyrand
Honeyman
Growing Hen
 
Posts: 159
Joined: Sun Apr 08, 2012 2:25
Location: Berlin, Germany

Re: Keyboard layout in TTY changed after fresh boot [Solved]

Postby Honeyman » Fri Jul 26, 2013 1:21

Hi Fitzcarraldo

I followed your instructions in fixing the locale issue step by step, but I'm not sure whether that has worked as intended.

Before starting with your instructions I had issued the following both as regular user and ROOT:

Code: Select all
[email protected]:~$ export LC_ALL="de_DE.UTF8"
[email protected]:~$ locale
LANG=C
LC_CTYPE="de_DE.UTF8"
LC_NUMERIC="de_DE.UTF8"
LC_TIME="de_DE.UTF8"
LC_COLLATE="de_DE.UTF8"
LC_MONETARY="de_DE.UTF8"
LC_MESSAGES="de_DE.UTF8"
LC_PAPER="de_DE.UTF8"
LC_NAME="de_DE.UTF8"
LC_ADDRESS="de_DE.UTF8"
LC_TELEPHONE="de_DE.UTF8"
LC_MEASUREMENT="de_DE.UTF8"
LC_IDENTIFICATION="de_DE.UTF8"
LC_ALL=de_DE.UTF8


Code: Select all
[email protected]:~# export LC_ALL="de_DE.UTF8"
[email protected]:~# locale
LANG=C
LC_CTYPE="de_DE.UTF8"
LC_NUMERIC="de_DE.UTF8"
LC_TIME="de_DE.UTF8"
LC_COLLATE="de_DE.UTF8"
LC_MONETARY="de_DE.UTF8"
LC_MESSAGES="de_DE.UTF8"
LC_PAPER="de_DE.UTF8"
LC_NAME="de_DE.UTF8"
LC_ADDRESS="de_DE.UTF8"
LC_TELEPHONE="de_DE.UTF8"
LC_MEASUREMENT="de_DE.UTF8"
LC_IDENTIFICATION="de_DE.UTF8"
LC_ALL=de_DE.UTF8


Did that in order to make the irritating warning message about locale settings go away in the terminal. Then I did what you had advised and finally checked the locale settings:

As ROOT:
Code: Select all
[email protected]:~# locale-gen
 * Generating 2 locales (this might take a while) with 1 jobs
 *  (1/2) Generating de_DE.UTF-8 ... [ ok ]
 *  (2/2) Generating de_DE.ISO-8859-1 ... [ ok ]
 * Generation complete
[email protected]:~# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8


Does that look right?

As regular user:
Code: Select all
[email protected]:~$ locale
LANG=C
LC_CTYPE="de_DE.UTF8"
LC_NUMERIC="de_DE.UTF8"
LC_TIME="de_DE.UTF8"
LC_COLLATE="de_DE.UTF8"
LC_MONETARY="de_DE.UTF8"
LC_MESSAGES="de_DE.UTF8"
LC_PAPER="de_DE.UTF8"
LC_NAME="de_DE.UTF8"
LC_ADDRESS="de_DE.UTF8"
LC_TELEPHONE="de_DE.UTF8"
LC_MEASUREMENT="de_DE.UTF8"
LC_IDENTIFICATION="de_DE.UTF8"
LC_ALL=de_DE.UTF8


I rebooted and when switching to ROOT the following output was shown:

Code: Select all
[email protected]:~$ su -
Password:
-su: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
[email protected]:~# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
Je me regarde pour me désoler,
je me compare pour me consoler

Maurice de Talleyrand
Honeyman
Growing Hen
 
Posts: 159
Joined: Sun Apr 08, 2012 2:25
Location: Berlin, Germany

Next

Return to Beginners|Newbies Area

Who is online

Users browsing this forum: No registered users and 3 guests