Bug 1151832

Summary: Keyboard shortcuts handling in text virtual consoles is broken with systemd/Fedora 20/RHEL 7
Product: [Fedora] Fedora Reporter: Artem S. Tashkinov <aros>
Component: kbdAssignee: Vitezslav Crhonek <vcrhonek>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 20CC: johannbg, jsynacek, lnykryn, msekleta, s, systemd-maint, vcrhonek, vpavlin, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-26 13:26:30 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:

Description Artem S. Tashkinov 2014-10-12 13:08:21 UTC
Login under VT2-VT6, run mc (Midnight Commander) and try to use the following shortcuts:

Shift + F5 (Copy to ...)
Shift + F6 (Rename to ...)

Under SystemD:

Shift + F5 just doesn't work at all.
Shift + F6 calls the "Delete" dialog.

Version-Release number of selected component (if applicable): systemd-208-22.fc20.x86_64, all mc versions are affected

How reproducible: Always

Additional information: 

/etc/vconsole.conf
KEYMAP="us"
FONT="ter-v20b"

Under X.org terminals (xterm, various other terminals) both these shortcuts work just fine.

Comment 1 Jan Synacek 2014-10-14 06:56:12 UTC
I don't think that this problem is specific to systemd. Quoting  http://www.ibiblio.org/mc/FAQ:

"
2.3 How do I use function keys F11 to F20?

   These are normally mapped to function keys F1 to F10 with Shift held,
   e.g. function key F13 can be activated by pressing Shift-F3.  You can
   define the keys this way in the Options->Learn Keys dialog.  The
   convention for PC keyboards is that F11-20 always means Shift with
   F1-10.

   You may find that on the Linux console with some keyboard layouts
   Shift-Fn is interpreted as F(n+12), not as F(n+10).  This is a result
   of non-uniformity of keyboard layouts.  This is not an intended
   behavior and it may be fixed some day.  In the meantime, use "Learn
   Keys" to remedy this inconvenience.
"

You should be able to use Shift+F3/F4 as Shift+F5/F6.

Please, try the following:
1) infocmp > term.ti
2) edit term.ti and add the following line to the end of the file:
   kf16=\E[29~,
3) tic term.ti
4) see if Shift+F6 works in mc.

I'm not sure if this can be fixed in the systemd source, so I'll leave this bug open for now.

Comment 2 Artem S. Tashkinov 2014-10-14 07:49:18 UTC
This problem IS systemd specific for its be all end all nature (it loads keyboard maps as well).

Without systemd (i.e. init=/bin/bash) this problem GOES AWAY.

I will try this solution if Lennart decides this bug is WONTFIX as he usually does.

Comment 3 Lennart Poettering 2015-01-08 01:20:35 UTC
systemd is not involved with actually apply console keymaps, we just invoke "loadkeys" for that. If the mappings aren't right this is probably a bug in loadkeys or its key mappings. Reassigning.

(In reply to Artem S. Tashkinov from comment #2)
> This problem IS systemd specific for its be all end all nature (it loads
> keyboard maps as well).
> 
> Without systemd (i.e. init=/bin/bash) this problem GOES AWAY.
> 
> I will try this solution if Lennart decides this bug is WONTFIX as he
> usually does.

This is usually the attitude that guarantees the best, timeliest responses from maintainers.

Comment 4 Vitezslav Crhonek 2015-01-08 11:53:02 UTC
Hi Artem, please see:
/lib/kbd/keymaps/legacy/i386/include/linux-keys-bare.inc

This mapping is included in "us" keymap you use (and probably in the majority of console keymaps). What's inside...:

...
# Old keyboards have 10 function keys, and keymaps have
# sometimes used shift+F1 = F11, and sometimes shift+F1 = F13.
# Here we assume an enhanced keyboard (with 12 function keys).
...
plain keycode  61 = F3
plain keycode  63 = F5
...
shift keycode  61 = F15
shift keycode  63 = F17

In other words, you need to press Shift+F3 on the console to get F15, as Jan mentioned in comment #1.

(Well, actually /lib/kbd/keymaps/xkb/us.map.gz is used, not /lib/kbd/keymaps/legacy/i386/qwerty/us.map.gz, but this file is converted from X.org keymaps and it's not very readable... still the mapping is the same:
# gunzip -c /lib/kbd/keymaps/xkb/us.map.gz | grep "F15"
keycode 61 = F3 F15 ...
)

Comment 5 Artem S. Tashkinov 2015-01-08 12:31:46 UTC
Guys, it's nice to have a workaround for the things which JUST USED TO WORK without ANY TINKERING in the past.

In RHEL6/older Fedora releases these keyboard combinations work out of the box. Why should I (re)configure stuff when you intentionally broke the defaults? Can you please stop breaking the things?

It's 100% clear that you radically changed the keymap between RHEL6 and RHEL7. The question is WHY? Who asked you?

I want this bug to be fixed in vanilla RHEL7/upwards and Fedora 21/22/upwards, because it wasn't a bug in the past.

Comment 6 Vitezslav Crhonek 2015-01-08 13:52:30 UTC
What do you mean by older Fedora? Looking into dist-git, this mapping is unchanged for years (e. g. Fedora 11, kbd-1.15) and it's taken from upstream without modification.

$ diff kbd-1.15/data/keymaps/i386/include/linux-keys-bare.inc /lib/kbd/keymaps/legacy/i386/include/linux-keys-bare.inc
$
# gunzip -k /lib/kbd/keymaps/legacy/i386/qwerty/us.map.gz
$ diff kbd-1.15/data/keymaps/i386/qwerty/us.map /lib/kbd/keymaps/legacy/i386/qwerty/us.map
$

No difference.

If you invoke "loadkeys /lib/kbd/keymaps/legacy/i386/qwerty/us.map.gz" (as root), you'll set this particular mapping and it has:
keycode  61 = F3               F15

The problem is probably elsewhere...

> Without systemd (i.e. init=/bin/bash) this problem GOES AWAY.

Could you please send output of "dumpkeys" for that case?