Ошибка failed on data local tmp permission denied

Update 8 years later

On modern versions of Android, there is no way to run downloaded or generated code (a.k.a. W^X violation). We can only embed prebuilt binaries in the APK (or bundle) (using jniLibs and other settings in gradle.build) and make sure it is extracted to the native file system (explicitly set android:extractNativeLibs = «true»). Then you can run the binary from getContext().getApplicationInfo().nativeLibraryDir.


If I understand the scenario correctly, you create the script on the fly, and use /data/local/tmp as an easy location that is both publicly writable and executable. Once, this was possible. But on recent versions of Android, security has been tightened.

Your app can execute files under /data/data/${your.package}. You can use getContext().getFilesDir() to reliably obtain the full path. Note that you still need to use chmod 500 to ensure that the file has executable permission.

If you have some fixed executables (binaries or scripts) that must be installed with your app, there is a clever trick to let the system package installer take care of all that for you: make sure the file has a name «libsomething.so» and put it in /libs/armeabi directory under the Eclipse project root. After installation, the files will be present in getContext().getApplicationInfo().nativeLibraryDir directory with executable permissions set.


PS You don’t need the WRITE_EXTERNAL_STORAGE permission for this to work (maybe you need it for other things your app does).


PPS You can run a shell script from anywhere, including /sdcard, and you don’t need executable permission for the script. Instead, use sh -c source full.path.to.script.

Steps to Reproduce

Running current master/head on Android device of hello_services

Logs

Running 'gradlew assembleDebug'...                    5.3s
Built app-debug.apk (23.2MB).
Uninstalling old version...
Installing android/app/build/outputs/apk/app.apk...  13.5s
E/DartVM  ( 8765): vm-service: Error: Unhandled exception:
E/DartVM  ( 8765): FileSystemException: Creation of temporary directory failed, path = '/data/local/tmp' (OS Error: Permission denied, errno = 13)
E/DartVM  ( 8765): #0      _Directory.createTemp.<anonymous closure> (directory_impl.dart:128)
E/DartVM  ( 8765): #1      _RootZone.runUnary (dart:async/zone.dart:1404)
E/DartVM  ( 8765): #2      _FutureListener.handleValue (dart:async/future_impl.dart:131)
E/DartVM  ( 8765): #3      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:637)
E/DartVM  ( 8765): #4      _Future._propagateToListeners (dart:async/future_impl.dart:667)
E/DartVM  ( 8765): #5      _Future._completeWithValue (dart:async/future_impl.dart:477)
E/DartVM  ( 8765): #6      _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:528)
E/DartVM  ( 8765): #7      _microtaskLoop (dart:async/schedule_microtask.dart:41)
E/DartVM  ( 8765): #8      _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
E/DartVM  ( 8765): #9      _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
E/DartVM  ( 8765): #10     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)
E/DartVM  ( 8765): 
E/flutter ( 8765): [ERROR:../../flutter/runtime/dart_init.cc(129)] Isolate vm-service exited with an error
E/flutter ( 8765): [ERROR:../../lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter ( 8765): FileSystemException: Creation of temporary directory failed, path = '/data/local/tmp' (OS Error: Permission denied, errno = 13)
E/flutter ( 8765): #0      _Directory.createTemp.<anonymous closure> (directory_impl.dart:128)
E/flutter ( 8765): #1      _RootZone.runUnary (dart:async/zone.dart:1404)
E/flutter ( 8765): #2      _FutureListener.handleValue (dart:async/future_impl.dart:131)
E/flutter ( 8765): #3      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:637)
E/flutter ( 8765): #4      _Future._propagateToListeners (dart:async/future_impl.dart:667)
E/flutter ( 8765): #5      _Future._completeWithValue (dart:async/future_impl.dart:477)
E/flutter ( 8765): #6      _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:528)
E/flutter ( 8765): #7      _microtaskLoop (dart:async/schedule_microtask.dart:41)
E/flutter ( 8765): #8      _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
E/flutter ( 8765): #9      _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
E/flutter ( 8765): #10     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)
Error initializing DevFS: TimeoutException: Request to Dart VM Service timed out: _createDevFS({fsName: hello_services})

Flutter Doctor

[✓] Flutter (on Mac OS, channel master)
    • Flutter at /Users/joel/dev_3rd/flutter
    • Framework revision 198d293857 (32 hours ago), 
    • Engine revision f306a6f701
    • Tools Dart version 1.22.0-dev.10.6

[✓] Android toolchain - develop for Android devices (Android SDK 25.0.0)
    • Android SDK at /Users/joel/dev_3rd/android-sdk-macosx/
    • Platform android-25, build-tools 25.0.0
    • ANDROID_HOME = /Users/joel/dev_3rd/android-sdk-macosx/
    • Java(TM) SE Runtime Environment (build 1.8.0_60-b27)

[✓] iOS toolchain - develop for iOS devices (Xcode 8.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer/
    • Xcode 8.2.1, Build version 8C1002
    • ios-deploy 1.9.0

[✓] IntelliJ IDEA Ultimate Edition (version 2016.3)
    • Dart plugin version 163.7743.25
    • Flutter plugin version 0.1.5

[✓] Connected devices
    • XT1060 • T062005DI0 • android-arm • Android 5.1 (API 22)

*

*

*

*

-

18 сентября 2012 13:39 | Просмотров: 206273 |
Кайф
в

Программы

Программа для получения прав ROOT в китайских смартфонах на ОС Android.

В данной статье я опишу процесс получения прав ROOT с помощью программы MTKdroidTools . В архиве с этой программой лежат и драйвера которые могут пригодиться, если ваш компьютер не нашел автоматически драйвера под ваш смартфон.

Скачиваем программу MTKdroidTools по ссылкам находящимся внизу статьи. Распаковываем архив и запускаем установку программы MTKdroidTools.exe.

Теперь запускаем программу и переходим к подготовке телефона.

В телефоне нужно активировать отладку по USB, для этого заходим в

Параметры — параметры разработчика — отладка по USB — ставим галочку!

Подключаем наш смартфон к компьютеру и ожидаем пока слева внизу в программе

MTK Droid Root & Tools не появится надпись кабель подключен, и в это же время появится кнопка ROOT, далее ожидам пока программа не выдаст запрос “Установить su, superuser, rootexplorer?” Нажимаем подтвердить, и ожидаем окончания процесса.

 Если же телефон не определился программой, проверьте в диспетчере устройств, не висит ли напротив нашего смартфона значёк указывающий на отсутствие драйверов? Нажимаете правой кнопкой мыши на устройство и нажимаете установить драйвера, после чего указываете путь к файлам драйверов, которые расположены в архиве. Не забудьте предварительно их распаковать!

После получения прав суперюзера на вашем смартфоне, могут наблюдаться притормаживания и зависания, для того чтоб они прошли нужно просто перезагрузить ваш смартфон!

Скачать можно тут, тут MTKdroidTools_v225

Скачать MTKdroidToolsV2.34

Скачать MtkDroidTools_v237

Скачать MtkDroidTools_v243

Скачать MtkDroidTools_v244

Скачать MtkDroidTools_v245

Скачать MtkDroidTools_v246

Скачать MtkDroidTools_v247

Скачать MtkDroidTools_v248

Скачать последнюю версию MtkDroidTools

score:0

I think the reason is that your Andorid is not been rooted.
the «/data» have the root Permission.
So root your phone first, and give your app the permission.
you can try command:»su» int the shell change to root.

score:0

Make sure the /data/local/tmp location is world-executable on your device:

adb shell ls -ld /data/ /data/local/ /data/local/tmp/

drwxrwx--x system   system            XXXX-XX-XX XX:XX
drwxr-x--x root     root              XXXX-XX-XX XX:XX
drwxrwx--x shell    shell             XXXX-XX-XX XX:XX
#        ^ all x here == OK!

If it’s not, there’s nothing you can do, and you need to use the standard storage (internal /data/data/{package} or external /sdcard/).

Make sure you made the file world-readable.

adb shell chmod o+r /data/local/tmp/myfile.txt

You don’t need any permissions.

score:2

You can use the adb interface to copy and/or push files to the /data/local/tmp folder but if you want to use/see them in the terminal app you will need to (in adb interface) first

cd /data/local/tmp 

then make a folder inside the folder. Example

mkdir folder 

next change the permissions

chmod - R 777 folder 

Now you have a folder you can read and write to.

A few things that I would like to know is how to make the system think that the su binary is in the /system/bin folder (without copying) because I can only get tmp… root access because even with root access, I can not remount the system directory as rw because the zte-paragon has its system partition formatted as a read-only file-system

score:12

If I understand the scenario correctly, you create the script on the fly, and use /data/local/tmp as an easy location that is both publicly writable and executable. Once, this was possible. But on recent versions of Android, security has been tightened.

Your app can execute files under /data/data/${your.package}. You can use getContext().getFilesDir() to reliably obtain the full path. Note that you still need to use chmod 500 to ensure that the file has executable permission.

If you have some fixed executables (binaries or scripts) that must be installed with your app, there is a clever trick to let the system package installer take care of all that for you: make sure the file has a name «libsomething.so» and put it in /libs/armeabi directory under the Eclipse project root. After installation, the files will be present in getContext().getApplicationInfo().nativeLibraryDir directory with executable permissions set.


PS You don’t need the WRITE_EXTERNAL_STORAGE permission for this to work (maybe you need it for other things your app does).


PPS You can run a shell script from anywhere, including /sdcard, and you don’t need executable permission for the script. Instead, use sh -c source full.path.to.script.

Related Query

  • Request Permission Location at Runtime for Android Marshmallow 6.0 webview
  • Https use a certificate from local raw file for android studio
  • android serverSocket initialisation causing permission denied exception in service(remote)
  • Android asks for USB access permission twice
  • Android 6.0 File write permission denied
  • Ask for runtime permission only for Android Marshmallow?
  • How to handle App permission pop ups (system popups like device location/contact list) in Appium android tests for OS Marshmallow and above?
  • a LocalSocket (Unix domain) client-server data flow issue for MediaRecorder in Android (Java)
  • Permission Denied when editing alternatives for java jdk
  • Parsing JSON data in Java for Android
  • Which way of saving user data should I use for my Android app?
  • Android runtime permission keep getting denied
  • Android MANAGE_EXTERNAL_STORAGE permission reject by Google playstore for social networking app
  • How to create local folder for program data on Windows (in %APPDATA%, without granting permissions, JAVA)
  • Cannot read data from firebase — Firebase DatabaseError: Permission denied
  • Looking for a way to save game data in my text based game in android studio (java)
  • Training data for digit recognition on Android with OpenCV
  • Setting custom info window for markers of google map with data from JSON android
  • Android USB Host not able to read and write data for Cp2102SerialDriver
  • Android best method for storing and retrieving lists of data
  • Local data store for small data with high performance
  • Data structure for songs in Android
  • how to check data consumption for particular network in Android
  • Android Studio, unable to access data folder for database file on emulator
  • Should I use a listener interface or handler for event callbacks in Android development?
  • Fastest data structure in Java (Processing for 4D visualization)
  • Why does the Android maps compass demo use a delegate for the SmoothCanvas class?
  • System requirements for Cometd/Bayeux Usage on Android
  • Convert Permission Mask to Roles for GetPermissionCollection
  • Java data object for bidirectional I/O

More Query from same tag

  • String replacement when regex reverse group is null in java
  • What is this strange inheritance loop?
  • Jackson — Java Objects with List<Map<String,String>> to Json String conversion
  • How to configure correct timezone in JDBC?
  • How to set s:hidden value from another JSP element
  • Access to base class method only from the derived class
  • Regex mach letters inside statement to make a word
  • Maven error: unmappable character for encoding Cp1251
  • SVG To Multipage PDF
  • Does it needs to pass username:password combination in any request with basic auth?
  • Java container that works as a Pod not working in a Job
  • Using Slider to rotate Object In java
  • How to format string in java with Formatter
  • Add a button over image
  • Cannot resolve public method setFrequencyBand in WifiManager class
  • Libgdx JSON custom serialization of Array<Vector2>
  • Get only positive long from murmur3 guava
  • JAVA — How to access variables inside a FOR loop, from outside the for loop
  • Oracle ADF Comparison 11g vs 12c and integrating with modern coding techniques
  • Multiple JSliders activating and deactivating — Sharing values
  • Does JAX-RS Support Input Streaming?
  • How to programmatically change title bar colour to hex value?
  • Generate a excel using java and create a macro in the excel
  • Java — Split String to get decimal number
  • Domino Server Log — JVM Error
  • Recording sound sent to speakers
  • Server encountered an internal error,the exception is org.apache.jasper.JasperException: Unable to compile class for JSP
  • Enable pdf caching in IE
  • Filter and translating functionality for a custom map with Java 8
  • why these two sources calculate different sha-1 sums

I am trying to run a shell script through an android app. The script has a command which just runs a jar on the device. When I run this command directly on the shell using adb, everything works fine. But when I run it through the script using the android app, I get a permission denied exception (open failed: EACCES (Permission denied)) for the files created in /data/local/tmp folder. Can anyone guide in how to resolve this issue?

This is what my manifest looks like

<manifest ….>
   <uses-sdk …>
    <uses-permission… .>
    …
    <uses-permission  android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    …
    <application …>
    …
    </application>
</manifest>

Thanks.

4 Answers

If I understand the scenario correctly, you create the script on the fly, and use /data/local/tmp as an easy location that is both publicly writable and executable. Once, this was possible. But on recent versions of Android, security has been tightened.

Your app can execute files under /data/data/${your.package}. You can use getContext().getFilesDir() to reliably obtain the full path. Note that you still need to use chmod 500 to ensure that the file has executable permission.

If you have some fixed executables (binaries or scripts) that must be installed with your app, there is a clever trick to let the system package installer take care of all that for you: make sure the file has a name «libsomething.so» and put it in /libs/armeabi directory under the Eclipse project root. After installation, the files will be present in getContext().getApplicationInfo().nativeLibraryDir directory with executable permissions set.


PS You don’t need the WRITE_EXTERNAL_STORAGE permission for this to work (maybe you need it for other things your app does).


PPS You can run a shell script from anywhere, including /sdcard, and you don’t need executable permission for the script. Instead, use sh -c source full.path.to.script.

You can use the adb interface to copy and/or push files to the /data/local/tmp folder but if you want to use/see them in the terminal app you will need to (in adb interface) first

cd /data/local/tmp 

then make a folder inside the folder. Example

mkdir folder 

next change the permissions

chmod - R 777 folder 

Now you have a folder you can read and write to.

A few things that I would like to know is how to make the system think that the su binary is in the /system/bin folder (without copying) because I can only get tmp… root access because even with root access, I can not remount the system directory as rw because the zte-paragon has its system partition formatted as a read-only file-system

I think the reason is that your Andorid is not been rooted.
the «/data» have the root Permission.
So root your phone first, and give your app the permission.
you can try command:»su» int the shell change to root.

Make sure the /data/local/tmp location is world-executable on your device:

adb shell ls -ld /data/ /data/local/ /data/local/tmp/

drwxrwx--x system   system            XXXX-XX-XX XX:XX
drwxr-x--x root     root              XXXX-XX-XX XX:XX
drwxrwx--x shell    shell             XXXX-XX-XX XX:XX
#        ^ all x here == OK!

If it’s not, there’s nothing you can do, and you need to use the standard storage (internal /data/data/{package} or external /sdcard/).

Make sure you made the file world-readable.

adb shell chmod o+r /data/local/tmp/myfile.txt

You don’t need any permissions.

Понравилась статья? Поделить с друзьями:
  • Ошибка failed creating d3d device
  • Ошибка fail при прошивке один
  • Ошибка fail на сигнализации scher khan при автозапуске
  • Ошибка fail to run the game
  • Ошибка fail to initialize hardware