microsoft / microsoft/WSL

showkey couldn't get a file descriptor referring to the console

Open
#1,806 6 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

showkey doesn't work with --scancodes or --keycodes (default) options. Saying that it

Couldn't get a file descriptor referring to the console

Windows build 14393.953

$ strace showkey
execve("/usr/bin/showkey", ["showkey"], [/* 15 vars */]) = 0
brk(0) = 0x15f4000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1f36840000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=20672, ...}) = 0
mmap(NULL, 20672, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f1f3684a000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\37\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1840928, ...}) = 0
mmap(NULL, 3949248, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f1f36230000
mprotect(0x7f1f363eb000, 2093056, PROT_NONE) = 0
mmap(0x7f1f365ea000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ba000) = 0x7f1f365ea000
mmap(0x7f1f365f0000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f1f365f0000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1f36830000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1f36820000
arch_prctl(ARCH_SET_FS, 0x7f1f36820740) = 0
mprotect(0x7f1f365ea000, 16384, PROT_READ) = 0
mprotect(0x602000, 4096, PROT_READ) = 0
mprotect(0x7f1f36822000, 4096, PROT_READ) = 0
munmap(0x7f1f3684a000, 20672) = 0
brk(0) = 0x15f4000
brk(0x1615000) = 0x1615000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2919792, ...}) = 0
mmap(NULL, 2919792, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f1f35f67000
close(3) = 0
open("/proc/self/fd/0", O_RDWR) = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(3, KDGKBTYPE, 0x7fffe9233c4f) = -1 ENOTTY (Inappropriate ioctl for device)
close(3) = 0
open("/dev/tty", O_RDWR) = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(3, KDGKBTYPE, 0x7fffe9233c4f) = -1 ENOTTY (Inappropriate ioctl for device)
close(3) = 0
open("/dev/tty0", O_RDWR) = -1 EIO (Input/output error)
open("/dev/tty0", O_WRONLY) = -1 EIO (Input/output error)
open("/dev/tty0", O_RDONLY) = -1 EIO (Input/output error)
open("/dev/vc/0", O_RDWR) = -1 ENOENT (No such file or directory)
open("/dev/vc/0", O_WRONLY) = -1 ENOENT (No such file or directory)
open("/dev/vc/0", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/systty", O_RDWR) = -1 ENOENT (No such file or directory)
open("/dev/systty", O_WRONLY) = -1 ENOENT (No such file or directory)
open("/dev/systty", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/console", O_RDWR) = -1 ENOENT (No such file or directory)
open("/dev/console", O_WRONLY) = -1 ENOENT (No such file or directory)
open("/dev/console", O_RDONLY) = -1 ENOENT (No such file or directory)
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, KDGKBTYPE, 0x7fffe9233c4f) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, KDGKBTYPE, 0x7fffe9233c4f) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(2, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(2, KDGKBTYPE, 0x7fffe9233c4f) = -1 ENOTTY (Inappropriate ioctl for device)
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2570, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1f36810000
read(3, "# Locale name alias data base.\n#"..., 512) = 512
read(3, "PURPOSE. See the\n# GNU General "..., 512) = 512
read(3, " entries are case independent.\n\n"..., 512) = 512
read(3, "859-1\nfinnish fi_FI.ISO-"..., 512) = 512
read(3, "R\nko_KR\t\tko_KR.eucKR\nlithuanian "..., 512) = 512
read(3, "SO-8859-9\n", 512) = 10
read(3, "", 512) = 0
close(3) = 0
munmap(0x7f1f36810000, 4096) = 0
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/kbd.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/kbd.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/kbd.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/kbd.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/kbd.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/kbd.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/kbd.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/kbd.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US/LC_MESSAGES/kbd.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/kbd.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.utf8/LC_MESSAGES/kbd.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/kbd.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "Couldn't get a file descriptor r"..., 56Couldn't get a file descriptor referring to the console
) = 56
exit_group(1) = ?
+++ exited with 1 +++

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing showkey with the default, --scancodes, and --keycodes options in the reported WSL environment, then compare the command's strace with the console-device lookup shown in the issue. Trace the WSL console handling involved; done means the affected showkey modes work in the supported environment or the limitation is clearly identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.