yubiswitch-for-linux icon indicating copy to clipboard operation
yubiswitch-for-linux copied to clipboard

'yubiswitch on' does not work on Ubuntu 17.04 (kernel 4.10.0-35-generic)

Open gward opened this issue 8 years ago • 1 comments

yubiswitch off works perfectly: it disables my yubikey, as advertised. But yubiswitch on does not work. The yubikey stays quiet until I unplug it and plug it back in. Then it's fine.

Example, starting with a freshly-plugged-in yubikey:

$ which yubiswitch
/usr/local/bin/yubiswitch

$ ls -l /usr/local/bin/yubiswitch
-rwsr-xr-x 1 root root 18392 Sep 19 11:27 /usr/local/bin/yubiswitch

$ /usr/local/bin/yubiswitch list
Found Yubikey at 1-1.2.2.2:1.2
Yubikey is not bound to usbhid
Found Yubikey at 1-1.2.2.2:1.0
Yubikey is bound to usbhid
Found Yubikey at 1-1.2.2.2:1.1
Yubikey is bound to usbhid

$ /usr/local/bin/yubiswitch debug             
opening /sys/bus/usb/devices/1-1.2.2.2/manufacturer
read Yubico
Found 1-1.2.2.2, iterating over device
Found 1-1.2.2.2:1.2
Found Yubikey at 1-1.2.2.2:1.2
Yubikey is not bound to usbhid
Found 1-1.2.2.2:1.0
Found Yubikey at 1-1.2.2.2:1.0
Yubikey is bound to usbhid
Found 1-1.2.2.2:1.1
Found Yubikey at 1-1.2.2.2:1.1
Yubikey is bound to usbhid
opening /sys/bus/usb/devices/1-1.4:1.1/manufacturer
opening /sys/bus/usb/devices/1-1.2:1.0/manufacturer
opening /sys/bus/usb/devices/1-1.6:1.0/manufacturer
opening /sys/bus/usb/devices/1-1.2.2:1.0/manufacturer
opening /sys/bus/usb/devices/3-2:1.3/manufacturer
opening /sys/bus/usb/devices/2-1:1.0/manufacturer
opening /sys/bus/usb/devices/2-1/manufacturer
opening /sys/bus/usb/devices/3-2:1.1/manufacturer
opening /sys/bus/usb/devices/1-1.3/manufacturer
read Auth
opening /sys/bus/usb/devices/3-0:1.0/manufacturer
opening /sys/bus/usb/devices/1-1.2.2.1:1.0/manufacturer
opening /sys/bus/usb/devices/1-1.2.1:1.1/manufacturer
opening /sys/bus/usb/devices/1-1.3:1.0/manufacturer
opening /sys/bus/usb/devices/1-1.2.1/manufacturer
read Metadot - Das Keyboard
opening /sys/bus/usb/devices/3-2/manufacturer
read Logitech
opening /sys/bus/usb/devices/1-1.2.2.2:1.2/manufacturer
opening /sys/bus/usb/devices/1-1/manufacturer
opening /sys/bus/usb/devices/1-1.4:1.2/manufacturer
opening /sys/bus/usb/devices/1-1.2.2.2:1.0/manufacturer
opening /sys/bus/usb/devices/1-1.6:1.1/manufacturer
opening /sys/bus/usb/devices/1-1.2.2.1/manufacturer
read Logitech
opening /sys/bus/usb/devices/1-0:1.0/manufacturer
opening /sys/bus/usb/devices/1-1.4:1.0/manufacturer
opening /sys/bus/usb/devices/4-0:1.0/manufacturer
opening /sys/bus/usb/devices/1-1.6/manufacturer
read SunplusIT INC.
opening /sys/bus/usb/devices/3-2:1.2/manufacturer
opening /sys/bus/usb/devices/1-1.4/manufacturer
read Broadcom Corp
opening /sys/bus/usb/devices/1-1.2.2/manufacturer
opening /sys/bus/usb/devices/3-2:1.0/manufacturer
opening /sys/bus/usb/devices/1-1.2/manufacturer
read GenesysLogic
opening /sys/bus/usb/devices/1-1:1.0/manufacturer
opening /sys/bus/usb/devices/1-1.2.1:1.0/manufacturer
opening /sys/bus/usb/devices/2-0:1.0/manufacturer
opening /sys/bus/usb/devices/1-1.4:1.3/manufacturer
opening /sys/bus/usb/devices/1-1.2.2.2:1.1/manufacturer

$ /usr/local/bin/yubiswitch off  
Unbinding Yubikey from usbhid driver at 1-1.2.2.2:1.2
Yubikey not bound to usbhid, skipping
Unbinding Yubikey from usbhid driver at 1-1.2.2.2:1.0
Unbinding Yubikey from usbhid driver at 1-1.2.2.2:1.1
[as expected, yubikey no long works]

$ /usr/local/bin/yubiswitch on 
binding Yubikey to usbhid driver at 1-1.2.2.2:1.2
writing bind: No such device
[fail! yubikey still does not work]

Here's what I get from strace'ing that command:

$ sudo strace -tt -f /usr/local/bin/yubiswitch on
11:33:22.632892 execve("/usr/local/bin/yubiswitch", ["/usr/local/bin/yubiswitch", "on"], [/* 26 vars */]) = 0
11:33:22.633639 brk(NULL)               = 0x558948ab9000
11:33:22.633731 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
11:33:22.633899 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f7b8ae47000
11:33:22.634033 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
11:33:22.634157 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
11:33:22.634278 fstat(3, {st_mode=S_IFREG|0644, st_size=120672, ...}) = 0
11:33:22.634411 mmap(NULL, 120672, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f7b8ae29000
11:33:22.634520 close(3)                = 0
11:33:22.634619 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
11:33:22.634744 open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
11:33:22.634860 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\5\2\0\0\0\0\0"..., 832) = 832
11:33:22.634977 fstat(3, {st_mode=S_IFREG|0755, st_size=1856752, ...}) = 0
11:33:22.635130 mmap(NULL, 3959200, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f7b8a85e000
11:33:22.635233 mprotect(0x7f7b8aa1c000, 2093056, PROT_NONE) = 0
11:33:22.635345 mmap(0x7f7b8ac1b000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bd000) = 0x7f7b8ac1b000
11:33:22.635482 mmap(0x7f7b8ac21000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f7b8ac21000
11:33:22.635608 close(3)                = 0
11:33:22.635722 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f7b8ae27000
11:33:22.635826 arch_prctl(ARCH_SET_FS, 0x7f7b8ae27700) = 0
11:33:22.636010 mprotect(0x7f7b8ac1b000, 16384, PROT_READ) = 0
11:33:22.636041 mprotect(0x55894744a000, 4096, PROT_READ) = 0
11:33:22.636069 mprotect(0x7f7b8ae4a000, 4096, PROT_READ) = 0
11:33:22.636096 munmap(0x7f7b8ae29000, 120672) = 0
11:33:22.636145 open("/sys/bus/usb/devices/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
11:33:22.636179 fstat(3, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
11:33:22.636236 brk(NULL)               = 0x558948ab9000
11:33:22.636259 brk(0x558948ae2000)     = 0x558948ae2000
11:33:22.636288 getdents(3, /* 42 entries */, 32768) = 1304
11:33:22.636343 open("/sys/bus/usb/devices/1-1.2.2.2/manufacturer", O_RDONLY) = 4
11:33:22.636382 read(4, "Yubico\n", 128) = 7
11:33:22.636412 close(4)                = 0
11:33:22.636439 open("/sys/bus/usb/devices/1-1.2.2.2", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
11:33:22.636472 fstat(4, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
11:33:22.636506 getdents(4, /* 41 entries */, 32768) = 1368
11:33:22.636548 write(2, "binding Yubikey to usbhid driver"..., 50binding Yubikey to usbhid driver at 1-1.2.2.2:1.2
) = 50
11:33:22.636580 lstat("/sys/bus/usb/drivers/usbhid/1-1.2.2.2:1.2", 0x7ffd37562230) = -1 ENOENT (No such file or directory)
11:33:22.636616 open("/sys/bus/usb/drivers/usbhid/bind", O_WRONLY) = 5
11:33:22.636648 write(5, "1-1.2.2.2:1.2", 13) = -1 ENODEV (No such device)
11:33:22.636691 write(2, "writing bind: No such device\n", 29writing bind: No such device
) = 29
11:33:22.636724 exit_group(1)           = ?
11:33:22.636782 +++ exited with 1 +++

gward avatar Sep 19 '17 15:09 gward

I am experiencing the same issue under Archlinux, after using the build instructions. It appears that it successfully disables the Yubikey. It fails at turning it back on. I have to unplug/replug the device in order to retain normal functionality.

At least I can disable it while using my laptop, for now.

$ yubiswitch list
Found Yubikey at 1-3:1.2
Yubikey is not bound to usbhid
Found Yubikey at 1-3:1.0
Yubikey is bound to usbhid
Found Yubikey at 1-3:1.1
Yubikey is bound to usbhid
$ yubiswitch off
Unbinding Yubikey from usbhid driver at 1-3:1.2
Yubikey not bound to usbhid, skipping
Unbinding Yubikey from usbhid driver at 1-3:1.0
Unbinding Yubikey from usbhid driver at 1-3:1.1
$ sudo strace -tt -f /usr/local/bin/yubiswitch on
15:36:41.728994 execve("/usr/local/bin/yubiswitch", ["/usr/local/bin/yubiswitch", "on"], 0x7ffc0c166c38 /* 18 vars */) = 0
15:36:41.729439 brk(NULL)               = 0x557c07cef000
15:36:41.729501 arch_prctl(0x3001 /* ARCH_??? */, 0x7fff8c7029c0) = -1 EINVAL (Invalid argument)
15:36:41.729598 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
15:36:41.729647 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
15:36:41.729690 fstat(3, {st_mode=S_IFREG|0644, st_size=261455, ...}) = 0
15:36:41.729735 mmap(NULL, 261455, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2af5196000
15:36:41.729774 close(3)                = 0
15:36:41.729823 openat(AT_FDCWD, "/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
15:36:41.729855 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000C\2\0\0\0\0\0"..., 832) = 832
15:36:41.729916 lseek(3, 792, SEEK_SET) = 792
15:36:41.730000 read(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\201\336\t\36\251c\324\233E\371SoK\5H\334"..., 68) = 68
15:36:41.730131 fstat(3, {st_mode=S_IFREG|0755, st_size=2136840, ...}) = 0
15:36:41.730249 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2af5194000
15:36:41.730429 lseek(3, 792, SEEK_SET) = 792
15:36:41.730546 read(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\201\336\t\36\251c\324\233E\371SoK\5H\334"..., 68) = 68
15:36:41.730684 lseek(3, 864, SEEK_SET) = 864
15:36:41.730760 read(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32) = 32
15:36:41.730810 mmap(NULL, 1848896, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2af4fd0000
15:36:41.730928 mprotect(0x7f2af4ff2000, 1671168, PROT_NONE) = 0
15:36:41.731055 mmap(0x7f2af4ff2000, 1355776, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7f2af4ff2000
15:36:41.731179 mmap(0x7f2af513d000, 311296, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16d000) = 0x7f2af513d000
15:36:41.731247 mmap(0x7f2af518a000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b9000) = 0x7f2af518a000
15:36:41.731287 mmap(0x7f2af5190000, 13888, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2af5190000
15:36:41.731371 close(3)                = 0
15:36:41.731458 arch_prctl(ARCH_SET_FS, 0x7f2af5195500) = 0
15:36:41.731571 mprotect(0x7f2af518a000, 16384, PROT_READ) = 0
15:36:41.731600 mprotect(0x557c06acf000, 4096, PROT_READ) = 0
15:36:41.731627 mprotect(0x7f2af51ff000, 4096, PROT_READ) = 0
15:36:41.731666 munmap(0x7f2af5196000, 261455) = 0
15:36:41.731728 openat(AT_FDCWD, "/sys/bus/usb/devices/", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
15:36:41.731806 fstat(3, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
15:36:41.731869 brk(NULL)               = 0x557c07cef000
15:36:41.731899 brk(0x557c07d10000)     = 0x557c07d10000
15:36:41.732040 getdents64(3, /* 13 entries */, 32768) = 368
15:36:41.732275 openat(AT_FDCWD, "/sys/bus/usb/devices/1-3:1.2/manufacturer", O_RDONLY) = -1 ENOENT (No such file or directory)
15:36:41.732416 openat(AT_FDCWD, "/sys/bus/usb/devices/1-3/manufacturer", O_RDONLY) = 4
15:36:41.732465 read(4, "Yubico\n", 128) = 7
15:36:41.732536 close(4)                = 0
15:36:41.732569 openat(AT_FDCWD, "/sys/bus/usb/devices/1-3", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
15:36:41.732619 fstat(4, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
15:36:41.732646 getdents64(4, /* 43 entries */, 32768) = 1408
15:36:41.732692 write(2, "binding Yubikey to usbhid driver"..., 44binding Yubikey to usbhid driver at 1-3:1.2
) = 44
15:36:41.732746 lstat("/sys/bus/usb/drivers/usbhid/1-3:1.2", 0x7fff8c702700) = -1 ENOENT (No such file or directory)
15:36:41.732778 openat(AT_FDCWD, "/sys/bus/usb/drivers/usbhid/bind", O_WRONLY) = 5
15:36:41.732823 write(5, "1-3:1.2", 7)  = -1 ENODEV (No such device)
15:36:41.732861 write(2, "writing bind: No such device\n", 29writing bind: No such device
) = 29
15:36:41.732928 exit_group(1)           = ?
15:36:41.733078 +++ exited with 1 +++

patrickathompson avatar Mar 15 '19 20:03 patrickathompson