A listing of random software, tips, tweaks, hacks, and tutorials I made for Ubuntu
How to fix lockdown error -5 on usbmuxd
April 19, 2016Posted by on
When I plug my iPhone in (iOS 9),
usbmuxd (and hence libimobiledevice-related software) runs just fine, but when I plug my older iPad in (iOS 5), I get this error:
[18:51:51.199] Connected to v2.0 device 1 on location 0x20009 with serial number ("random" string of numbers) [18:51:51.867] preflight_worker_handle_device_add: ERROR StartSession failed on device (same "random" string of numbers), lockdown error -5
I spent quite a long time trying to fix this issue. I tracked down this file, that contains this line:
LOCKDOWN_E_SSL_ERROR = -5
So it’s an SSL-related issue, and it happens with an older device, and not a newer one … figured it might be the certificates, and, since I haven’t connected my iPad to the internet for a while, decided to give that a shot. Same issue. But hey, it was fun being able to use Cydia! (at the time of writing, there is no public jailbreak for iOS >=9.2)
After a while of playing with certificates on my host computer (with the same luck), I decided to try compiling both libimobiledevice and usbmuxd with debug flags.
Right off the bat, I got my first (and only) compiler error:
undefined reference to 'SSLv3_method' (or something like that).
Turns out that OpenSSL disables SSLv3 by default, for security reasons. After changing
SSLv23_method (as per this patch) and enabling debug flags, I found that, indeed, the problem relied exactly where the compiler error was:
19:11:34 idevice.c:722 idevice_connection_enable_ssl(): ERROR in SSL_do_handshake: SSL_ERROR_SSL
Thankfully, libimobiledevice contains support for GnuTLS, which, also thankfully, still supports SSLv3! Although there were a few compiler errors because I’m guessing nobody really used the GnuTLS backend for some time, once it was built, I finally managed to make usbmuxd (and libimobiledevice-using software) recognize my iPad!
EDIT: libimobiledevice fixed the compiler errors upstream.
So, if you encounter this error, here’s how you fix it:
git clone https://github.com/libimobiledevice/libimobiledevice.git cd libimobiledevice ./autogen.sh ./configure.sh --prefix=/usr --disable-openssl make sudo make install
I hope this can help someone else with this issue! If you have any problems, feel free to leave a comment and I’ll try my best to help!