Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find iPhone via network (idevice_id -n) #88

Open
fosple opened this issue Feb 9, 2020 · 53 comments
Open

Cannot find iPhone via network (idevice_id -n) #88

fosple opened this issue Feb 9, 2020 · 53 comments

Comments

@fosple
Copy link

fosple commented Feb 9, 2020

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:

sudo usbmuxd -s -v
[19:56:08.141][3] usbmuxd v1.1.1 starting up
[19:56:08.141][4] Creating socket
[19:56:08.142][4] Initializing USB
[19:56:08.159][4] Registering for libusb hotplug events
[19:56:08.159][4] 0 devices detected
[19:56:08.159][3] Initialization complete
[19:56:08.159][3] Enabled exit on SIGUSR1 if no devices are attached. Start a new instance with "--exit" to trigger.                                                      
[19:56:11.902][4] New client on fd 11 (pid 16768)
[19:56:11.904][4] Client 11 connection closed
[19:56:11.904][4] Disconnecting client fd 11
idevice_id -n
# no result

Further infos:

  • avahi-daemon is started and running
  • ufw firewall is disabled (I thought maybe I blocked some ports accidentally)

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?

@nikias
Copy link
Member

nikias commented May 26, 2020

I am working on network/mDNS capabilities for the open source usbmuxd. This will still take some time to get it done properly.

@alexandre-janniaux
Copy link

I am working on network/mDNS capabilities for the open source usbmuxd. This will still take some time to get it done properly.

Hi, did you start your work on this? May I provide help and patches for it?

@reanimus
Copy link

Any update here? I'd love to get Wifi Sync working on Linux :)

@cemizm
Copy link

cemizm commented Dec 13, 2020

Any update here? I'd love to get Wifi Sync working on Linux :)

+1

@cemizm
Copy link

cemizm commented Dec 24, 2020

hi @nikias, any progress on network/mDNS capabilities? would love to support you on this topic, but don't know where to start... are there any developer documentations or at least a high level architecture overiew of libimobiledevice?

@mcdull
Copy link

mcdull commented Jan 15, 2021

May I confirm with wi-fi sync only works in Mac but not Linux?

@fosple
Copy link
Author

fosple commented May 11, 2021

@mcdull WiFi sync works on Mac and Win, but not yet on Linux as there is no open source version of usbmuxd yet which supports WiFi sync.

@bentumbler
Copy link

bentumbler commented May 26, 2021

I have managed to get it working via WiFi sync on a rPi although a little flaky sometimes.
I did install https://github.com/tihmstar/usbmuxd2 though. Not sure if I could have got it working without that.

@fosple
Copy link
Author

fosple commented May 26, 2021

Wow, thanks @bentumbler for pointing out the re-implementation of usbmuxd by @tihmstar https://github.com/tihmstar/usbmuxd2 . Maybe @nikias can use it and include it in the original project 🥳

I'll give usbmuxd2 a try on the weekend.

@kozfogel
Copy link

Hello guys,

@bentumbler - i tried to build usbmuxd2 on a rPi, but somehow i cannot make it work.
I followed this tutorial:
https://www.numerousnetworks.co.uk/uncategorized/untether-ios-step-by-step/

but when at the point of making usbmuxd2 i got following problem

Client.cpp:274:50: error: ‘plist_to_bin_free’ was not declared in this scope; did you mean ‘plist_to_bin’?
274 | safeFreeCustom(plistbin, plist_to_bin_free);
| ^~~~~~~~~~~~~~~~~

Do you have some information how you got it to work? Or any other advice

Thanks

@bentumbler
Copy link

bentumbler commented Dec 26, 2021 via email

@kozfogel
Copy link

i installed libplist-dev and libplist++-dev (via apt-get) and builded libplist from git (because version 2.2.1 is needed)

@cemizm
Copy link

cemizm commented Dec 27, 2021

Hi kozfogel,

installing the apt packages are unnecessary if you build libplist from git. the install step of the build process will install these.

had the same issue with the plist_to_bin_free function. it has been dropped a few days ago:
libimobiledevice/libplist@c31beaa

In order to solve this issue you should checkout commit a9e34bd29ae9dcdae55bdf5fb8a23c9b1c02eee9

@juliienp
Copy link

juliienp commented Dec 31, 2021

Hi, i'm trying to build a docker image to run libimobiledevice and sync via Wifi every night.

I got some issues when I build usbmuxd2..

I also tried to follow these guide : https://www.numerousnetworks.co.uk/uncategorized/untether-ios-step-by-step/

Here's my dockerfile :

FROM ruby:2.3-slim
RUN apt-get update \
  && apt-get install -y \
    build-essential \
    checkinstall \
    git \
    autoconf \
    automake \
    libtool-bin \ 
    python-dev

RUN apt-get install -y \
  libplist-dev \
  libusbmuxd-dev \
  libimobiledevice-dev \
  libusb-1.0-0-dev \
  libplist++-dev \
  libssl-dev \
  usbmuxd \
  udev \
  libavahi-client-dev \
  avahi-utils \
  libatomic-ops-dev \
  libatomic1 \
  bluez-tools

ENV INSTALL_PATH /src
RUN mkdir -p $INSTALL_PATH

WORKDIR $INSTALL_PATH
RUN git clone https://github.com/libimobiledevice/libplist.git \
  && cd /src/libplist \
  && git checkout a9e34bd29ae9dcdae55bdf5fb8a23c9b1c02eee9 \
  && ./autogen.sh \
  && make \
  && make install
RUN ldconfig

WORKDIR $INSTALL_PATH
RUN git clone https://github.com/tihmstar/libgeneral.git \
  && cd libgeneral \
  # && git checkout 55  \
  && ./autogen.sh \
  # && make CFLAGS="-g -O2 -std=c11 -latomic" LDFLAGS=-latomic \
  && make install
RUN ldconfig

WORKDIR $INSTALL_PATH
RUN git clone https://github.com/tihmstar/usbmuxd2.git  \
  && cd /src/usbmuxd2 \
  && git submodule init \
  && git submodule update \
  && ./autogen.sh \
  && make \
  && make install
RUN ldconfig

WORKDIR $INSTALL_PATH
RUN git clone https://github.com/libimobiledevice/libimobiledevice.git \
  && cd /src/libimobiledevice \
  # && git checkout 1.3.0 \
  && ./autogen.sh \
  && make \
  && make install

RUN apt-get -y install ideviceinstaller

Do you know where I misunderstood something ?

@voltagex
Copy link

voltagex commented Dec 31, 2021

Do you know where I misunderstood something ?

  1. You have replied on an unrelated issue
  2. You have not posted an error message or problem

@bentumbler
Copy link

I haven't tried to replicate your issue but I do see that you have not built libusbmuxd as per the instructions at https://www.numerousnetworks.co.uk/uncategorized/untether-ios-step-by-step/

Also, I found that to build usbmuxd2 with g++ 8.3 I needed to amend configure.ac with the following LDFLAGS+="-latomic -lstdc++fs"

Try those suggestions. Also follow the build order in the guide.
If you still have issues, we need to see the build output.

@cemizm
Copy link

cemizm commented Jan 2, 2022

Here is my dockerfile which seems to work after a lot of fiddling and version matching..

https://gist.github.com/cemizm/07ed041d451c55e395856873f46f074f

It uses a small bash script as an entrypoint in order to start the required services. furthermore for the first usage you need to (re-)start usbmuxd a few times in order to create the SystemConfiguration.plist (see issue tihmstar/usbmuxd2#6)

for the network usage of a device you need to connect the device at least once trough usb, which means you need to pass the usb bus to the container and run it in privileged mode. the public and private keys after the pairing process are stored in the data folder and are persisted between startups.

Usage:

#build the container
docker build -t usbmuxd2

#run in default mode
docker run -it --rm --name imobiledevice -v $(PWD)/data:/var/lib/lockdown/ --network host usbmuxd2

#run with usb support and privileged mode
docker run -it --rm --name imobiledevice -v $(PWD)/data:/var/lib/lockdown/ --network host --privileged -v /dev/bus/usb:/dev/bus/usb usbmuxd2

@kozfogel
Copy link

kozfogel commented Jan 2, 2022

@bentumbler @cemizm

Thanks a lot guys. I got it running on my PI4 now (i used the Docker script with some slightly changes for latomic)

It works when i connect via USB - but Wifi sadly not.
Any idea where to look next? (logs, debuging, etc)
usbmuxd output:

[16:28:02.685][3] TCP Connected to device
[16:28:02.685][1] failed to recv_data on client -1 with error=graceful kill code=25165834
[16:28:02.686][3] killing client -1
[16:28:02.690][1] failed to recv_data on client 17 with error=client 17 disconnected! code=6946826
[16:28:02.690][3] killing client 17
[16:28:02.705][1] failed to recv_data on client 18 with error=client 18 disconnected! code=6946826
[16:28:02.705][3] killing client 18
[16:28:02.921][3] preflight_device: Finished preflight on device 00008101-00090DAE2881401D
[16:28:02.923][3] killing TCP 16
[16:28:05.694][3] killing device 00008101-00090DAE2881401D
[16:28:05.994][1] failed to recv_data on client 17 with error=client 17 disconnected! code=6946826
[16:28:05.994][3] killing client 17
[16:28:10.998][1] Failed to start WIFIDevice 00008101-00090DAE2881401D with error=4128790 ([WIFIDevice] Failed to start heartbeat service with error=-256)
[16:28:10.999][3] killing device 00008101-00090DAE2881401D
[libusbmuxd] device_info_from_plist: Failed to get EscapedFullServiceName!
[16:28:11.004][1] Failed to start WIFIDevice 00008101-00090DAE2881401D with error=3997718 (assure failed)
[16:28:11.004][1] failed to recv_data on client 14 with error=client 14 disconnected! code=6946826
[16:28:11.004][3] killing device 00008101-00090DAE2881401D
[16:28:11.004][3] killing client 14
[16:29:27.704][1] failed to recv_data on client 15 with error=client 15 disconnected! code=6946826
[16:29:27.705][3] killing client 15
[16:29:27.705][3] Starting TCP connection
[16:29:27.706][3] TCP Connected to device
[16:29:27.707][1] failed to recv_data on client -1 with error=graceful kill code=25165834
[16:29:27.707][3] killing client -1
[16:29:27.711][1] failed to recv_data on client 14 with error=client 14 disconnected! code=6946826
[16:29:27.711][3] killing client 14
[16:29:27.712][1] failed to recv_data on client 15 with error=client 15 disconnected! code=6946826
[16:29:27.712][3] killing client 15
[16:29:27.719][1] failed to recv_data on client 16 with error=client 16 disconnected! code=6946826
[16:29:27.720][3] killing client 16
[16:29:27.967][3] killing TCP 10
[16:29:32.047][3] Device 1-5 RX aborted due to error or disconnect
[16:29:32.048][3] Device 1-5 RX aborted due to error or disconnect

@cemizm
Copy link

cemizm commented Jan 2, 2022

@bentumbler @cemizm

Thanks a lot guys. I got it running on my PI4 now (i used the Docker script with some slightly changes for latomic)

it seems like you are not using the latest version (> 1.3.0) of libimobiledevice... please make sure that your are not using any packages (libimobiledevice, libplist, ...) from a package manager.

can you post your dockerfile?

@kozfogel
Copy link

kozfogel commented Jan 2, 2022

I am not running docker. I builded all directly on the Pi - Raspbian GNU/Linux 11 (bullseye) - fresh install.

if i am running somithing like this:
ideviceinfo --version
ideviceinfo 1.3.0

should it be a higher version?

@bentumbler
Copy link

bentumbler commented Jan 2, 2022 via email

@mexmer
Copy link

mexmer commented Jan 3, 2022

I am not running docker. I builded all directly on the Pi - Raspbian GNU/Linux 11 (bullseye) - fresh install.

if i am running somithing like this: ideviceinfo --version ideviceinfo 1.3.0

should it be a higher version?

yes, it should be 1.3.1, version 1.3.0 is year and half old, and supports only devices up to ios 13

@bentumbler
Copy link

V 1.3.0 works fine for my iOS 15 devices (at least for log capture, which is how I use it). You can move to a later version but I think you will need to ensure you build the libimobiledevice-glue library too.

@mexmer
Copy link

mexmer commented Jan 4, 2022

@bentumbler version 1.3.0 works only for limited set of features, some services changed their required protocol version (plus other minor changes), and those are updated in 1.3.1, screenshot is one of them, also backup, sync ... not sure what others. guess i should have written full support

@dmitrym0
Copy link

dmitrym0 commented Sep 6, 2022

@kozfogel did you manage to resolve your issue? I'm having something similar:

[13:46:23.385][5] add_device 0000811000163D5A2684801E
[13:46:23.385][5] Muxer: adding device 0000811000163D5A2684801E assigning id 3
[13:46:23.385][5] [Client] initializing Client 16
[13:46:23.385][5] add_client 16
[13:46:23.385][5] Client command in fd 16 len 436 ver 1 msg 8 tag 2
[13:46:23.385][5] send_pkt fd 16 tag 2 msg 8 payload_length 946
[13:46:23.385][1] Failed to start WIFIDevice 0000811000163D5A2684801E with error=3801110 (assure failed)
[13:46:23.385][5] delete_device 0000811000163D5A2684801E
[13:46:23.385][5] delete_device 0000811000163D5A2684801E
[13:46:23.385][1] failed to recv_data on client 16 with error=client 16 disconnected! code=6750218

Looks like the device is recognized, but errors out anyway. At least it's the correct UDID.

@mexmer where can one obtain version 1.3.1?

ideviceinfo --version
ideviceinfo 1.3.0-164-gb5ce444

looks like the version string is set using git describe. I don't see a tag for 1.3.1.

@sepsky
Copy link

sepsky commented Jul 28, 2023

Hi all, not sure if this issue is still actively observed, but I've also got the same issue @dmitrym0 is experiencing.
I've got idevice_id version of 1.3.0-190-g6fc41f5 and successfully installed usbmuxd2 (@bentumbler I also had to do add LDFLAGS+="-latomic -lstdc++fs" to my configure.ac)

I am getting the same failed to recv_data on client 7 with error=client 7 disconnected! code=6750218

One thing I've noticed, even when I have usbmuxd running, with the below information:

[15:02:41.372][3] starting usbmuxd2 version: 0.46-753b79eaf317c56df6c8b1fb6da5847cc54a0bb0-RELEASE
[15:02:41.373][3] Loaded config
[15:02:41.373][3] starting usbmuxd2 version: 0.46-753b79eaf317c56df6c8b1fb6da5847cc54a0bb0-RELEASE
[15:02:41.374][3] Inited ClientManager
[15:02:41.374][3] USBDeviceManager libusb 1.0
[15:02:41.389][3] Registering for libusb hotplug events
[15:02:41.390][3] Inited USBDeviceManager
[15:02:41.398][3] Inited WIFIDeviceManager
[15:02:41.398][4] Initialization complete
... {usbmuxd is waiting here}

I get this when I run service usbmuxd status:

● usbmuxd.service - Socket daemon for the usbmux protocol used by Apple devices
     Loaded: loaded (/lib/systemd/system/usbmuxd.service; disabled; vendor pres>
     Active: inactive (dead)
       Docs: man:usbmuxd(8)

Is there anything we need to do with the client? I read somewhere that this might be an issue with Avahi-Client, but my Avahi is running ok, and I can confirm that when I do :

TriggeredBy: ● avahi-daemon.socket
   Main PID: 381 (avahi-daemon)
     Status: "Server startup complete. Host name is {DEVICE_NAME}.local. Local service cookie is 3412524750."
      Tasks: 1 (limit: 3933)
        CPU: 606ms
     CGroup: /system.slice/avahi-daemon.service
             └─381 avahi-daemon: running [DEVICE_NAME.local]

Jul 28 14:11:55 DEVICE_NAME systemd[1]: Started Avahi mDNS/DNS-SD Stack.
Jul 28 14:11:56 DEVICE_NAME avahi-daemon[381]: Server startup complete. Host name is DEVICE_NAME.local. Local service cookie is 3412524750.
Jul 28 14:11:57 DEVICE_NAME avahi-daemon[381]: Service "DEVICE_NAME" (/usr/local/etc/avahi/services/ssh.service) successfully established.
Jul 28 14:11:57 DEVICE_NAME avahi-daemon[381]: Service "DEVICE_NAME" (/usr/local/etc/avahi/services/sftp-ssh.service) successfully established.
Jul 28 14:12:02 DEVICE_NAME avahi-daemon[381]: Joining mDNS multicast group on interface wlan0.IPv6 with address [DEVICE_MAC_ADDRESS].
Jul 28 14:12:02 DEVICE_NAME avahi-daemon[381]: New relevant interface wlan0.IPv6 for mDNS.
Jul 28 14:12:02 DEVICE_NAME avahi-daemon[381]: Registering new address record for [DEVICE_MAC_ADDRESS] on wlan0.*.
Jul 28 14:12:07 DEVICE_NAME avahi-daemon[381]: Joining mDNS multicast group on interface wlan0.IPv4 with address [DEVICE_IP_ADDRESS].
Jul 28 14:12:07 DEVICE_NAME avahi-daemon[381]: New relevant interface wlan0.IPv4 for mDNS.
Jul 28 14:12:07 DEVICE_NAME avahi-daemon[381]: Registering new address record for [DEVICE_IP_ADDRESS] on wlan0.IPv4.

Thanks a lot and if we need any more information, please let me know and I'll find and provide it.

@mexmer
Copy link

mexmer commented Aug 2, 2023

@sepsky usbmuxd2 is reimplementation of usbmuxd with avahi support, so you need to direct any issue to author of usbmuxd2
https://github.com/tihmstar/usbmuxd2

@sepsky
Copy link

sepsky commented Aug 2, 2023

@mexmer Thanks for the message. I Have added it there too, the error is the same as the one here, so thought to add mine as well, in case the last commenter found the fix for their issue (so I can try as well.
of course, if/when I receive an updates anywhere (here or for usbmuxd2), I'll update the other one too.

@mexmer
Copy link

mexmer commented Aug 2, 2023

on windows it works, so it's very likely something on usbmuxd2 side. although there have been some changes in source code, if you look at commits it's mostly cleanup, nothing that should cause communication break with usbmuxd (or usbmuxd2)

@sepsky
Copy link

sepsky commented Aug 8, 2023

Thanks @mexmer for the encouraging comment.

I think I have found the issue, but still not sure about the solution :(

So I think it's something to do with dns and socket configuration (either on pi, ATV or the network ?)
I saw @bentumbler comment regarding the dns configuration, but given that my experience is apple-only (apple to apple devices, all "works" approach), I'm not well-versed in sockets and how to connect to apple devices with non-apple devices.

I'm learning about that, but if you (or @bentumbler ) have any hints / help you think would be useful for that topic, I'd greatly appreciate it.

@cl532257933
Copy link

cl532257933 commented Aug 14, 2023

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[20:56:13.063][3] starting usbmuxd2 version: 0.46-753b79eaf317c56df6c8b1fb6da5847cc54a0bb0
[20:56:13.063][3] Loaded config
[20:56:13.063][3] starting usbmuxd2 version: 0.46-753b79eaf317c56df6c8b1fb6da5847cc54a0bb0
[New Thread 0x7ffff70c1640 (LWP 4144)]
[20:56:13.064][3] Inited ClientManager
[20:56:13.064][3] USBDeviceManager libusb 1.0
[New Thread 0x7ffff68c0640 (LWP 4145)]
[New Thread 0x7ffff60bf640 (LWP 4146)]
[20:56:13.065][3] Registering for libusb hotplug events
[New Thread 0x7ffff58be640 (LWP 4147)]
[20:56:13.066][3] Inited USBDeviceManager
[New Thread 0x7ffff50bd640 (LWP 4148)]
[20:56:13.067][3] Inited WIFIDeviceManager
[20:56:13.068][4] Initialization complete
[New Thread 0x7ffff48bc640 (LWP 4150)]
[20:56:36.652][1] failed to recv_data on client 9 with error=client 9 disconnected! code=6750218
[Thread 0x7ffff48bc640 (LWP 4150) exited]

who can help me,i build it on ubuntu,but “failed to recv_data on client 9 with error=client 9 disconnected! code=6750218”

@sepsky
Copy link

sepsky commented Aug 15, 2023

I have the same issue @cl532257933.

I followed https://www.numerousnetworks.co.uk/guides/untether-ios-step-by-step/ (I had to make some changes to the code because there were some duplication). However, that's also giving me the same error.

How did you install dependencies? Was it a mix of apt-get and manual compiling and installing (using make and make install...)? I really think this is something to do with the dependencies (I put my money on libplist or libplist++ because when I added a console output of what's passed to recv_data, we have some bytes. This points me to either an incorrect formatting of the data we receive, OR broken communication between Avahi and usbmuxd).

I wonder if you also get the same error if you follow the above link?

I'll update as soon as I found more.

@bentumbler
Copy link

bentumbler commented Aug 15, 2023 via email

@cl532257933
Copy link

I have the same issue @cl532257933.

I followed https://www.numerousnetworks.co.uk/guides/untether-ios-step-by-step/ (I had to make some changes to the code because there were some duplication). However, that's also giving me the same error.

How did you install dependencies? Was it a mix of apt-get and manual compiling and installing (using make and make install...)? I really think this is something to do with the dependencies (I put my money on libplist or libplist++ because when I added a console output of what's passed to recv_data, we have some bytes. This points me to either an incorrect formatting of the data we receive, OR broken communication between Avahi and usbmuxd).

I wonder if you also get the same error if you follow the above link?

I'll update as soon as I found more.

yes, I installed dependencies mixed of apt-get and manual compiling and installing.I also modify the code to resolve repeat definiton as follows:
-enum plist_format_t {

  •   PLIST_FORMAT_XML,
    
  •   PLIST_FORMAT_BINARY
    

+enum plist_format_t1 {

  •   PLIST_FORMAT_XML1,
    
  •   PLIST_FORMAT_BINARY1
    

-int plist_write_to_filename(plist_t plist, const char *filename, enum plist_format_t format);
+int plist_write_to_filename(plist_t plist, const char *filename, enum plist_format_t1 format);

@cl532257933
Copy link

The instructions are a bit old and before the libimobiledevice-glue library was around so you need to add that. Last time I did this (1 year ago), I found the need to use specific checkin for libplist and not the head as previously described. Libplist checkout a9e34bd29ae9dcdae55bdf5fb8a23c9b1c02eee9 It may be different now. If I get a chance to try it again I’ll update the tutorial

I didn't install libimobiledevice-glue, I will try it again by your guidance

@sepsky
Copy link

sepsky commented Aug 16, 2023

Thanks @cl532257933, I did something similar as well, I think one of them isn't actually used anywhere (I think it's the one in Util.c?) so I commented it out.

I tried the same method (mix of apt-get and manual), as well as trying to build everything from repos, but that also failed with the exact same error.

Also many thanks @bentumbler for the context and the commit you shared. Totally, I know it's been a while, and I encountered the failure for libimobiledevice-glue too. I fixed it by installing it from the repo. Not sure if this is relevant, but I built from master, if you used / want me to try a particular commit for that as well, please let me know.

I will try the commit you suggested, will rebuild and update with the outcome 👍

@sepsky
Copy link

sepsky commented Aug 16, 2023

Hi @cl532257933 so I followed the script you have, and everything was installed ok (there were some additional requirements, such as libgeneral and libimobiledevice-glue, but apart from those it installed fine).
However, I still get the same error as before from usbmuxd. Interestingly, I can see my devices when I run avahi-discover (you can install it using sudo sudo apt-get install -y avahi-discover)

I've found a dockerfile, I've not tried it but I'll try it and will update the results as well as the dockerfile, in case you want to try it as well.

Hi @bentumbler so I tried the commit you provided, and had the same issue. I checked the code in master and it's got the changes in that commit as well. I think someone has already merged it into the master. Based on your experience, do you think it could be the new formatter we have to pass in toplist_from_memory method? I've tried PLIST_FORMAT_PLIST, PLIST_FORMAT_JSON and PLIST_FORMAT_NONE, and neither works (same error).

@cl532257933
Copy link

cl532257933 commented Aug 27, 2023

@sepsky
I have resolved this issue #88 successfully,Execute command line “ifconfig eth0 -allmulti” to make ubuntu receive Multicast message.@fosple Maybe the issue #88 could be closed.

@dmitrym0
Copy link

@sepsky
I have resolved this issue #88 successfully,Execute command line “ifconfig eth0 -allmulti” to make ubuntu receive Multicast message.@fosple Maybe the issue #88 could be closed.

Did you install this on host or used a docker container? What version are you running?

ideviceinfo --version
ideviceinfo 1.3.0-164-gb5ce444

@leodeve
Copy link

leodeve commented Apr 3, 2024

Any news?
I still cannot find my iPhone via network on my Linux (Linux Mint 21.3). It works well in USB.
I use the following docker container:

FROM debian:11-slim

RUN apt-get update && apt-get install -y build-essential pkg-config checkinstall git autoconf automake

RUN apt-get install -y libtool-bin libssl-dev

RUN apt-get install -y libusb-1.0.0-dev libavahi-client-dev

ENV INSTALL_PATH /src
RUN mkdir -p $INSTALL_PATH
WORKDIR $INSTALL_PATH

RUN git clone https://github.com/libimobiledevice/libplist.git \
  && cd /src/libplist \
  && ./autogen.sh \
  && make \
  && make install

RUN git clone https://github.com/libimobiledevice/libimobiledevice-glue.git \
  && cd /src/libimobiledevice-glue \
  && ./autogen.sh \
  && make \
  && make install

RUN git clone https://github.com/tihmstar/libgeneral.git \
  && cd /src/libgeneral \
  && ./autogen.sh \
  && make \
  && make install

RUN git clone https://github.com/libimobiledevice/libusbmuxd.git \
  && cd /src/libusbmuxd \
  && ./autogen.sh \
  && make \
  && make install

RUN git clone https://github.com/libimobiledevice/libimobiledevice.git \
  && cd /src/libimobiledevice \
  && ./autogen.sh \
  && make \
  && make install

RUN git clone https://github.com/tihmstar/usbmuxd2.git \
  && cd /src/usbmuxd2 \
  && apt-get install -y clang \
  && ./autogen.sh \
  && ./configure CC=clang CXX=clang++ \
  && make \
  && make install

RUN apt-get -y install ideviceinstaller

I followed this link to compile usbmuxd2: tihmstar/usbmuxd2#31
I ran my container with the following commands:

docker build -t libimobiledevice-image .
docker run -it -v /var/run:/var/run --network host libimobiledevice-image

I ran the following commands in my container:

usbmuxd -v
[09:07:50.612][3] starting usbmuxd2 version: 0.61-2ce399ddbacb110bd5a83a6b8232d42c9a9b6e84-RELEASE
[09:07:50.614][2] Failed to get doPreflight! setting it to default val
[09:07:50.615][2] sysconf_set_value: Reading SystemConfiguration failed! Regenerating!
[09:07:50.616][2] Failed to get enableWifiDeviceManager! setting it to default val
[09:07:50.617][2] Failed to get enableUSBDeviceManager! setting it to default val
[09:07:50.622][3] Loaded config
[09:07:50.622][3] starting usbmuxd2 version: 0.61-2ce399ddbacb110bd5a83a6b8232d42c9a9b6e84-RELEASE
[09:07:50.622][0] Another instance is already running (pid 0). exiting.
[09:07:50.623][4] main reached cleanup
[09:07:50.623][4] done!
ideviceinfo --version
ideviceinfo 1.3.0-219-g3969bc9
idevicepair pair
SUCCESS: Paired with device 00008020-000815E82E06002E
idevicepair pair --wireless
No device found.
idevice_id
00008020-000815E82E06002E (USB)
idevice_id -n
#no result

I tried the dockerfile of @cemizm but it doesn't work for me.
I also tried to use the multicast command of @cl532257933 but it doesn't work either.
I tried to connect my iPhone and PC to the same network.
I also tried to set up a wireless hotspot to share my PC connection to my iPhone.
Any help will be appreciated.

@bentumbler
Copy link

bentumbler commented Apr 3, 2024 via email

@leodeve
Copy link

leodeve commented Apr 5, 2024

Thank you for your answer.
I tried with an entreprise network and a home network.
To run avahi in my container, I added the line RUN apt-get install -y avahi-utils to my Dockerfile. I also ran my container with the --privileged option.

I ran the following command in my container at home:

avahi-resolve-host-name iPhone.local
iPhone.local	192.168.1.15

I added the line RUN apt-get install -y systemd to my Dockerfile to use the resolvectl command. With the resolvectl status command, I can see that the mDNS option is not enabled (-mDNS) :

Link 3 (wlp2s0)
    Current Scopes: DNS
         Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 2a01:cb05:83d1:be00:3ab5:c9ff:fe0c:9480
       DNS Servers: 192.168.1.1 2a01:cb05:83d1:be00:3ab5:c9ff:fe0c:9480
        DNS Domain: home

I can enable it with the resolvectl mdns wlp2s0 yes command. However, I still can't find my iPhone via network with libimobiledevice in my container.

@leodeve
Copy link

leodeve commented Apr 11, 2024

I kept digging into my problem. I ran the commands from my dockerfile directly in a real debian 11 and it worked. I connected my iPhone and my PC to the same network. Then, I could see my device with the idevice_id -n command. I didn't need to run the usbmuxd command. Consequently, the problem seems to come from docker. Do you have any idea why it works on a real debian 11 and not on docker with a debian 11 image?

@mexmer
Copy link

mexmer commented Apr 12, 2024

I kept digging into my problem. I ran the commands from my dockerfile directly in a real debian 11 and it worked. I connected my iPhone and my PC to the same network. Then, I could see my device with the idevice_id -n command. I didn't need to run the usbmuxd command. Consequently, the problem seems to come from docker. Do you have any idea why it works on a real debian 11 and not on docker with a debian 11 image?

to discover devices over network, program needs to send multicast (bonjour discovery) to network, this is not possible from docker, because docker doesn't have direct access to your network. you can imagine docker image to be computer behind router, that does NAT (in this case router is your computer).

full virtualization (like vmware or proxmox), can have access to network trough virtual interface, but containers do not have direct access to network, they are always proxied trough docker service.

@cemizm
Copy link

cemizm commented Apr 12, 2024

I kept digging into my problem. I ran the commands from my dockerfile directly in a real debian 11 and it worked. I connected my iPhone and my PC to the same network. Then, I could see my device with the idevice_id -n command. I didn't need to run the usbmuxd command. Consequently, the problem seems to come from docker. Do you have any idea why it works on a real debian 11 and not on docker with a debian 11 image?

to discover devices over network, program needs to send multicast (bonjour discovery) to network, this is not possible from docker, because docker doesn't have direct access to your network. you can imagine docker image to be computer behind router, that does NAT (in this case router is your computer).

full virtualization (like vmware or proxmox), can have access to network trough virtual interface, but containers do not have direct access to network, they are always proxied trough docker service.

or you just use host network mode for your container:

#88 (comment)

@leodeve
Copy link

leodeve commented Apr 12, 2024

I am already using it. Here is the command I use to run my container:

docker run -it -v /var/run:/var/run --network host --privileged libimobiledevice-image

By the way, I need to use the volume /var/run. Otherwise I cannot detect my iPhone via USB.

@mexmer
Copy link

mexmer commented Apr 12, 2024

or you just use host network mode for your container:

#88 (comment)

i see, thanks for clarification. i'm using docker only for running containers under k9, so had not need for this option, and didn't know it exists tbh.

@mexmer
Copy link

mexmer commented Apr 12, 2024

I am already using it. Here is the command I use to run my container:

docker run -it -v /var/run:/var/run --network host --privileged libimobiledevice-image

By the way, I need to use the volume /var/run. Otherwise I cannot detect my iPhone via USB.

usbmuxd stores pid.run file into /var/run, if you have that folder inside your container, and is writeable by usbmuxd, it should be enough, you should check usbmuxd or usbmuxd2 manual, there should be all commandline parameters, and probly location of files it writes, or check in source code.
usbmuxd needs to write pid.run file, but also lockdown files from paired devices, and also log (if you have logging to file enabled)

@leodeve
Copy link

leodeve commented Apr 17, 2024

I don't have a pid.run file into /var/run in my container and in my host.
I checked the usbmuxd2 source code. I can only see the following files: /var/run/usbmuxd.pid, /var/run/usbmuxd and /var/lib/lockdown.
I continued my research. I ran my docker container in a real debian 11 that has usbmuxd2 installed. It worked. I could see my device with the idevice_id -n command. It seems that the container needs to be run on a host with the usbmuxd2 service running.

@mexmer
Copy link

mexmer commented Apr 17, 2024

I don't have a pid.run file into /var/run in my container and in my host. I checked the usbmuxd2 source code. I can only see the following files: /var/run/usbmuxd.pid, /var/run/usbmuxd and /var/lib/lockdown. I continued my research. I ran my docker container in a real debian 11 that has usbmuxd2 installed. It worked. I could see my device with the idevice_id -n command. It seems that the container needs to be run on a host with the usbmuxd2 service running.

by pid.run file i did mean usbmuxd.pid, i'm lazy to search code for exact name 😸
as for what you say regarding usbmuxd, i thought you are trying to run usbmuxd2 inside container. of course usbmud2 running directly on computer will see all mdns and bonjour devices.

now i'm honestly lost in what you are actually trying to do.

@leodeve
Copy link

leodeve commented Apr 23, 2024

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.

@mexmer
Copy link

mexmer commented Apr 26, 2024

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

static int connect_usbmuxd_socket()
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)

@leodeve
Copy link

leodeve commented Jun 24, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests