Coder Social home page Coder Social logo

adbfs-rootless's Introduction

This variant of adbfs works even WITHOUT having root access (busybox) on your phone!

Instructions:

You will need libfuse-dev and adb. You will also need build-essential, git, and pkg-config. On Ubuntu:

sudo apt-get install libfuse-dev android-tools-adb
sudo apt-get install build-essential git pkg-config

Clone the repository:

git clone [email protected]:spion/adbfs-rootless.git
cd adbfs-rootless    

Build:

make

Optional: If you have a separate copy of android-sdk and would like to use that adb, copy the binary adbfs to the android-sdk/platform-tools directory. If platform-tools is in your $PATH you can skip this step.

Create a mount point if needed (e.g. in your home directory):

mkdir ~/droid

You can now mount your device (also from the platform-tools dir):

./adbfs ~/droid

If you want to trigger a media rescan after every operation, use the option -o rescan:

./adbfs -o rescan ~/droid

Have fun!

Troubleshooting

Error: device not found

When running you get the following error:

--*-- exec_command: adb shell ls
error: device not found

Solution: Make sure that USB Debugging is enabled.

Then fusermount -u /media/mount/path before trying again. Note that if for any reason fusermount is not available in your system, you can use sudo umount /media/mount/path instead.

Error: device offline

When running you get the following error:

--*-- exec_command: adb shell ls
error: device offline

Solution: Make sure that

  1. Your android-sdk-tools are up to date. Newer versions of Android also require newer versions of adb. For more info, see this Stack Overflow post.

  2. You answer Yes when your phone asks whether it should allow the computer with the specified RSA key to access the device.

Then killall -9 adb; fusermount -u /media/mount/path before trying again.

adbfs-rootless's People

Contributors

anatol avatar chaw avatar code7r avatar dandv avatar funnyflowerpot avatar ge0rg avatar i026e avatar isieo avatar kickertom avatar lonami avatar martin-ueding avatar nicolas-raoul avatar parke avatar perenecabuto avatar quezak avatar rbmj avatar rgson avatar rzr avatar sla-000 avatar spion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adbfs-rootless's Issues

Error for files with backticks in name: unexpected EOF while looking for matching ``

If I have a file which name contains backtick (`), then I can't open this file. For example I have file /storage/0403-0201/E`kzamen, then adbfs will print the following error:

--*-- exec_command: adb shell "ls -l -a -d '/storage/0403-0201/E`kzamen'" 2>&1
sh: -c: line 0: unexpected EOF while looking for matching ``'
sh: -c: line 1: syntax error: unexpected end of file

The solution would be to escape backtick, so the command becomes adb shell "ls -l -a -d '/storage/0403-0201/E\`kzamen'"

Read-only mode

Hello, although I have tried this and loved it, I desperately would like a read only option for safety measurements. The read only option would only allow reading the contents of the device with adb, and no creating or deleting or moving anything from the device. As I use ADB Root this is even more important, I don’t want to lose my system files at all.

Error if spaces in file\folder's name

Hello.
In case name has space I see it with slash. As result it cant be copied or navigate (if it a folder):

 ┌<─ ~/droid/storage/self/primary 
 │.n                              
 │/..                             
 │/Android                        
 │/DCIM                           
 │/Money\ Pro                     

Ubuntu 16.04.6 LTS
Nexus 5
Android 9 (LinageOS 16.0-20190719)

make warning

$ make
g++ -c -o adbfs.o adbfs.cpp -Wall -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse
adbfs.cpp: In function ‘int adb_readlink(const char*, char*, size_t)’:
adbfs.cpp:966:35: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  966 |     for (num_slashes = ii = 0; ii < strlen(path); ii++)
      |                                ~~~^~~~~~~~~~~~~~
g++ -o adbfs adbfs.o -Wall -lfuse -pthread

Useless permission denied errors

When I execute adbfs, I get this in stdout:

--*-- exec_command: adb shell "ls"
ls: ./verity_key: Permission denied
ls: ./ueventd.rc: Permission denied
ls: ./ueventd.qcom.rc: Permission denied
ls: ./service_contexts: Permission denied
ls: ./sepolicy: Permission denied
ls: ./selinux_version: Permission denied
ls: ./seapp_contexts: Permission denied
ls: ./init.zygote32.rc: Permission denied
ls: ./init.usb.rc: Permission denied
ls: ./init.usb.configfs.rc: Permission denied
ls: ./init.target.rc: Permission denied
ls: ./init.rc: Permission denied
ls: ./init.qcom.usb.sh: Permission denied
ls: ./init.qcom.usb.rc: Permission denied
ls: ./init.qcom.syspart_fixup.sh: Permission denied
ls: ./init.qcom.sh: Permission denied
ls: ./init.qcom.sensors.sh: Permission denied
ls: ./init.qcom.rc: Permission denied
ls: ./init.qcom.factory.rc: Permission denied
ls: ./init.qcom.early_boot.sh: Permission denied
ls: ./init.qcom.class_core.sh: Permission denied
ls: ./init.msm.usb.configfs.rc: Permission denied
ls: ./init.mdm.sh: Permission denied
ls: ./init.lenovo.target.rc: Permission denied
ls: ./init.lenovo.rc: Permission denied
ls: ./init.lenovo.log.rc: Permission denied
ls: ./init.lenovo.factory.rc: Permission denied
ls: ./init.lenovo.crash.rc: Permission denied
ls: ./init.lenovo.common.rc: Permission denied
ls: ./init.environ.rc: Permission denied
ls: ./init.class_main.sh: Permission denied
ls: ./init: Permission denied
ls: ./fstab.qcom: Permission denied
ls: ./file_contexts.bin: Permission denied
ls: ./default.prop: Permission denied

but since these are system-level files that nobody needs to access, they should simply be ignored instead of showing errors.

Don't grow unlimited in /tmp

Usually /tmp is in a tmpfs, so in ram. adbfs seems to cache data in /tmp without limit, so it fills my 16GiB of ram completly during a backup of my 64GiB internal memory of my phone.
adbfs should limit the data in /tmp somehow.

no contents in external SD card on Lollipop (5.1.1)?

Just tried the latest code on my Lollipop device (Wileyfox Swift, CyanogenOS 12.1/Android 5.1.1). Works fine so far, with one exception: contents of the external SD card are not shown. adb shell ls /storage/sdcard1 shows the content, which confuses me at this part – as I don't see how this should be different. adbfs -f doesn't give a clue (no output when changing to /storage/sdcard1). Permissions/ownership of the card are the same as for the internal one, which adbfs deals with just fine.

Device is connected in MTP mode. Same behavior if I switch to PTP. If I switch to charge-only, the device is no longer found by adb.

Any ideas?

fuse: unknown option `rellinks'

I get the following output:

% adbfs -o rellinks tmp/jennydroid
--*-- exec_command: adb shell "ls"
ls: ./init.rc: Permission denied
ls: ./init: Permission denied
ls: ./vndservice_contexts: Permission denied
ls: ./ueventd.rc: Permission denied
ls: ./plat_hwservice_contexts: Permission denied
ls: ./nonplat_service_contexts: Permission denied
ls: ./nonplat_hwservice_contexts: Permission denied
ls: ./module_hashes: Permission denied
ls: ./init.zygote32.rc: Permission denied
ls: ./init.usb.rc: Permission denied
ls: ./init.usb.configfs.rc: Permission denied
ls: ./init.recovery.qcom.rc: Permission denied
ls: ./init.qcom.build.rc: Permission denied
ls: ./init.environ.rc: Permission denied
ls: ./default.prop: Permission denied
fuse: unknown option `rellinks'
--*-- exec_command: rm -rf /tmp/adbfs-naugbp/

How do I enable rellinks?

Root is not required to unmount

This application claims to be rootless, yet it suggests to use sudo umount in the README which needs root access :P

I haven't tried (but have plans to use) this yet, but I think using fusermount -u <dir> should work. Just in case anyone finds this information useful.

Edit: Yep, not required, just tested.

du & ncdu show incorrect values

Hi,

I just recognized that du or ncdu show tiny values even on huge files or directories which are mounted via adbfs.
OTOH ls -l shows the correct file sizes.

Any ideas?

Any way to avoid having to rescan SD card after using adbfs?

Steps to reproduce the problem:

  1. Mount Android using adbfs-rootless
  2. Take a screenshot on Android
  3. Remove it via adbfs: rm adbfs-root-directory/sdcard/Pictures/Screenshots/Screenshot_20180725-210642.png
  4. The file is not visible anymore via adbfs, ls adbfs-root-directory/sdcard/Pictures/Screenshots/ shows nothing
  5. Reboot the phone (optional)
  6. On Android, open the stock gallery app: The screenshot is still visible, however opening it only shows some grey
  7. Connect via MTP (ex: Nautilus): The screenshot is still visible, however opening it triggers libmtp error: Could not get file from device.
  8. Run https://github.com/jerickson314/sdscanner
  9. The file has disappeared from the stock gallery and Nautilus

While adb commands have had this kind of issues for a long time, is there any way adbfs could improve things, or do you have any tip to avoid such problems?

If not, how about having adbfs run a local rescan (only for the modified files)? If rescan is possible via ADB that would be the best, if not adbfs could call an optional companion app installed on the device that would perform the rescan.

Timestamps are lost when copying to device

When copying files over adbfs to the device, timestamps are lost – the file shows up as were it just created anew on the device. This happens even when explicitly specifying to keep timestamps (e.g. rsync -rltDcu), without any error message being shown (and yes, I have to use -c there as otherwise timestamps would be messed up on the PC as well when synced back, despite of the -u). Same happens with cp or any other means of copying.

Is there any way to preserve times?

Cannot unmount: target is busy but permission denied

I have my phone mounted at /mnt/android, but it's in some weird state.

(ins)svelte ~# mount | grep /mnt/android
adbfs on /mnt/android type fuse.adbfs (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
(ins)svelte ~# umount /mnt/android
umount: /mnt/android: target is busy
        (In some cases useful info about processes that
         use the device is found by lsof(8) or fuser(1).)
(ins)svelte ~[32]# fuser -vm /mnt/android
Cannot stat /mnt/android: Permission denied
Cannot stat file /proc/20619/fd/3: Permission denied
(ins)svelte ~[1]# ls -ld ls -ld /mnt/android
ls: cannot access '/mnt/android': Permission denied
(ins)svelte ~[2]# ls -l /mnt | grep android
ls: cannot access '/mnt/android': Permission denied
d????????? ? ?    ?       ?            ? android
(ins)svelte ~# 

In bash (as the user I mounted it with), if I do:
echo /mnt/andr<tab>
The shell hangs permanently.

Encrypted device

Hello,

I am able the access to the storage but every folder has a lock on it.
I can not see any file inside.

Do you have any idea how to fix this issue ?

Thank you.

  • adb version : 1.0.41
  • Android version : 13

auto reconnect after losing connection or auto umount

At moment every time the mobile phone lost the connection because unplugging the USB you have to force umount the drive.

  • If USB got disconnected pause Data-transfer and wait until the phone appear on USB withing e.g.30s then auto reconnect. Otherwise, umount.

Unable to mount, Galaxy S8, Debian 10

Hi!

Tried to mount, failing with:

hydrandt@flow:~/Downloads/adbfs-rootless$ ./adbfs -f droid/
--*-- exec_command: adb shell "ls"
ls: ./vndservice_contexts: Permission denied
ls: ./vendor_service_contexts: Permission denied
ls: ./vendor_hwservice_contexts: Permission denied
ls: ./plat_hwservice_contexts: Permission denied
fuse: bad mount point `droid/': Transport endpoint is not connected
--*-- exec_command: rm -rf /tmp/adbfs-5i0le6/

Adb shell itself seems to work fine.

Unable to edit files (/system)

Hi, I've tried to edit a file under /system and that seems impossible, even after rooting and mounting system as RW with 'mount -o remount,rw /system'
I can write to system using ADB though.
Can I do this using this program?

List default values of `max_` values

Would you please list the defaults of all max_* options in --help?

Do the defaults for max_{read,write} change when large_reads or big_writes is enabled?

No room on volume?

I'm using adbfs-rootless on OS X and I'm successfully mounting my phone. However, the volume has no space available so I can't transfer any files to my phone. Any thoughts?

Packaging

It would be great if adbfs-rootless could be made available via package managers (i.e. snap, flatpak or/and or the traditional distribution specific ones like DEB and RPM).
This would probably also solve questions regarding the dependencies (since they'll be specified in the package anyway). And I guess, providing binary packages will avoid compile and dependency issues (like the one I'm running into). 😉

Thank you so much for your work! 🙏

mount fails with "socket not bound" on CM 10 (Android 4.1.2)

I have an issue comparable with #3 – just giving a different error when trying to cd into the mount:

cd: /mnt/droid: socket not bound

Using your advice from over there, running with the -f parameter:

--*-- exec_command: adb shell ls
--*-- exec_command: adb shell ls -l -a -d '/.Trash'
Error: signal 11:
./adbfs[0x40267c]
/lib/x86_64-linux-gnu/libc.so.6(+0x36150)[0x7fd464d09150]
/lib/x86_64-linux-gnu/libc.so.6(+0x3c784)[0x7fd464d0f784]
/lib/x86_64-linux-gnu/libc.so.6(atoi+0x10)[0x7fd464d0c690]
./adbfs[0x404956]
/lib/libfuse.so.2(+0xde08)[0x7fd4657d2e08]
/lib/libfuse.so.2(+0xed09)[0x7fd4657d3d09]
/lib/libfuse.so.2(+0x110e6)[0x7fd4657d60e6]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7e9a)[0x7fd465099e9a]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7fd464dc72ed]
--*-- exec_command: rm -rf /tmp/adbfs-D4h43Z/

and then it exits itself. Checking what's going on with that Trash:

adb shell ls -l -a -d '/.Trash'
ls: /.Trash: No such file or directory

I've checked output from ls, and on the failing device it looks like ls -C (3 columns). On another device (where it works), it's rather ls -1 like. Tried working around that by replacing ls (busybox-symlink) by a shell script (executing ls -1 when called without parameters) didn't help.

Above was done with a binary compiled from a fresh clone of today. Troublesome device is a Motorola Milestone 2 running CM 10 (Android 4.1.2), rooted. Works fine on an LG P880 (rooted) and a Samsung Galaxy Ace (not rooted), both with the same Android version (just stock ROM instead of CM).

Issue on Linux when waking from standby

Hi,

Some of the tools involved in mounting a directory via the adb protocol seems to keep Linux from exiting the standby state. It occurred multiple times on an Ubuntu Linux 18.04.1, kernel 4.15. Could you, please tell me how to find out if it is adbfs, adb itself or nautilus?

Alexandru.

rsync with adbfs target: 'rsync: mkstemp "<filename>" failed: Function not implemented (38)'

When I try to rsyn to an adbfs target directory, I get errors such as:

rsync: mkstemp "/tmp/android/storage/2EE0-1B07/DCIM/.sync/.ID.dd4Kl9" failed: Function not implemented (38)

My rsync command was:
rsync -aPvvW --size-only /home/ravi/backup/ravidroid/external/DCIM /tmp/android/storage/2EE0-1AA7/

I'm guessing this is because the underlying filesystem (on the external sd card) is exFAT.

What is the work-around?

Does not handle multiple devices

Adbfs does not know how to handle multiple connected devices.

joost@laptop: ~ $ mkdir droid          

joost@laptop: ~ $ ls -l | grep droid
drwxr-xr-x  2 joost joost      4096 25 aug 10:45 droid

joost@laptop: ~ $ adb devices
List of devices attached
XXX	device
YYY	device

joost@laptop: ~ $ adbfs ~/droid
--*-- exec_command: adb shell "ls"
adb: more than one device/emulator

It does however tries to mount something, making the ~/droid directory inaccessible.

joost@laptop: ~ $ ls -l | grep droid
ls: cannot access 'droid': No such file or directory
d?????????  ? ?     ?             ?            ? droid

joost@laptop: ~ $ mount | grep droid
adbfs on /home/joost/droid type fuse.adbfs (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

I cannot find a flag in the adbfs --help to select the device (like adb's -s-flag). Through reading the adb --help, however, i did learn about the existence of the $ANDROID_SERIAL variable. Using this also applies to adbfs and i was able to mount my device correctly.

joost@laptop: ~ $ ANDROID_SERIAL=XXX adbfs ~/droid
--*-- exec_command: adb shell "ls"

joost@laptop: ~ $ ls ~/droid
acct  bin         config  data           default.prop  etc         mnt  oem   product  sdcard   sys     system_ext
apex  bugreports  d       debug_ramdisk  dev           lost+found  odm  proc  res      storage  system  vendor

So there are two parts to this issue-report:

  • Prevent/undo the mounting things upon an error; to prevent the mount-directory to become inaccessible
  • Either support a device-flag or document the usage of $ANDROID_SERIAL

commit 5481ad98 not working on XiaoMi MiPad in recovery mode(ClockWorkMod)

Hi, I've compiled adbfs and tried to mount a XiaoMi MiPad in recovery mode(ClockWorkMod) but I only got a blank mountpoint

Console output

~/工作空間/程式設計/Independent_projects/adbfs-rootless
 % ./adbfs -f droid
--*-- exec_command: adb shell ls
--*-- exec_command: adb shell ls -l -a -d '/.Trash'
--*-- exec_command: adb shell ls -l -a -d '/.xdg-volume-info'
--*-- exec_command: adb shell ls -l -a -d '/autorun.inf'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a -d '/.Trash-12345'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
from cache /autorun.inf


--*-- exec_command: adb shell ls -l -a -d '/'
--*-- exec_command: adb shell ls -l -a -d '/.directory'
from cache /.directory
from cache /.directory
from cache /.directory
from cache /
from cache /
--*-- exec_command: adb shell ls -l -a '/'
from cache /
from cache /.directory
from cache /.directory
from cache /.directory
from cache /.directory
from cache /
from cache /
from cache /
from cache /
from cache /
from cache /
from cache /
from cache /
--*-- exec_command: adb shell ls -l -a '/'
from cache /
from cache /
from cache /
--*-- exec_command: adb shell ls -l -a '/'
from cache /
from cache /
from cache /
--*-- exec_command: adb shell ls -l -a '/'
from cache /
from cache /
from cache /
--*-- exec_command: adb shell ls -l -a '/'
from cache /
from cache /
from cache /
--*-- exec_command: adb shell ls -l -a '/'
from cache /
from cache /
from cache /
--*-- exec_command: adb shell ls -l -a '/'
from cache /
from cache /
from cache /
--*-- exec_command: adb shell ls -l -a '/'
from cache /
from cache /
from cache /
--*-- exec_command: adb shell ls -l -a '/'
from cache /
from cache /
from cache /
--*-- exec_command: adb shell ls -l -a '/'
from cache /
from cache /
from cache /
--*-- exec_command: adb shell ls -l -a '/'
from cache /
from cache /
from cache /
--*-- exec_command: adb shell ls -l -a '/'
from cache /
from cache /
from cache /
--*-- exec_command: adb shell ls -l -a '/'
from cache /
from cache /
from cache /
from cache /.directory
from cache /.directory
from cache /.directory
from cache /.directory
from cache /
from cache /.directory
from cache /.directory
--*-- exec_command: adb shell ls -l -a '/'
from cache /.directory
from cache /.directory
from cache /
--*-- exec_command: adb shell ls -l -a '/'
--*-- exec_command: adb shell ls -l -a '/'
from cache /
--*-- exec_command: adb shell ls -l -a '/'
from cache /.directory
from cache /.directory
from cache /.directory
from cache /.directory
^C--*-- exec_command: rm -rf /tmp/adbfs-MdRYJe/

running adb manually

 % adb shell
~ # ls
boot                 fstab.goldfish       sbin
cache                fstab.mocha          sd-ext
data                 init                 sdcard
data_root            init.rc              seapp_contexts
datadata             internal_sd          sepolicy
default.prop         mnt                  storage
dev                  proc                 sys
emmc                 property_contexts    system
etc                  recovery             tmp
external_sd          res                  ueventd.goldfish.rc
file_contexts        root                 ueventd.rc
~ # 
 % adb shell ls -l -a '/'
__bionic_open_tzdata: couldn't find any tzdata when looking for localtime!
__bionic_open_tzdata: couldn't find any tzdata when looking for GMT!
__bionic_open_tzdata: couldn't find any tzdata when looking for posixrules!
drwxrwxr-x   23 root     root             0 Jun 16 06:44 .
drwxrwxr-x   23 root     root             0 Jun 16 06:44 ..
drwxr-xr-x    2 root     root             0 Jun 16 06:42 boot
drwxrwx---    6 system   cache         4096 Jun 16 06:40 cache
drwxrwx--x   33 system   system        4096 Jun 16 06:40 data
drwxrwx--x   33 system   system        4096 Jun 16 06:40 data_root
drwxr-xr-x    2 root     root             0 Jun 16 06:42 datadata
-rw-r--r--    1 root     root          2496 Sep 29  2014 default.prop
drwxr-xr-x   11 root     root          2520 Jun 16 06:43 dev
drwxr-xr-x    2 root     root             0 Jun 16 06:42 emmc
drwxr-xr-x    2 root     root             0 Jun 16 06:43 etc
drwxr-xr-x    2 root     root             0 Jun 16 06:42 external_sd
-rw-r--r--    1 root     root          9713 Jan  1  1970 file_contexts
-rw-r-----    1 root     root           953 Jan  1  1970 fstab.goldfish
-rw-rw-r--    1 root     root          1679 Sep 29  2014 fstab.mocha
-rwxrwxr-x    1 root     root        186532 Sep 28  2014 init
-rwxr-x---    1 root     root          3548 Jan  1  1970 init.rc
drwxr-xr-x    2 root     root             0 Jun 16 06:42 internal_sd
drwxrwxr-x    5 root     system           0 Jun 16 06:42 mnt
dr-xr-xr-x  117 root     root             0 Jan  1  1970 proc
-rw-r--r--    1 root     root          2161 Jan  1  1970 property_contexts
drwxr-xr-x    2 root     root             0 Jun 16 06:42 recovery
drwxr-xr-x    4 root     root             0 Sep 29  2014 res
drwx------    2 root     root             0 Jul 23  2014 root
drwxr-x---    2 root     root             0 Sep 29  2014 sbin
drwxr-xr-x    2 root     root             0 Jun 16 06:42 sd-ext
lrwxrwxrwx    1 root     root            13 Jun 16 06:44 sdcard -> /data/media/0
-rw-r--r--    1 root     root           660 Jan  1  1970 seapp_contexts
-rw-r--r--    1 root     root         93266 Jan  1  1970 sepolicy
d---r-x---    3 root     sdcard_r        60 Jun 16 06:43 storage
dr-xr-xr-x   13 root     root             0 Jun 16 06:42 sys
drwxr-xr-x    3 root     root             0 Sep 29  2014 system
drwxrwxr-x    2 root     shell          100 Jun 16 06:44 tmp
-rw-r--r--    1 root     root           272 Jan  1  1970 ueventd.goldfish.rc
-rw-r--r--    1 root     root          7275 Jan  1  1970 ueventd.rc

Environment

Operating System

Ubuntu 14.04LTS x86 32bit

Locale

zh_TW.UTF-8

Impossible to copy file from mac Finder to mounted phone

Following the reciep given here, the internal storage of my phone and its external SD-card, mount very well in the OSX Finder.
But only in read mode 👎
If i want to copy a simple text file with the Finder, using drag'n drop, it tell me it cannot finish the operation cause an element is unfindable : error -43.

Can not write

Connection:

$ adbfs droid
--*-- exec_command: adb shell "ls"
ls: ./ueventd.rc: Permission denied
ls: ./ueventd.qcom.rc: Permission denied
ls: ./service_contexts: Permission denied
ls: ./sepolicy: Permission denied
ls: ./selinux_version: Permission denied
ls: ./seapp_contexts: Permission denied
ls: ./init.zygote64_32.rc: Permission denied
ls: ./init.zygote32.rc: Permission denied
ls: ./init.usb.rc: Permission denied
ls: ./init.usb.configfs.rc: Permission denied
ls: ./init.target.rc: Permission denied
ls: ./init.recovery.qcom.rc: Permission denied
ls: ./init.rc: Permission denied
ls: ./init.qcom.usb.rc: Permission denied
ls: ./init.qcom.ssr.rc: Permission denied
ls: ./init.qcom.rc: Permission denied
ls: ./init.qcom.power.rc: Permission denied
ls: ./init.environ.rc: Permission denied
ls: ./init.cm.rc: Permission denied
ls: ./init: Permission denied
ls: ./fstab.qcom: Permission denied
ls: ./file_contexts.bin: Permission denied
ls: ./default.prop: Permission denied

Than I can read and remove files and dirs in droid/sdcard, but can not write something:

$ mkdir droid/sdcard/1
mkdir: cannot create directory ‘droid/sdcard/1’: Resource temporarily unavailable

The same is with sudo.

documentation: large temporary file usage

Add something like this to README.md:

Limitation: Since adbfs-rootless uses adb push and adb pull under the hood to copy files, a temporary local file will be created on the computer for each open file. This is impractical for very large files (say, more than 1 GiB) because of the large temporary storage requirement on the computer and the high open latency.

chmod, chown

chmod and chown options seems not implemented yet ?

"Device not configured" in response to every command

Environment:

  • OnePlus One booted into recovery running TWRP v2.8.5.1
  • MacBook Pro running OSX v10.12.6

Followed steps on this page: https://tamasnagy.com/blog/mtp-interconnect-mac-linux/

When I run ./adbfs ~/droid, the ~/droid folder disappears from Finder (the GUI file manager). The folder still exists in the command line, but does not respond properly to ls:

MacBookPro:adbfs-rootless armaan$ sudo ls ~/droid
ls: droid: Device not configured

grepping an ls -lha of the home directory yields interesting results:

MacBookPro:adbfs-rootless armaan$ ls -lha ~ | grep droid
ddrwx------     1 armaan  staff     0B Dec 31  1969 droid

So maybe there is a permissions problem?

MacBookPro:adbfs-rootless armaan$ sudo chmod +r ~/droid/
chmod: Unable to change file mode on /Users/armaan/droid/: Device not configured

No, that still didn't work. Starting an adb shell works fine though.

MacBookPro:adbfs-rootless armaan$ adb shell
~ # cp --help
BusyBox v1.22.1 bionic (2015-02-12 16:45 +0000) multi-call binary.

Usage: cp [OPTIONS] SOURCE... DEST

Copy SOURCE(s) to DEST

	-a	Same as -dpR
	-c	Preserve security context
	-R,-r	Recurse
	-d,-P	Preserve symlinks (default if -R)
	-L	Follow all symlinks
	-H	Follow symlinks on command line
	-p	Preserve file attributes if possible
	-f	Overwrite
	-i	Prompt before overwrite
	-l,-s	Create (sym)links

~ # exit

Anyone have any guidance for me? I bet that I'm missing something obvious. The main thing I want to be able to do is use rsync on the computer to wholesale copy files from the Android. Or, even use dd to create an image of it.

Copying to phone results in 0 byte files

As the title says, most of the files I've copied from my desktop to my phone through adbfs ends up being 0 bytes.
Regardless of size, the whole file doesn't get copied through. Although there was
a few files that were properly copied over onto it, out of thousands.

My phone is a OnePlus 6T with LineageOS 18.1 and my desktop has Debian 11.1 installed,
will provide any more information if needed.

make error

make: pkg-config: Command not found
g++ -c -o adbfs.o adbfs.cpp  
In file included from /usr/include/fuse/fuse.h:26:0,
                 from /usr/include/fuse.h:9,
                 from utils.h:37,
                 from adbfs.cpp:75:
/usr/include/fuse/fuse_common.h:33:2: error: #error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
 #error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
  ^~~~~
Makefile:12: recipe for target 'adbfs.o' failed
make: *** [adbfs.o] Error 1

After cloning the repo and calling make, the error above appears. What am I doing wrong?

I am on Kubuntu 18.04

`rmdir` on non-empty folders deletes folders

RMDIR(1)                                            User Commands                                           RMDIR(1)

NAME
       rmdir - remove empty directories

SYNOPSIS
       rmdir [OPTION]... DIRECTORY...

DESCRIPTION
       Remove the DIRECTORY(ies), if they are empty.

[...]

If they are empty. I haven't verified where the fault lies, it could lie in the coreutils rmdir (unlikely), in fuse, or in adb. The fact is, using rmdir * to clear a folder from empty folders is a bad idea™ using adbfs-rootless.

I am sorry if this sounds rude, but uh, at least I had backed up what was important right before. 😕 That's one way to make space on your phone.

Mobile phone with two user

I have a Mobilephone with two user. Even I'm not logged in with the Main User (0) I'm not able to access the data from this user (10). I could only find the data from the main user.

To be able to open the user directory

  • the symlink /sdcard point to storage/self/primary
  • the symlink /storage/self/primarypoints to ./../mnt/user/0/primary
  • the directory ./../mnt/user/0 seems empty but you are able to open the hidden directory primary if you add it to the address-bar
  • this do not work for ./../mnt/user/10/primary which should be the directory of the second User.

Ideas

  • Please check if you could make ./../mnt/user/10/primary available
  • If possible do not hide the primary directory
  • As seen in Android "GhostCommander": May made the content of the /data/ directory visible. In /data/user should be a directory per User which allow access the Data from the other User.

this does not work for lollipop?

I am using adb version 1.0.32

command output:
adbfs ~/N4MOUNT/
--*-- exec_command: adb shell ls

cd ~/N4MOUNT
bash: cd: /home/ashish/N4MOUNT: Transport endpoint is not connected

Any fix/help?
Thanks for your work.

Error if file name contains $ sign

If filename contains a $ sign like "I_20180602000000000_E_O_$20180602000000000.raw", only listing operations work, any editing, copying operations fail, because the part with the $ sign gets special treatment.

A debug output for an edit operation looks like this:

unique: 329, opcode: LOOKUP (1), nodeid: 1, insize: 47, pid: 3833
LOOKUP /sdcard
getattr /sdcard
adb_getattr
--*-- exec_command: adb shell "ls -l -a -d '/sdcard'" 2>&1
   NODEID: 54
   unique: 329, success, outsize: 144
unique: 330, opcode: LOOKUP (1), nodeid: 54, insize: 48, pid: 3833
LOOKUP /sdcard/Android
getattr /sdcard/Android
adb_getattr
from cache /sdcard/Android
   NODEID: 74
   unique: 330, success, outsize: 144
unique: 331, opcode: LOOKUP (1), nodeid: 74, insize: 45, pid: 3833
LOOKUP /sdcard/Android/data
getattr /sdcard/Android/data
adb_getattr
from cache /sdcard/Android/data
   NODEID: 110
   unique: 331, success, outsize: 144
unique: 332, opcode: LOOKUP (1), nodeid: 110, insize: 68, pid: 3833
LOOKUP /sdcard/Android/data/com.hikvision.thermalGoogle
getattr /sdcard/Android/data/com.hikvision.thermalGoogle
adb_getattr
from cache /sdcard/Android/data/com.hikvision.thermalGoogle
   NODEID: 155
   unique: 332, success, outsize: 144
unique: 333, opcode: LOOKUP (1), nodeid: 155, insize: 46, pid: 3833
LOOKUP /sdcard/Android/data/com.hikvision.thermalGoogle/files
getattr /sdcard/Android/data/com.hikvision.thermalGoogle/files
adb_getattr
from cache /sdcard/Android/data/com.hikvision.thermalGoogle/files
   NODEID: 210
   unique: 333, success, outsize: 144
unique: 334, opcode: LOOKUP (1), nodeid: 210, insize: 48, pid: 3833
LOOKUP /sdcard/Android/data/com.hikvision.thermalGoogle/files/capture
getattr /sdcard/Android/data/com.hikvision.thermalGoogle/files/capture
adb_getattr
from cache /sdcard/Android/data/com.hikvision.thermalGoogle/files/capture
   NODEID: 212
   unique: 334, success, outsize: 144
unique: 335, opcode: LOOKUP (1), nodeid: 212, insize: 51, pid: 3833
LOOKUP /sdcard/Android/data/com.hikvision.thermalGoogle/files/capture/2022-02-25
getattr /sdcard/Android/data/com.hikvision.thermalGoogle/files/capture/2022-02-25
adb_getattr
from cache /sdcard/Android/data/com.hikvision.thermalGoogle/files/capture/2022-02-25
   NODEID: 216
   unique: 335, success, outsize: 144
unique: 336, opcode: LOOKUP (1), nodeid: 216, insize: 87, pid: 3833
LOOKUP /sdcard/Android/data/com.hikvision.thermalGoogle/files/capture/2022-02-25/I_20180602000000000_E_O_$20180602000000000.raw
getattr /sdcard/Android/data/com.hikvision.thermalGoogle/files/capture/2022-02-25/I_20180602000000000_E_O_$20180602000000000.raw
adb_getattr
from cache /sdcard/Android/data/com.hikvision.thermalGoogle/files/capture/2022-02-25/I_20180602000000000_E_O_$20180602000000000.raw
   NODEID: 219
   unique: 336, success, outsize: 144
unique: 337, opcode: OPEN (14), nodeid: 219, insize: 48, pid: 22361
open flags: 0x8800 /sdcard/Android/data/com.hikvision.thermalGoogle/files/capture/2022-02-25/I_20180602000000000_E_O_$20180602000000000.raw
-- adb_open --/sdcard/Android/data/com.hikvision.thermalGoogle/files/capture/2022-02-25/I_20180602000000000_E_O_$20180602000000000.raw /tmp/adbfs-d07kDv/-sdcard-Android-data-com.hikvision.thermalGoogle-files-capture-2022-02-25-I_20180602000000000_E_O_$20180602000000000.raw
ls -l -a -d '/sdcard/Android/data/com.hikvision.thermalGoogle/files/capture/2022-02-25/I_20180602000000000_E_O_$20180602000000000.raw'
--*-- exec_command: adb shell "ls -l -a -d '/sdcard/Android/data/com.hikvision.thermalGoogle/files/capture/2022-02-25/I_20180602000000000_E_O_$20180602000000000.raw'"
ls: /sdcard/Android/data/com.hikvision.thermalGoogle/files/capture/2022-02-25/I_20180602000000000_E_O_.raw: No such file or directory
Error: signal 11:
adbfs(+0x3b68)[0x55a110c15b68]
/lib/x86_64-linux-gnu/libc.so.6(+0x37840)[0x7f48b4a41840]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm+0x0)[0x7f48b4ea64c0]
adbfs(+0x5c79)[0x55a110c17c79]
adbfs(+0x7675)[0x55a110c19675]
/lib/x86_64-linux-gnu/libfuse.so.2(fuse_fs_open+0xe0)[0x7f48b4f19910]
/lib/x86_64-linux-gnu/libfuse.so.2(+0xda16)[0x7f48b4f19a16]
/lib/x86_64-linux-gnu/libfuse.so.2(+0x17dc4)[0x7f48b4f23dc4]
/lib/x86_64-linux-gnu/libfuse.so.2(+0x170b8)[0x7f48b4f230b8]
/lib/x86_64-linux-gnu/libfuse.so.2(+0x13d5c)[0x7f48b4f1fd5c]
--*-- exec_command: rm -rf /tmp/adbfs-d07kDv/

[Feature request] allow to specify Android device to mount.

As what the the old/ orphaned "zach-klippenstein/adbfs" provided, I hereby feature-request an option to specify which android device to mount, e.g.

./adbfs -o android_device 02b5c5a809117c73 /mnt/android

This is useful e.g. if

  • there is more than one device connected,
  • in scripted backup situations where the mount should only succeed if the specific device is connected and not any other (which is my current use case).

Regards!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.