Closed smarqito closed 4 years ago
https://github.com/smarqito/3bcMobile doesn't exist (or maybe it's a private repo).
Can you create plain files in /data/data/com.myapp/files
? Can post paste the relevant section of the Android log (adb logcat
), please.
https://github.com/smarqito/3bcMobile doesn't exist (or maybe it's a private repo).
1760 is about external storage, and it seems like you are not using that, right?
Can you create plain files in
/data/data/com.myapp/files
? Can post paste the relevant section of the Android log (adb logcat
), please.
Well it's a private repo, I've just shared the repo with you (it has some private info I don't want to be public). Please use the master branch. In the second branch I'm working with sqlite (since I'm stuck with realm).
I've tested the app with <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
just in case but it doesn't work anyway.
The app is creating the files in /data/data/com.myapp/files
:
ReactNativeDevBundle.js default.realm default.realm.lock default.realm.management
Manually, I created through adb shell
-> run-as com.myApp
-> touch test.js
and it created the file, no errors
Please find the log from the moment previous to the realm loading:
E/Vold ( 257): Failed to find mounted volume for /storage/sdcard1/Android/data/com.my3bc/cache/ I/Adreno-EGL(20682): <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: Nondeterministic_AU_msm8916_32_LA.BR.1.2.4_RB1__release_AU (Ibddc658e36) I/Adreno-EGL(20682): OpenGL ES Shader Compiler Version: E031.25.03.04 I/Adreno-EGL(20682): Build Date: 09/08/15 Tue I/Adreno-EGL(20682): Local Branch: mybranch13903027 I/Adreno-EGL(20682): Remote Branch: quic/LA.BR.1.2.4_rb1.17 I/Adreno-EGL(20682): Local Patches: NONE I/Adreno-EGL(20682): Reconstruct Branch: NOTHING **W/ContextImpl(20682): Failed to ensure directory: /storage/sdcard1/Android/data/com.my3bc/cache** I/OpenGLRenderer(20682): Initialized EGL, version 1.4 **D/SoLoader(20682): About to load: librealmreact.so D/SoLoader(20682): librealmreact.so not found on /data/data/com.my3bc/lib-main D/SoLoader(20682): librealmreact.so found on /data/app/com.my3bc-2/lib/arm D/SoLoader(20682): Not resolving dependencies for librealmreact.so D/OpenGLRenderer(20682): Enabling debug mode 0 D/SoLoader(20682): Loaded: librealmreact.so V/JSRealm (20682): setDefaultRealmFileDirectory D/JSRealm (20682): Absolute path: /data/data/com.my3bc/files** D/ReactNative(20682): Initializing React Xplat Bridge. D/ReactNative(20682): Initializing React Xplat Bridge before initializeBridge D/ReactNative(20682): Initializing React Xplat Bridge after initializeBridge D/ReactNative(20682): CatalystInstanceImpl.runJSBundle() D/ReactNative(20682): ReactInstanceManager.setupReactContext() D/ReactNative(20682): CatalystInstanceImpl.initialize() D/ReactNative(20682): ReactInstanceManager.attachRootViewToInstance() W/unknown:ReactNative(20682): Packager connection already open, nooping. I/Timeline(20682): Timeline: Activity_idle id: android.os.BinderProxy@2a0492d9 time:11682212 I/ActivityManager( 1589): Displayed com.my3bc/.MainActivity: +632ms I/Timeline( 1589): Timeline: Activity_windows_visible id: ActivityRecord{3b7969c2 u0 com.my3bc/.MainActivity t747} time:11682215 D/ConnectivityService( 1589): onUidRulesChanged(uid=10024, uidRules=0) W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.art.ARTGroupViewManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.art.ARTGroupShadowNode W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.art.ARTShapeViewManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.art.ARTShapeShadowNode W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.art.ARTTextViewManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.art.ARTTextShadowNode W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.checkbox.ReactCheckBoxManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.uimanager.LayoutShadowNode W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.picker.ReactDialogPickerManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.drawer.ReactDrawerLayoutManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.picker.ReactDropdownPickerManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollViewManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollContainerViewManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.progressbar.ReactProgressBarViewManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.progressbar.ProgressBarShadowNode W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.scroll.ReactScrollViewManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager$ReactSliderShadowNode W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager$ReactSwitchShadowNode W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.toolbar.ReactToolbarManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.webview.ReactWebViewManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.art.ARTSurfaceViewManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.art.ARTSurfaceViewShadowNode W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageShadowNode W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.image.ReactImageManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.modal.ReactModalHostManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.modal.ModalHostShadowNode W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.text.ReactRawTextManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.text.ReactRawTextShadowNode W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputManager I/SurfaceFlinger( 259): FPS: 45 W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputShadowNode W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.text.ReactTextViewManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.text.ReactTextShadowNode W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.view.ReactViewManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.viewpager.ReactViewPagerManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextShadowNode W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.swmansion.gesturehandler.react.RNGestureHandlerRootViewManager W/unknown:ViewManagerPropertyUpdater(20682): Could not find generated setter for class com.swmansion.gesturehandler.react.RNGestureHandlerButtonViewManager D/SoLoader(20682): About to load: libyoga.so D/SoLoader(20682): libyoga.so not found on /data/data/com.my3bc/lib-main D/SoLoader(20682): libyoga.so found on /data/app/com.my3bc-2/lib/arm D/SoLoader(20682): Not resolving dependencies for libyoga.so D/SoLoader(20682): Loaded: libyoga.so D/SoLoader(20682): init exiting E/WifiStateMachine( 1589): WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=1,41 rxSuccessRate=0,83 targetRoamBSSID=any RSSI=-61 I/WebViewFactory(20682): Loading com.android.webview version 39 (eng.john-arm) (code 399991) I/LibraryLoader(20682): Time to load native libraries: 3 ms (timestamps 3281-3284) I/LibraryLoader(20682): Expected native library version number "",actual native library version number "" W/art (20682): Attempt to remove local handle scope entry from IRT, ignoring I/SurfaceFlinger( 259): FPS: 4 W/mqt_js (20716): type=1400 audit(0.0:1374): avc: denied { create } for name="access_control.new_commit.cv" scontext=u:r:untrusted_app:s0 tcontext=u:object_r:xt_data_file:s0 tclass=fifo_file permissive=0 **E/ReactNativeJS(20682): Read-only file system E/ReactNativeJS(20682): Module AppRegistry is not a registered callable module (calling runApplication)** I/ViewRootImpl(20682): CPU Rendering VSync enable = true V/WindowManager( 1589): not Base app: Adding window Window{1b6fa117 u0 com.my3bc/com.my3bc.MainActivity} at 4 of 8 V/WLAN_PSA( 283): NL MSG, len[4089], NL type[0x1C] WNI type[0x5900] len[57615] V/WLAN_PSA( 283): NL MSG, PID: 283 V/WLAN_PSA( 283): NL MSG, len[048], NL type[0x11] WNI type[0x5050] len[028] V/WLAN_PSA( 283): NL MSG, PID: 283
Can this be due to Android 5.1.1 is SDK 22 and Realm pre-requisites are SDK 23+? Is there anyway to go around that?
If I go to build.gradle I find: `android { compileSdkVersion 28
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
}`
Thank you for your help. This has froze my app development.
I've been reading the log a bit closer and found this:
avc: denied { create } for name="access_control.new_commit.cv" scontext=u:r:untrusted_app:s0 tcontext=u:object_r:xt_data_file:s0 tclass=fifo_file permissive=0
And then it returns the error read-only file system.
Can it be due to this?
Realm JS supports SDK 16 (and I think we can go even further back) so Android 5.1.1 should be fine.
The log entry as you mention is a SELinux violation, and I think it is the root of your issue. I have found https://stackoverflow.com/questions/44743797/selinux-android-message-intrepetion but it has no solution. As you can see, the issue is with a Realm file too.
Actually I think it is the same issue as https://github.com/realm/realm-java/issues/5790.
Which device are you testing on?
@smarqito Did you manage to reproduce the issue on a stock emulator with Android 5.1.1
? this could be related to a custom ROM not defining the SELinux permission correctly ...
@nhachicha I haven't tried until now and it seems to be working on the emulator with android 5.1.1. In the meanwhile I've tested SQLite and it works properly in the device that Realm bugs (no file error). Having this, what might realm.js (under react-native) be doing that returns that error and SQLite doesn't? Is there any way to fix the SELinux permission in the custom ROM of that device?
@kneth the device I'm testing is an X64 PDA (with 2D barcode scanner)
what might realm.js (under react-native) be doing that returns that error and SQLite doesn't?
Realm internally creates some FIFO/pipe files (see https://github.com/realm/realm-js/issues/2442#issuecomment-510554415) to allow interprocess communication, similar to Realm-Java for instance, normally this shouldn't be a problem, but some custom ROM might have an SELinux configuration which prevents it.
You can try this which is opening the Realm in a different directory which might have the correct SELinux policies set which allows creating pipes ...
@nhachicha Is there anyway to check if there is any directory where SELinux allows creating pipes?
Maybe only having the SELinux config file?
@smarqito It can be rather complicated to get the SELinux configuration as it consists of many components (see https://source.android.com/security/selinux/build).
@kneth It took a while but I've already found the problem and how to solve it. The only issue is that I didn't manage to actually try it (not able to change SELinux configuration).
Once I've the feedback if the solution works I'll post here the steps I did to find the problem and the solution. In the meanwhile, for those who have the same problem, just do a simple test to verify if it's related to SEpolicy issue:
root the device, and run:
setenforce 0
<- this will set the SELinux to permissive mode: denials will only be logged, not enforced. If the app works this way, then it's a SEpolicy issue.
Thank you for your help.
@smarqito Thanks for the update.
Goals
Realm working in Android 5.1.1
Expected Results
Not understanding why realm returns read-only file system
Actual Results
Currently my app is running smoothly with realm in the emulator and in Samsung S9+. Now I'm testing it in an older device with android 5.1.1 and I can't use Realm.
I found this issue #1760 but it doesn't answer it. I'm using default path (/data/data/com.myapp/files/REALM FILES)
ERROR: ` Read-only file system