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

'ios launch' unable to launch app #54

Open
tzcurtain opened this issue Aug 17, 2021 · 9 comments
Open

'ios launch' unable to launch app #54

tzcurtain opened this issue Aug 17, 2021 · 9 comments

Comments

@tzcurtain
Copy link

Hello, i try to use go-ios v1.0.24 to launch apps on my iphone, but it failed.
i tried other commands like ios screenshot/apps/info/syslog work
, ios ps & kill not work
my phone & sysver: iphone11 pro max ios14.3
here is my log output:

❯ ./ios launch com.apple.Preferences

{"channel_id":"com.apple.instruments.server.services.processcontrol","error":"Timed out waiting for response for message:5 channel:0","level":"error","msg":"failed requesting channel","time":"2021-08-17T15:31:20+08:00"}
{"bundleID":"com.apple.Preferences","channel_id":"com.apple.instruments.server.services.processcontrol","level":"info","msg":"Launching process","time":"2021-08-17T15:31:20+08:00"}
{"level":"error","msg":"DeviceConnection failed writing 1383 bytes, only 0 sent","time":"2021-08-17T15:31:20+08:00"}
{"level":"error","msg":"Failed sending: write unix -\u003e/var/run/usbmuxd: write: broken pipe","time":"2021-08-17T15:31:20+08:00"}
{"channel_id":"com.apple.instruments.server.services.processcontrol","error":"write unix -\u003e/var/run/usbmuxd: write: broken pipe","level":"info","methodselector":"launchSuspendedProcessWithDevicePath:bundleIdentifier:environment:arguments:options:","msg":"failed starting invoking method","time":"2021-08-17T15:31:20+08:00"}
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/danielpaulus/go-ios/ios/instruments.ProcessControl.StartProcess(0xc000446a20, 0xc0003f5f40, 0x7ffeefbff91d, 0x15, 0xc0003f18f0, 0x1793228, 0x0, 0x0, 0xc0003f18c0, 0x0, ...)
	/Users/runner/work/go-ios/go-ios/ios/instruments/processcontrol.go:65 +0x9f1
github.com/danielpaulus/go-ios/ios/instruments.(*ProcessControl).LaunchApp(0xc0003cad70, 0x7ffeefbff91d, 0x15, 0x0, 0xc000318996, 0x3)
	/Users/runner/work/go-ios/go-ios/ios/instruments/processcontrol.go:23 +0xe5
main.Main()
	/Users/runner/work/go-ios/go-ios/main.go:335 +0x267d
main.main()
	/Users/runner/work/go-ios/go-ios/main.go:41 +0x25
@danielpaulus
Copy link
Owner

Hey there, please run it with the -v option and post logs

@tzcurtain
Copy link
Author

./ios --udid d950b7ba58dd8aba00eff574fd62a30ae8a8af43 launch -v com.apple.Preferences
{"level":"info","msg":"Set Debug mode","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"map[--basedir:\u003cnil\u003e --binary:false --bundleid:\u003cnil\u003e --details:false --help:false --nojson:false --output:\u003cnil\u003e --path:\u003cnil\u003e --pid:\u003cnil\u003e --process:\u003cnil\u003e --setlang:\u003cnil\u003e --setlocale:\u003cnil\u003e --stop-at-entry:false --system:false --testrunnerbundleid:\u003cnil\u003e --trace:false --udid:d950b7ba58dd8aba00eff574fd62a30ae8a8af43 --verbose:true --version:false --xctestconfig:\u003cnil\u003e \u003capp_path\u003e:\u003cnil\u003e \u003cbundleID\u003e:com.apple.Preferences \u003chostPort\u003e:\u003cnil\u003e \u003cprofileId\u003e:\u003cnil\u003e \u003cprofileTypeId\u003e:\u003cnil\u003e \u003ctargetPort\u003e:\u003cnil\u003e apps:false auto:false ax:false date:false debug:false devicename:false devicestate:false diagnostics:false dproxy:false enable:false forward:false image:false info:false install:false kill:false lang:false launch:true list:false listen:false mount:false pair:false pcap:false ps:false readpair:false reboot:false runtest:false runwda:false screenshot:false syslog:false version:false]","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"Looking for device 'd950b7ba58dd8aba00eff574fd62a30ae8a8af43'","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"Opening connection:0xc0002d1e00","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"UsbMux sendios.ReadDevicesType on 0xc0000a8830","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"UsbMux Receive on 0xc0000a8878","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"Opening connection:0xc0002eea50","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"UsbMux sendios.ReadPair on 0xc000306098","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"UsbMux Receive on 0xc0003060e0","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"UsbMux sendios.connectMessage on 0xc000306098","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"UsbMux Receive on 0xc000306830","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"Lockdown sendios.startSessionRequest","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"enable session ssl on0xc0003081c0 and wrap with tlsConn0xc0002c8f20","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"Lockdown sendios.startServiceRequest","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"Lockdown sendios.stopSessionRequest","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"Closing connection:0xc0003081c0","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"Failed connecting to com.apple.instruments.remoteserver, trying com.apple.instruments.remoteserver.DVTSecureSocketProxy","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"Opening connection:0xc0002ef7e0","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"UsbMux sendios.ReadPair on 0xc000307370","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"UsbMux Receive on 0xc0003073a0","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"UsbMux sendios.connectMessage on 0xc000307370","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"UsbMux Receive on 0xc00000e710","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"Lockdown sendios.startSessionRequest","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"enable session ssl on0xc000309880 and wrap with tlsConn0xc000010010","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"Lockdown sendios.startServiceRequest","time":"2021-08-21T03:20:45-04:00"}
{"EnableServiceSSL":true,"Port":52753,"Request":"StartService","Service":"com.apple.instruments.remoteserver.DVTSecureSocketProxy","level":"debug","msg":"Service started on device","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"Lockdown sendios.stopSessionRequest","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"Closing connection:0xc000309880","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"Opening connection:0xc00005a9c0","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"UsbMux sendios.ReadPair on 0xc00000f208","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"UsbMux Receive on 0xc00000f238","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"Opening connection:0xc0002ee0d0","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"UsbMux sendios.connectMessage on 0xc000306740","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"UsbMux Receive on 0xc000306770","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"enable session ssl on0xc000308720 and wrap with tlsConn0xc0002c8008","time":"2021-08-21T03:20:45-04:00"}
{"channel_id":"com.apple.instruments.server.services.processcontrol","level":"debug","msg":"Requesting channel","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"DTX Connection with EOF","time":"2021-08-21T03:20:45-04:00"}
{"level":"debug","msg":"i0.0 c0 t:Ack mlen:0 aux_len0 paylen0","time":"2021-08-21T03:20:50-04:00"}
{"channel_id":"com.apple.instruments.server.services.processcontrol","error":"Timed out waiting for response for message:5 channel:0","level":"error","msg":"failed requesting channel","time":"2021-08-21T03:20:50-04:00"}
{"channel_id":"com.apple.instruments.server.services.processcontrol","level":"debug","msg":"Channel open","time":"2021-08-21T03:20:50-04:00"}
{"bundleID":"com.apple.Preferences","channel_id":"com.apple.instruments.server.services.processcontrol","level":"info","msg":"Launching process","time":"2021-08-21T03:20:50-04:00"}
{"level":"error","msg":"DeviceConnection failed writing 1383 bytes, only 0 sent","time":"2021-08-21T03:20:50-04:00"}
{"level":"error","msg":"Failed sending: write unix @-\u003e/var/run/usbmuxd: write: broken pipe","time":"2021-08-21T03:20:50-04:00"}
{"level":"debug","msg":"Closing connection:0xc000308720","time":"2021-08-21T03:20:50-04:00"}
{"channel_id":"com.apple.instruments.server.services.processcontrol","error":"write unix @-\u003e/var/run/usbmuxd: write: broken pipe","level":"info","methodselector":"launchSuspendedProcessWithDevicePath:bundleIdentifier:environment:arguments:options:","msg":"failed starting invoking method","time":"2021-08-21T03:20:50-04:00"}
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/danielpaulus/go-ios/ios/instruments.ProcessControl.StartProcess(0xc000532840, 0xc000620040, 0x7ffc614c875e, 0x15, 0xc000528bd0, 0xb8d588, 0x0, 0x0, 0xc000528ba0, 0x0, ...)
        /home/runner/work/go-ios/go-ios/ios/instruments/processcontrol.go:65 +0x9f1
github.com/danielpaulus/go-ios/ios/instruments.(*ProcessControl).LaunchApp(0xc00051a910, 0x7ffc614c875e, 0x15, 0x0, 0xc0002d3b70, 0x3)
        /home/runner/work/go-ios/go-ios/ios/instruments/processcontrol.go:23 +0xe5
main.Main()
        /home/runner/work/go-ios/go-ios/main.go:335 +0x267d
main.main()
        /home/runner/work/go-ios/go-ios/main.go:41 +0x25

@danielpaulus
Copy link
Owner

danielpaulus commented Aug 25, 2021

Can you maybe:

  • stop Xcode and all other Mac tools using iOS devices
  • run ./ios dproxy in a separate window
  • then try to launch the app again
  • zip the dproxy "dump" directory and upload it?

@tzcurtain
Copy link
Author

@tzcurtain
Copy link
Author

btw i has to use sudo to run dproxy and launch, or terminal will say

INFO[0000] Successfully retrieved pairrecord: 20265234-378D-41F5-8277-EBA43D14980A for device d950b7ba58dd8aba00eff574fd62a30ae8a8af43 
INFO[0000] Moving socket /var/run/usbmuxd to /var/run/usbmuxd.96e1a21f-9373-46be-bf50-616fdc406f74.real_socket 
ERRO[0000] Unable to move, lacking permissions?          error="rename /var/run/usbmuxd /var/run/usbmuxd.96e1a21f-9373-46be-bf50-616fdc406f74.real_socket: permission denied" socket=/var/run/usbmuxd
INFO[0000] DebugProxy Terminated abnormally              error="rename /var/run/usbmuxd /var/run/usbmuxd.96e1a21f-9373-46be-bf50-616fdc406f74.real_socket: permission denied" 

hope it dosen't matter,
and this phone i'm using now is iphone8 with ios14.0.1 running on macos 10.15.7

@danielpaulus
Copy link
Owner

yeah you can also temporarily chmod /var/run so your user has access. I should add that to the error message

@danielpaulus
Copy link
Owner

Is your cable broken or something? :-D

@vdelendik
Copy link

I was able to repro the issue using ios ps as part of healthcheck script. It works in the beginning but in 5-10 minutes couldn't send messages due to the broken pipe. Moreover, other commands might work correctly.
Among problematic based on mine observation: launch/kill app and ps. As a workaroung going to organize retries on my end with pause in between retries.

@briankrznarich
Copy link
Contributor

My current estimation is that this occurs when the device itself is, to use a technical term, "borked". (Perhaps some phone-internal service has crashed/hung).

I have this occurring on an iPhone 8 running 15.0.1. Host is Ubuntu LTS, so this isn't an Xcode interaction. 20 other devices are connected concurrently on the same machine, and are stable and respond to go-ios commands, so it's not inherently usbmuxd related (unless usbmuxd can leak per-device resources?). tidevice commands for "ps" and "launch" also fail on this device, so it's not go-ios implementation specific.

Device started off working and launching processes, and communication continues to the device over existing go-ios tunnels in spite of the inability to launch new processes via go-ios. Appear to be able to launch new tunnels, and other functionality works. Agreeing with comments above, impacted commands are minimally "ps", "kill", and "launch", leaving me to suspect that a reboot is probably the only recourse for recovery.

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

4 participants