usbmuxd icon indicating copy to clipboard operation
usbmuxd copied to clipboard

udev rules do not match devices in recovery/DFU mode

Open apsun opened this issue 9 months ago • 4 comments

While using idevicerestore I noticed that it would fail with LIBUSB_ERROR_ACCESS unless run as root. It looks like when the device is rebooted into recovery mode, the udev rules no longer match and so the files are not owned by the usbmux user, causing the command to fail.

From lsusb:

Recovery mode:

Bus 001 Device 024: ID 05ac:1281 Apple, Inc. Apple Mobile Device [Recovery Mode]

DFU mode:

Bus 001 Device 025: ID 05ac:1227 Apple, Inc. Mobile Device (DFU Mode)

I don't have any other devices to test with, but based on a quick search I found https://devicehunt.com/view/type/usb/vendor/05AC which leads me to believe that the device IDs are the same for all devices in recovery/DFU mode. Would it make sense to add these to https://github.com/libimobiledevice/usbmuxd/blob/master/udev/39-usbmuxd.rules.in?

apsun avatar Sep 29 '23 03:09 apsun

This is handled already here: https://github.com/libimobiledevice/libirecovery/blob/master/udev/39-libirecovery.rules.in

nikias avatar Sep 29 '23 06:09 nikias

Oh I see, sorry I missed that. It seems like the libirecovery udev rule doesn't set OWNER="usbmux", but instead OWNER="root", GROUP="storage" - is that expected?

apsun avatar Sep 29 '23 07:09 apsun

Yes. The device file is not supposed to be used by usbmuxd at all, so it doesn't need usbmux permissions. Instead, the current user (or the user that is supposed to use irecovery/idevicerestore) should be in the storage group. That group is default on ubuntu and debian to my knowledge.

nikias avatar Sep 29 '23 07:09 nikias

Ah, that explains it. I'm running Arch and never added my user to that group. Although it doesn't look like Ubuntu or Debian automatically add that group either nowadays and instead use systemd + uaccess to automatically grant the current user access (that said, I don't have an install on hand to test, and this is all very new to me as well)

apsun avatar Sep 29 '23 08:09 apsun