Open fosple opened 4 years ago
Firstly, I wanted to find my iPhone with the idevice_id -n
command inside a docker container.
I installed libimobiledevice with usbmuxd2 in my container. However, I couldn't find my iPhone.
So, I installed it directly on my PC and it worked.
Then, I tried again with my docker container. This time, it worked because the usbmuxd2 service was running on my PC. If I stop the service on my PC, I can't find my iPhone with the idevice_id -n
command in my container.
libusbmuxd (and tools build on top of it, which includes ideviceid) connect to usbmuxd trough socket, since you are running usbmuxd2 in container, you not only need to run docker container with usbmuxd in hostnetwork mode, but you also need to expose ubsmuxd2 listening port
normaly socket is /var/run/usbmuxd, but usbmuxd can be also built to listen to request on TCP port 27015 (this is port of apple service) you can "force" libusbmuxd based tools to use TCP by setting environment variable for example
USBMUXD_SOCKET_ADDRESS=127.0.0.1:27015
see https://github.com/libimobiledevice/libusbmuxd/blob/a7f0543fb1ecb20ac7121c0fd77297200e0e43fc/src/libusbmuxd.c#L161 how the value is processed, but i'm not sure, if you can build and run usbmuxd on linux that will listen to TCP socket.
on windows it's the only way, because that's how AMDservice on windows works.
for you it did work for you trough usbmuxd2 running on host, because ideviceid connected trough unix socket (read from /var/run)
what i would do is to run container with usbmuxd2, that have mapped /var/run to let's say /mydocker/sharedrun in host network mode run ideviceid in container that have mapped /var/run to same folder eg. /mydocker/sharedrun, it will use ubsmuxd socket file to communicate with other container, and see, what usbmuxd2 in container see
sharing socket between docker containers is working method that is commonly used, althought from security standpoint it's not best solution (since socket is also accessible from host, not just from containers)
Sorry for taking so long to reply. I am not sure to understand your answer.
Here is what you suggest if I understood well:
Run a first container with usbmuxd2 with the following command:
docker run -it -v /var/run:/mydocker/sharedrun --network host --privileged libimobiledevice-image
Run a second container without usbmuxd2 with the same command
Run the idevice_id command in the second container
Is that right?
I can see my iPhone with idevice_id -n but not connect to it. It says:
ERROR: [SRP] Invalid PIN
ERROR: Pairing with device 00008120-00**********0201E failed.
Does someone know what the problem could be?
I saw in https://github.com/libimobiledevice/libusbmuxd/blob/master/NEWS that network support was added to libusbmuxd and I'm super happy about that fact 👍
However, I don't get it working. I've compiled and installed the latest version of all the needed libraries (libimobiledevice, libplist, libusbmuxd, usbmuxd) from source on my Raspberry Pi 4 (OS: Debian Buster).
Via USB the IPhone shows up. So I connected the iPhone via USB and paired it (idevicepair pair) before I tried to connect via network.
However, after unplugging the iPhone from USB and trying to connect to it via the network I didn't get any result:
Further infos:
Would be super nice if you can help me :) Or could it be that the open source version of usbmuxd does not support network connections and only the proprietary one from Apple (on Windows and MacOS) supports it which is used by libusbmuxd when available?