xenial preseed cannot set keyboard layout

Bug #1553147 reported by Schlomo Schapiro
36
This bug affects 7 people
Affects Status Importance Assigned to Milestone
debian-installer
New
Undecided
Unassigned
console-setup (Ubuntu)
Fix Released
Medium
Mathieu Trudel-Lapierre

Bug Description

Using network booted preseed with the following lines to configure keyboard layout:

d-i console-setup/ask_detect false
d-i keyboard-configuration/layoutcode string de
d-i keyboard-configuration/layout select German
d-i keyboard-configuration/modelcode string pc105

System comes up with US keyboard only (see screenshot).

Content of /etc/default/keyboard:
XKBMODEL="pc105"
XKBLAYOUT=""
XKBVARIANT=""
XKBOPTIONS=""
BACKSPACE="guess"

Content of /etc/default/console-setup:
ACTIVE_CONSOLES="/dev/tty[1-6]"
CHARMAP="UTF-8"
CODESET="guess"
FONTFACE="Fixed"
FONTSIZE="8x16"
VIDEOMODE=

The same preseed file works on wily and successfully configures a German keyboard layout.

The full preseed file can be found at https://github.com/jschule/ubuntu/blob/gh-pages/preseed/jts.txt

Please advice how to set German keyboard layout with preseed installation.

Revision history for this message
Schlomo Schapiro (sschapiro) wrote :
Revision history for this message
Mikko Pesari (mpesari) wrote :

Same here, trying to preseed Finnish keyboard layout. On Trusty only this was needed:

d-i keyboard-configuration/layoutcode string fi

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in installation-guide (Ubuntu):
status: New → Confirmed
affects: installation-guide (Ubuntu) → debian-installer (Ubuntu)
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

If this doesn't work, it's more likely to be an issue in console-setup.

affects: debian-installer (Ubuntu) → console-setup (Ubuntu)
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

I used a slightly different test to verify that the keyboard was correctly configured, and it looks like it is:

keyboard-configuration/layoutcode=es (on the command-line) appears to correctly set the keyboard to the es locale.

I'm not familiar enough with all keyboards to know how to properly test them (I mean, hitting a key and verifying that it does the right thing). Could you give me an example for the german and finnish keyboard of some key combination that should write a special character, so I can test them?

Also, have you tried setting the keyboard-configuration/layoutcode value on the command-line? If so, does it make a difference? If it does, this may mean that instead the bug lies in preseed or something specific to the way the keyboard configuration is preseeded.

Thanks!

Changed in console-setup (Ubuntu):
status: Confirmed → Incomplete
assignee: nobody → Mathieu Trudel-Lapierre (mathieu-tl)
importance: Undecided → Medium
Revision history for this message
Mikko Pesari (mpesari) wrote :

Sorry, I'm unable to verify or test for a week, but IIRC setting it as parameter (or using the alias keymap=fi) did actually change the layout in the installer console.

However the changes were not saved in the target system in /etc/default/keyboard as XKBLAYOUT="fi". I also tried setting these items in preseed without success:

{d-i,keyboard-configuration} keyboard-configuration/{layout,layoutcode,xkb-keymap,variant}

Revision history for this message
Schlomo Schapiro (sschapiro) wrote :

Testing the German keyboard: Press the key between T and U and it should be Z and not Y :-)

Revision history for this message
Mikko Pesari (mpesari) wrote :

Works for me now. I have this in the installer parameters:

keymap=fi console-setup/ask_detect=false

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Yeah, I fixed this prior to the release via some other bug and missed circling back to here to close this one too. I expect this works correctly now, could you please confirm?

Changed in console-setup (Ubuntu):
status: Incomplete → Fix Released
catsem (csc03)
no longer affects: debian-installer (Ubuntu)
Revision history for this message
Thomas Dreibholz (dreibh) wrote :

The problem still (or again) exists in at least Ubuntu Trusty, Xenial and Artful. None of these Ubuntu versions show any reaction on trying to set the keyboard layout.

Tried NO:
d-i console-setup/ask_detect false
d-i keyboard-configuration/layoutcode string no
d-i keyboard-configuration/layout select Norwegian
d-i keyboard-configuration/modelcode string pc105

Tried DE:
d-i console-setup/ask_detect false
d-i keyboard-configuration/layoutcode string de
d-i keyboard-configuration/layout select German
d-i keyboard-configuration/modelcode string pc105

The result is always US keyboard layout in /etc/default/keyboard:
XKBMODEL="pc105"
XKBLAYOUT=""
XKBVARIANT=""
XKBOPTIONS=""
BACKSPACE="guess"

Revision history for this message
Thomas Dreibholz (dreibh) wrote :

A work-around to actually setting the keyboard layout (to Norwegian):

d-i preseed/late_command string \
 in-target /bin/sed -i "s/XKBMODEL=\"[a-z]*\"/XKBMODEL=\"pc105\"/g" /etc/default/keyboard ; \
 in-target /bin/sed -i "s/XKBLAYOUT=\"[a-z]*\"/XKBLAYOUT=\"no\"/g" /etc/default/keyboard ; \
 in-target /bin/sed -i "s/XKBVARIANT=\"[a-z]*\"/XKBVARIANT=\"\"/g" /etc/default/keyboard ; \
 in-target /bin/sed -i "s/XKBOPTIONS=\"[a-z]*\"/XKBOPTIONS=\"\"/g" /etc/default/keyboard ; \
 in-target /usr/sbin/dpkg-reconfigure -fnoninteractive keyboard-configuration ; \
 in-target /usr/sbin/update-locale LC_TIME=en_GB.UTF-8 LC_MESSAGES=POSIX

Note, that "/usr/sbin/dpkg-reconfigure -fnoninteractive keyboard-configuration" is necessary to get the new layout configured for X11 as well. Although the documentation says that editing /etc/default/keyboard is fine, X11 will not use the new layout unless "/usr/sbin/dpkg-reconfigure keyboard-configuration" is run.

Finally, "/usr/sbin/update-locale LC_TIME=en_GB.UTF-8" is used to get a 24-hour clock with an en_IE.UTF-8 locale (metric, €, etc., but AM/PM clock). (A European English locale "en_EU.UTF-8" would be a nice feature.)

Needless to say that this work-around is really ugly, and the installer should be fixed to automatically set the proper keyboard layout.

Revision history for this message
Thomas Dreibholz (dreibh) wrote :

The bug still exists in the latest Ubuntu 20.04 Focal Fossa nightlies: setting e.g.
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string de
d-i keyboard-configuration/layout select German
d-i keyboard-configuration/modelcode string pc105
has no effect. The resulting system has US keyboard in /etc/default/keyboard:
XKBMODEL="pc105"
XKBLAYOUT=""
XKBVARIANT=""
XKBOPTIONS=""
BACKSPACE="guess"

Revision history for this message
Thomas Dreibholz (dreibh) wrote :

This is the Ubuntu 20.04 preseed file I used for testing.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.