Skip to content

ioctl USBDEVFS_SETINTERFACE returns EPROTO when using scdaemon on NixOS #2656

Description

@Lama3L9R

Describe the bug

On NixOS, ioctl USBDEVFS_SETINTERFACE returns EPROTO when using scdaemon with Yubikey smart card. It used to be fine on older versions, but I'm not sure which version specifically broke this. At least on the initial version that has usb passthrough works perfectly.

To Reproduce

  1. Use NixOS 25.11 (arm64) with package gnupg
  2. Connect Yubikey (with smart card configured)
  3. Use orb usb attach <id> to attach the device
  4. Run command gpg-connect-agent 'scd serialno' /bye
  5. Command outputs: ERR 100696144 No such device <SCD>

Expected behavior

Command gpg-connect-agent 'scd serialno' /bye should not produce an error, and gpg --card-status should correctly reads smart card information and can be used for signing.

Diagnostic report (REQUIRED)

OrbStack info:
Version: 2.2.3
Commit: c83556b0ef8f1ba9a33abbb194622b6b7a1c0307 (v2.2.3)

System info:
macOS: 26.5.2 (25F84)
CPU: arm64, 10 cores
CPU model: Apple M4
Model: Mac16,12
Memory: 24 GiB

Full report: https://orbstack.dev/_admin/diag/orbstack-diagreport_2026-08-16T03-03-30.470686Z.zip

Screenshots and additional context (optional)

strace output (with some filters: openat,close,ioctl,read,write,poll,ppoll)

[pid   715] <... read resumed>, "serialno\n", 1002) = 9
[pid   715] write(5</tmp/scdaemon.log>, "2026-08-16 10:55:34 scdaemon[714"..., 39) = 39
[pid   715] write(5</tmp/scdaemon.log>, "chan_9 <- serialno\n", 19) = 19
[pid   715] openat(AT_FDCWD</>, "/sys/bus/usb/devices/usb2/bConfigurationValue", O_RDONLY|O_CLOEXEC) = 15</sys/devices/platform/4000c000.usb/usb2/bConfigurationValue>
[pid   715] read(15</sys/devices/platform/4000c000.usb/usb2/bConfigurationValue>, "1\n", 19) = 2
[pid   715] close(15</sys/devices/platform/4000c000.usb/usb2/bConfigurationValue>) = 0
[pid   715] openat(AT_FDCWD</>, "/sys/bus/usb/devices/usb2/bConfigurationValue", O_RDONLY|O_CLOEXEC) = 15</sys/devices/platform/4000c000.usb/usb2/bConfigurationValue>
[pid   715] read(15</sys/devices/platform/4000c000.usb/usb2/bConfigurationValue>, "1\n", 19) = 2
[pid   715] close(15</sys/devices/platform/4000c000.usb/usb2/bConfigurationValue>) = 0
[pid   715] openat(AT_FDCWD</>, "/sys/bus/usb/devices/1-1/bConfigurationValue", O_RDONLY|O_CLOEXEC) = 15</sys/devices/platform/4000c000.usb/usb1/1-1/bConfigurationValue>
[pid   715] read(15</sys/devices/platform/4000c000.usb/usb1/1-1/bConfigurationValue>, "1\n", 19) = 2
[pid   715] close(15</sys/devices/platform/4000c000.usb/usb1/1-1/bConfigurationValue>) = 0
[pid   715] openat(AT_FDCWD</>, "/sys/bus/usb/devices/1-1/bConfigurationValue", O_RDONLY|O_CLOEXEC) = 15</sys/devices/platform/4000c000.usb/usb1/1-1/bConfigurationValue>
[pid   715] read(15</sys/devices/platform/4000c000.usb/usb1/1-1/bConfigurationValue>, "1\n", 19) = 2
[pid   715] close(15</sys/devices/platform/4000c000.usb/usb1/1-1/bConfigurationValue>) = 0
[pid   715] openat(AT_FDCWD</>, "/sys/bus/usb/devices/usb1/bConfigurationValue", O_RDONLY|O_CLOEXEC) = 15</sys/devices/platform/4000c000.usb/usb1/bConfigurationValue>
[pid   715] read(15</sys/devices/platform/4000c000.usb/usb1/bConfigurationValue>, "1\n", 19) = 2
[pid   715] close(15</sys/devices/platform/4000c000.usb/usb1/bConfigurationValue>) = 0
[pid   715] openat(AT_FDCWD</>, "/sys/bus/usb/devices/usb1/bConfigurationValue", O_RDONLY|O_CLOEXEC) = 15</sys/devices/platform/4000c000.usb/usb1/bConfigurationValue>
[pid   715] read(15</sys/devices/platform/4000c000.usb/usb1/bConfigurationValue>, "1\n", 19) = 2
[pid   715] close(15</sys/devices/platform/4000c000.usb/usb1/bConfigurationValue>) = 0
[pid   715] write(5</tmp/scdaemon.log>, "2026-08-16 10:55:34 scdaemon[714"..., 66) = 66
[pid   715] write(5</tmp/scdaemon.log>, "\n", 1) = 1
[pid   715] write(5</tmp/scdaemon.log>, "2026-08-16 10:55:34 scdaemon[714"..., 73) = 73
[pid   715] write(5</tmp/scdaemon.log>, "\n", 1) = 1
[pid   715] openat(AT_FDCWD</>, "/dev/bus/usb/001/004", O_RDWR|O_CLOEXEC) = 15</dev/bus/usb/001/004<char 189:3>>
[pid   715] ioctl(15</dev/bus/usb/001/004<char 189:3>>, USBDEVFS_GET_CAPABILITIES, 0xfb62b400fe74) = 0
[pid   715] openat(AT_FDCWD</>, "/proc/self/task/806/comm", O_RDWRstrace: Process 806 attached
) = 16</proc/714/task/806/comm>
[pid   715] write(16</proc/714/task/806/comm>, "ccid_usb_thread", 15) = 15
[pid   715] close(16</proc/714/task/806/comm>) = 0
[pid   715] ioctl(15</dev/bus/usb/001/004<char 189:3>>, USBDEVFS_DISCONNECT_CLAIM, 0xfb62baffe210) = 0
[pid   806] read(11<{eventfd-count=0x1, eventfd-id=12, eventfd-semaphore=0}> <unfinished ...>
[pid   715] ioctl(15</dev/bus/usb/001/004<char 189:3>>, USBDEVFS_SETINTERFACE, 0xfb62baffe340 <unfinished ...>
[pid   806] <... read resumed>, "\1\0\0\0\0\0\0\0", 8) = 8
[pid   806] ppoll([{fd=11<{eventfd-count=0, eventfd-id=12, eventfd-semaphore=0}>, events=POLLIN}, {fd=12<anon_inode:[timerfd]>, events=POLLIN}, {fd=15</dev/bus/usb/001/004<char 189:3>>, events=POLLOUT}], 3, {tv_sec=60, tv_nsec=0}, NULL, 0 <unfinished ...>
[pid   715] <... ioctl resumed>)        = -1 EPROTO (Protocol error)
[pid   715] ioctl(15</dev/bus/usb/001/004<char 189:3>>, USBDEVFS_RELEASEINTERFACE, 0xfb62baffe314) = 0
[pid   715] ioctl(15</dev/bus/usb/001/004<char 189:3>>, USBDEVFS_IOCTL, 0xfb62baffe2d8) = 0
[pid   715] write(11<{eventfd-count=0, eventfd-id=12, eventfd-semaphore=0}>, "\1\0\0\0\0\0\0\0", 8 <unfinished ...>
[pid   806] <... ppoll resumed>)        = 1 ([{fd=11, revents=POLLIN}], left {tv_sec=59, tv_nsec=998249606})
[pid   715] <... write resumed>)        = 8
[pid   715] close(15</dev/bus/usb/001/004<char 189:3>>) = 0
[pid   806] +++ exited with 0 +++
[pid   715] write(5</tmp/scdaemon.log>, "2026-08-16 10:55:34 scdaemon[714"..., 34) = 34
[pid   715] write(5</tmp/scdaemon.log>, "ccid open error: skip\n", 22) = 22
[pid   715] write(5</tmp/scdaemon.log>, "2026-08-16 10:55:34 scdaemon[714"..., 39) = 39
[pid   715] write(5</tmp/scdaemon.log>, "chan_9 -> ERR 100696144 No such "..., 45) = 45
[pid   715] write(10<pipe:[77265]>, "ERR 100696144 No such device <SC"..., 34) = 34
[pid   715] write(10<pipe:[77265]>, "\n", 1) = 1
[pid   715] read(9<pipe:[77266]>, "RESTART\n", 1002) = 8
[pid   715] write(5</tmp/scdaemon.log>, "2026-08-16 10:55:34 scdaemon[714"..., 39) = 39
[pid   715] write(5</tmp/scdaemon.log>, "chan_9 <- RESTART\n", 18) = 18
[pid   715] write(5</tmp/scdaemon.log>, "2026-08-16 10:55:34 scdaemon[714"..., 39) = 39
[pid   715] write(5</tmp/scdaemon.log>, "chan_9 -> OK\n", 13) = 13
[pid   715] write(10<pipe:[77265]>, "OK", 2) = 2
[pid   715] write(10<pipe:[77265]>, "\n", 1) = 1
[pid   715] read(9<pipe:[77266]>^Cstrace: Process 715 detached

lsusb -t output:

unable to initialize usb spec/:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci-hcd/16p, 480M
    |__ Port 001: Dev 004, If 0, Class=[unknown], Driver=usbhid, 12M
    |__ Port 001: Dev 004, If 1, Class=[unknown], Driver=usbhid, 12M
    |__ Port 001: Dev 004, If 2, Class=[unknown], Driver=[none], 12M
/:  Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci-hcd/15p, 5000M

Metadata

Metadata

Assignees

No one assigned

    Labels

    t/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions