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

adb error: couldn't create file: Permission denied #53

Open
AlexandraMoga opened this issue Apr 27, 2023 · 4 comments
Open

adb error: couldn't create file: Permission denied #53

AlexandraMoga opened this issue Apr 27, 2023 · 4 comments

Comments

@AlexandraMoga
Copy link

Original report - mozilla/geckodriver#2092; please check comments there for additional logs

System

  • geckodriver Version: v0.32.2-win32
  • Platform: Windows 10
  • Firefox: Firefox Nightly 112.0a1 (Build #2015933405),
  • Appium: v2.0.0-beta.56 (Python client)

Testcase

I'm simply traying to launch Firefox on an android device (Pixel 5, Android 11 emulator with Android studio) using the capabilities suggested in this documentation but the session hangs and finally exists with error adb error: couldn't create file: Permission denied. I'm not sure if there is some issue at my side (capabilities are visible in the stacktrace) or if this is a geckodriver issue.

Stacktrace

[HTTP] --> POST /session
[HTTP] {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"appium:automationName":"Gecko","browserName":"Firefox","platformName":"windows","moz:firefoxOptions":{"androidPackage":"org.mozilla.fenix"}}}}
[debug] [AppiumDriver@20f2] Calling AppiumDriver.createSession() with args: [null,null,{"firstMatch":[{}],"alwaysMatch":{"appium:automationName":"Gecko","browserName":"Firefox","platformName":"windows","moz:firefoxOptions":{"androidPackage":"org.mozilla.fenix"}}}]
[debug] [AppiumDriver@20f2] Event 'newSessionRequested' logged at 1677594344443 (16:25:44 GMT+0200 (Eastern European Standard Time))
[Appium] Attempting to find matching driver for automationName 'Gecko' and platformName 'windows'
[Appium] The 'gecko' driver was installed and matched caps.
[Appium] Will require it at C:\Users\USER\.appium\node_modules\appium-geckodriver
[debug] [Appium] Requiring driver at C:\Users\USER\.appium\node_modules\appium-geckodriver
[AppiumDriver@20f2] Appium v2.0.0-beta.56 creating new GeckoDriver (v1.1.8) session
[AppiumDriver@20f2] Checking BaseDriver versions for Appium and GeckoDriver
[AppiumDriver@20f2] Appium's BaseDriver version is 9.3.2
[AppiumDriver@20f2] GeckoDriver's BaseDriver version is 9.3.2
[debug] [GeckoDriver@7133] Creating session with W3C capabilities: {
[debug] [GeckoDriver@7133]   "alwaysMatch": {
[debug] [GeckoDriver@7133]     "browserName": "Firefox",
[debug] [GeckoDriver@7133]     "platformName": "windows",
[debug] [GeckoDriver@7133]     "moz:firefoxOptions": {
[debug] [GeckoDriver@7133]       "androidPackage": "org.mozilla.fenix"
[debug] [GeckoDriver@7133]     },
[debug] [GeckoDriver@7133]     "appium:automationName": "Gecko"
[debug] [GeckoDriver@7133]   },
[debug] [GeckoDriver@7133]   "firstMatch": [
[debug] [GeckoDriver@7133]     {}
[debug] [GeckoDriver@7133]   ]
[debug] [GeckoDriver@7133] }
[GeckoDriver@7133 (736c9dd5)] Session created with session id: 736c9dd5-c0c3-4a40-99e2-a14304080bab
[GeckoDriver@7133 (736c9dd5)] Starting 'C:\Users\USER\AppData\Local\Programs\Python\Python39\geckodriver.exe' with args ["-p",5200]
[debug] [GeckoDriver@7133 (736c9dd5)] Matched '/status' to command name 'getStatus'
[debug] [GeckoDriver@7133 (736c9dd5)] Proxying [GET /status] to [GET http://127.0.0.1:5200/status] with no body
[GeckoDriver@7133 (736c9dd5)] connect ECONNREFUSED 127.0.0.1:5200
[debug] [GeckoDriver@7133 (736c9dd5)] [geckodriver.exe] 1677594345068   geckodriver     INFO    Listening on 127.0.0.1:5200
[debug] [GeckoDriver@7133 (736c9dd5)] Matched '/status' to command name 'getStatus'
[debug] [GeckoDriver@7133 (736c9dd5)] Proxying [GET /status] to [GET http://127.0.0.1:5200/status] with no body
[debug] [GeckoDriver@7133 (736c9dd5)] Got response with status 200: {"value":{"message":"","ready":true}}
[debug] [GeckoDriver@7133 (736c9dd5)] Matched '/session' to command name 'createSession'
[debug] [GeckoDriver@7133 (736c9dd5)] Proxying [POST /session] to [POST http://127.0.0.1:5200/session] with body: {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"browserName":"firefox","platformName":"windows","moz:firefoxOptions":{"androidPackage":"org.mozilla.fenix"}}}}
[debug] [GeckoDriver@7133 (736c9dd5)] [geckodriver.exe] 1677594353781   mozdevice       INFO    Device is rooted
[GeckoDriver@7133 (736c9dd5)] Got response with status 500: {"value":{"error":"unknown error","message":"adb error: couldn't create file: Permission denied","stacktrace":""}}
[debug] [W3C] Matched W3C error code 'unknown error' to UnknownError
[GeckoDriver@7133 (736c9dd5)] Ending Gecko Driver session
[GeckoDriver@7133 (736c9dd5)] geckodriver.exe has exited with code null, signal SIGTERM
[debug] [AppiumDriver@20f2] Event 'newSessionStarted' logged at 1677594393012 (16:26:33 GMT+0200 (Eastern European Standard Time))
[debug] [AppiumDriver@20f2] Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: adb error: couldn't create file: Permission denied
[debug] [AppiumDriver@20f2]     at errorFromW3CJsonCode (C:\Users\USER\AppData\Roaming\nvm\v18.14.2\node_modules\appium\node_modules\@appium\base-driver\lib\protocol\errors.js:1034:25)
[debug] [AppiumDriver@20f2]     at ProxyRequestError.getActualError (C:\Users\USER\AppData\Roaming\nvm\v18.14.2\node_modules\appium\node_modules\@appium\base-driver\lib\protocol\errors.js:909:14)
[debug] [AppiumDriver@20f2]     at GeckoProxy.command (C:\Users\USER\AppData\Roaming\nvm\v18.14.2\node_modules\appium\node_modules\@appium\base-driver\lib\jsonwp-proxy\proxy.js:340:19)
[debug] [AppiumDriver@20f2]     at processTicksAndRejections (node:internal/process/task_queues:95:5)
[debug] [AppiumDriver@20f2]     at GeckoDriverServer.start (C:\Users\USER\.appium\node_modules\appium-geckodriver\lib\gecko.js:205:5)
[debug] [AppiumDriver@20f2]     at GeckoDriver.createSession (C:\Users\USER\.appium\node_modules\appium-geckodriver\lib\driver.js:58:7)
[debug] [AppiumDriver@20f2]     at AppiumDriver.createSession (C:\Users\USER\AppData\Roaming\nvm\v18.14.2\node_modules\appium\lib\appium.js:349:35)
[HTTP] <-- POST /session 500 48605 ms - 1369
@mykola-mokhnach
Copy link
Contributor

mykola-mokhnach commented Apr 27, 2023

[GeckoDriver@7133 (736c9dd5)] Got response with status 500: {"value":{"error":"unknown error","message":"adb error: couldn't create file: Permission denied","stacktrace":""}}

As you can see there the error os coming from geckodriver itself. You could assign the verbosity capability to trace in order to see more detailed geckodriver output and attach the resulting log here

@mykola-mokhnach
Copy link
Contributor

also I can observe this error in the linked issue report:

[debug] [GeckoDriver@03b7 (1d39ac55)] 1677837573945 mozdevice TRACE execute_host_command: >> "shell:su 0 chmod -R 777 /sdcard/Android/data/org.mozilla.fenix/files/test_root/org.mozilla.fenix-geckodriver-profile"

have you tried to run it manually from the terminal? what was the output?

@AlexandraMoga
Copy link
Author

So, if I run adb shell "su 0 chmod -R 777 /sdcard/Android/data/org.mozilla.fenix/files/test_root/org.mozilla.fenix-geckodriver-profile" from the terminal I receive a No such file or directory response.
If I check the emulator file system, I can see that these files don't exist on the sdcard. Also, given the fact that the emulator is rooted, shouldn't internal storage take precedence when a new file is created? I am a bit confused why the program chooses the external storage.

@mykola-mokhnach
Copy link
Contributor

mykola-mokhnach commented May 2, 2023

I don't know. I assume there might be some bug in the geckodriver itself, so it verifies folder existence first or runs mkdir -p before running chmod

You could probably also play with appium:androidStorage capability value

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

2 participants