acomminos / Mountie

A tool for mounting external storage on Android.
GNU General Public License v3.0
22 stars 6 forks source link

Don't work on HTC Nexus 9 #1

Open ghost opened 9 years ago

ghost commented 9 years ago

When I start the application with a stick plugged in, it does not even start. The "Mountie" application always crashes when I try to open it. I own a HTC Nexus 9 with root installed. Do you need any further information?

PS: I want to use this app because I don't want to use a proprietary app. :-)

rutsky commented 9 years ago

Doesn't work on Nexus 5 either. App shows welcome string, but does nothing.

Here is what alogcat shows just after booting phone:

W/PackageManager(  785): Not granting permission android.permission.MOUNT_UNMOUNT_FILESYSTEMS to package org.brandroid.openmanager (protectionLevel=18 flags=0x18be44)
W/PackageManager(  785): Unknown permission android.permission.ACCESS_SUPERUSER in package com.morlunk.mountie
W/PackageManager(  785): Not granting permission android.permission.MOUNT_UNMOUNT_FILESYSTEMS to package com.cyanogenmod.filemanager.ics (protectionLevel=18 flags=0x18be44)
I/SystemServer(  785): Mount Service
D/MountService(  785): got storage path: null description: Internal storage primary: false removable: false emulated: true mtpReserve: 100 allowMassStorage: false maxFileSize: 0
D/MountService(  785): addVolumeLocked() StorageVolume:
D/MountService(  785):     mStorageId=65537 mPath=/storage/emulated/0 mDescriptionId=17040805 
D/MountService(  785):     mPrimary=true mRemovable=false mEmulated=true mMtpReserveSpace=100 
D/MountService(  785):     mAllowMassStorage=false mMaxFileSize=0 mOwner=UserHandle{0} mUuid=null 
D/MountService(  785):     mUserLabel=null mState=null 
W/PackageManager(  785): Not granting permission android.permission.MOUNT_UNMOUNT_FILESYSTEMS to package org.brandroid.openmanager (protectionLevel=18 flags=0x18be44)
W/PackageManager(  785): Unknown permission android.permission.ACCESS_SUPERUSER in package com.morlunk.mountie
W/PackageManager(  785): Not granting permission android.permission.MOUNT_UNMOUNT_FILESYSTEMS to package com.cyanogenmod.filemanager.ics (protectionLevel=18 flags=0x18be44)
W/MountService(  785): Duplicate state transition (mounted -> mounted) for /storage/emulated/0
W/PackageManager(  929): Failure retrieving resources for com.morlunk.mountie: Resource ID #0x0
I/k9      ( 2175): Registered: unmount receiver
I/ActivityManager(  785): Start proc 2522:com.morlunk.mountie/u0a158 for broadcast com.morlunk.mountie/.MountieBootReceiver
W/XPrivacy( 2522): Hooking package=com.morlunk.mountie
W/morlunk.mountie( 2522): type=1400 audit(0.0:9): avc: denied { read } for name="block" dev="tmpfs" ino=5796 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:block_device:s0 tclass=dir
E/Mountie ( 2522): Failed to call blkid!
rutsky commented 9 years ago

I'm using rooted Nexus 5 with Android 5.1.1 with SuperSU v2.46, and during (not yet finished) debug I found that in my configuration:

  1. Mountie fails to mount ext4 filesystem, because it tries to mount it with rw,nosuid,nodev,fmask=0000,dmask=0000,utf8 options, and ext4 doesn't allow fmask, dmask and utf8 options.
  2. Looks like Mountie doesn't detect when device is attached over OTG in runtime. I see attempts to mount only at Mountie startup.
  3. New versions of SuperSU uses mount namespace separation, so even if Mountie manages to mount device, it will not be visible for other application. Mount namespace separation can be disabled in SuperSU settings.
rutsky commented 9 years ago
  1. Even if partition will be mounted with disabled SuperSU namespace separation, I can't read or write files on mounted device --- it fails with permission denied error, looks like some SELinux issue (since regular filesystem permissions should allow reading/writing as I see).
rutsky commented 9 years ago

I managed to get Mountie work on my phone and used it on vacation to copy over 600 GB of photos/videos from SD-cards to external HDD using USB hub and OTG. There was problems with Android performance/memory usage while copying, but Mountie worked like a charm, thanks @acomminos !

I opened PRs with fixes that I've done:

  1. Fix issue with mounting ext4 filesystem in PR #2.
  2. Workaround not working FileObserver of /dev/ by adding button to manually scan for new devices in PR #4.
  3. Opened issue #5 about documenting required SuperSU configuration to override mount namespace separation.

Mentioned in previous comment issue with permissions was my mistake --- looks like I had incorrect permissions on root directory of newly created ext4 filesystem on HDD.

I had issues with building Mountie on recent versions of Android Studio. I workarounded them using StackOverflow answers in https://github.com/rutsky/Mountie/commit/63fb131a5169abfc021f4231aa784aedebb6b7ba , but not sure that these modification are correct, since I'm not familiar with Android development.

In case Mountie development is stopped I published APK file with version with my patches that worked on my phone: https://github.com/rutsky/Mountie/releases/tag/v1.0rutsky1. If you, @mwuttke97, still interested in Mountie, you can try my version.

acomminos commented 9 years ago

Thanks @rutsky! I haven't had much time to work on this project recently, so your contributions are much appreciated. I'll look into the necessary steps to ignore mount namespace separation with SuperSU.