yashsingh1/xdaforums huggingface dataset:
[Nook Touch General] Aqq123:
In that case, how about this one? https://github.com/evdenis/adb_root

It's also a Magisk module you can just install.

Yes, you can extract it with Android Image Kitchen, replace the /sbin/adbd binary, and also edit default.prop and init.rc while at it, then repack and flash with fastboot flash boot boot.img.

But

:

Look, I don't really know what you're trying to do but I'm fairly sure there must be a better way of going at it than hacking the ADB daemon on your device.

The utility in this thread was written 10 years ago for a resource-constrained device running a trimmed-down build of Android 2.1 Eclair. The recovery was either CWM (no ADB access) or a basic low-level tool exposing the internal storage as a USB drive.

With a more modern device you can simply reboot into TWRP and use adb as root from there. This utility was for an e-reader with hardly any running processes. It's not a good idea to modify the /data partition on a running system anyway (if that's what you trying to do), since it may cause data corruption due to files being open, etc.

You can still get superuser access with ADB not running as root using su. Utilities like the FarDroid plugin for Far Manager can work fine with it.

Or, you can at least use Magisk, which should actually work with adb root out of the box, at least on some ROMs.

Pardon my French but it looks like you're barking up the wrong tree. Think about the problem you were originally trying to solve, whatever it was, and go back to it. If you figure out you really need the ADB daemon to run as root, you can also check out this link for a summary other options: https://android.stackexchange.com/q...to-run-adb-shell-as-root-without-typing-in-su
[Nook Touch General] joe890:
You are right and thank you for mentioning it! My original probem was do sync/backup as much as possible from a rooted mobile to the USB-attachend Linux PC. Renate mentioned that it's better

to "back up whole partitions as a single file might be more useful"

If she does mean a dd/raw image, than this would be a very interesting thing. But to my knowledge,

a physical aqcusition cannot be performed if the OS is running (even if the mobile is rooted)

That's the reason I was contemplating about using adbsync.
[Nook Touch General] Renate:
If you run a recovery with ADB then you can dd a copy of any partition that is not mounted.

If you use EDL then no partition is mounted and you can copy anything.

With EDL you can also just save the whole flash as a single file.

*Note that you'd need a rooted ADB that doesn't use su.
[Nook Touch General] joe890:
Wow that sounds interesting. # adb reboot edl and bingo, the screen of the smartphone (Qualcom) was black...

Everything seems to be blocked. Fortunately next day (after charging the device) the mobile did work properly again :)

1.

What is the most promising approach in EDL-mode to copy everything* of the Android the filesystem to the USB connected

Linux-PC (dd would be my favourite) ?

2.

->*Note that you'd need a rooted ADB that doesn't use su.

The thing as Aqq123 tried to explain me?

Thank's!
[Nook Touch General] Renate:
Yes, the ROM bootloader doesn't do anything with the screen. It doesn't even know that there is one.

When you're in EDL mode, try to use an EDL client to see if you can read/write anything. You'll need a Firehose loader for your model.

If you don't want to be EDL mode, just do a LONG power press (~20 seconds).
[Nook Touch General] joe890:
Ok would like to play with this EDL utility downlaoded from https://www.temblast.com/android.htm.

Is it save to use?
[Nook Touch General] Renate:
Hmm, that's interesting. I never check virus thingies, because I wrote it and I know what's in it.

The MD5 of that file is d8c37f6b682f4b0a4f9ef7476c0bae0d

If that checks out then you know the file was not altered.

Then you only have to question my reliability and integrity.

I recently wrote a utility called "kpatch.exe".

Windows 10 latched onto the "patch" in the filename and determined that it was malware.

So I added the manifest code below to the resources:

<?xml version="1.0" encoding="utf-8"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

Basically saying, "I'm not malware". What the heck kind of security is that?

Still, I ought to look at what the heck a "Variant Lazy" is and why they think that there are similarities.

edl.exe scans the USB looking for 05c6/9008 (EDL). Is that suspicious?

I don't do anything with any info. There are no internet APIs used.

So, in short, I say, heck, it's safe.

Just be careful using it because if you tell it to write over some part of your device's flash, it will.

If you use /e or /w double-check what you've typed for args before hitting "Enter".

Edit: I just ran a VirusTotal directly on the URL and got ninety "Clean" and two "Malware" from BitDefender & G-Data.
[Nook Touch General] joe890:
Thank's a lot Renate for the clarifications :)

Is EDL the tool of choice to copy the first sector till the last sector of the internal storage of an Android mobile

(extfs4)?
[Nook Touch General] Renate:
Well, it's my choice. :)

134 kB for a piece of software these days is miniscule.

There is the Python EDL tool. It has more options and things. Also lots of dependencies.
[Nook Touch General] Renate:
I went to G-Data's website and asked them, "Hey, whatsamatta with my program?"

They answered, "Die eingesendete URL wird aktuell nicht mehr durch unsere Software geblockt".

Ok, it's all good for G-Data.

But I ran the URL again by Virus Total and BitDefender and two new services say that it's malicious.

I guess that I should just settle for "96.7% malware free!" :p
[Nook Touch General] joe890:
Will this Firehorse loader prevent the message "could not find EDL Device" after starting EDL.exe?
[Nook Touch General] Renate:
No. The first step is finding a device in EDL mode. You can do that without a loader.

TLDR: Don't install any Qualcomm drivers, use the Zadig driver as in the instruction.

Cell phone manufacturers have had a fetish for years of their phones appearing as a Com port.

That's stupid for any number of reasons.

The interfaces are a pair of USB bulk endpoints, you can use them just like that.

Instead the manufacturers say, "Look how easy it is! Instead of just connecting, you can connect to Com26!"

Check devmgmt.msc and see if you have stupid Com ports.
[Nook Touch General] joe890:
Thank's! If the mobile is in normal/operational mode, there is a "libusb-win32-devices" entry listed. Does that look fine?
[Nook Touch General] Renate:
Mmm, hard to tell.

Both ADB and fastboot basically use a WinUSB driver except they are marked with an interface class GUID of "Android". That's why they appear in Device Manager as "Android". The stock ADB and fastboot only accept devices of that interface class GUID.

So, if you're seeing what you show and your device is not in EDL mode then you've installed a Zadig driver over the stock ADB driver and the stock ADB will not work. (If that is the case, just reinstall the stock ADB drivers when your device is in ADB mode.)

When you try to install the Zadig driver you should only do that to something that is showing 05c6/9008.
[Nook Touch General] Renate:
Yes, I'll get around to doing a scheme with filters and do something about timeout.

I just have to figure out how to make the timeout so that you don't have to wait a week if you forget to connect first.
[Nook Touch General] pbelcl:
thanks!!

thanks for this answer, thats wonderful!!

then i'll wait...

just take your time ;)
[Nook Touch General] ApokrifX:
Renate,

You seem to be the right dude to ask:

A. On some devices, adb shell gives # (root) prompt right away.

B. On other it gives $ and I need to do su to get #

The real problem is:

DDMS File Browser on (A) can go into any folder.

On (B) it cannot even browse /data folder.

Anyway to change (B) behaviors to go straight to root prompt?

I’m not 100% sure these are related I hope they are.
[Nook Touch General] DeanGibson:
Please don't hijack the thread

What does this have to do with the current thread? Why not ask in a new thread, with a title like: "Differences in shell prompt?"
[Nook Touch General] ApokrifX:
From past experiences - she will never read it. :o

Besides, it's related to adb folder access/permissions.
[Nook Touch General] Renate:
I'm quite sure that I am not! :p

In default.prop (which comes out of uRamdisk or some other place) change:

#
# ADDITIONAL_DEFAULT_PROPERTIES
#
ro.secure=1
ro.allow.mock.location=0
ro.debuggable=0

To:

#
# ADDITIONAL_DEFAULT_PROPERTIES
#
ro.secure=0
ro.allow.mock.location=1
ro.debuggable=1

It's the ro.secure that makes the difference.

If your device uses uRamdisk you can use bootutil.exe to extract/replace default.prop
[Nook Touch General] ApokrifX:
Cool!

Thanks a lot, I'd never find it myself! :good:

What is "ro." prefix stands for? Apparently, it's not root, is it?
[Nook Touch General] Renate:
ro = read-only

# getprop
[i]... listing of tons of properties ...[/i]

# setprop bogus Hello
setprop bogus Hello
# getprop bogus
getprop bogus
Hello

# setprop persist.aunts Goodbye
setprop persist.aunts Goodbye
# getprop persist.aunts
getprop persist.aunts
Goodbye
# ls -l /data/property/persist.aunts
-rw------- root root 7 2013-01-04 15:38 persist.aunts

# getprop ro.secure
getprop ro.secure
0
# setprop ro.secure 1
setprop ro.secure 1
# getprop ro.secure
getprop ro.secure
0 [color=red]// see, it failed to set it despite being root[/color]
[Nook Touch General] ApokrifX:
Got it!

Forgot already, there is a persist. prefix too :o

Thank you!

Update:

Tried on BlueStacks emulator. http://xdaforums.com/showthread.php?t=1970577&page=10

Actually, /default.prop has all those lines already:

cat /default.prop

#

# ADDITIONAL_DEFAULT_PROPERTIES

#

ro.secure=0

ro.allow.mock.location=1

ro.debuggable=1

persist.service.adb.enable=1

And just to make sure, I run

getprop ro.secure

0

So it's gotta by some other thing (in addition to what you have mentioned already?)
[Nook Touch General] Renate:
Ok! Back to the main theme!

There's a new adbsync.exe in the signature.

It has a longer timeout.

It has support for ignoring certain files.

adbsync /v /a /s /c C:\Stuff sdcard/Stuff /i*.jpg;boring.*;rev?.txt

This will skip over apples.jpg, bananas.JPG, boring.txt, boring.db, rev8.txt, rev9.txt, but not rev10.txt
[Nook Touch General] pbelcl:
Thanks renate for this update!!

i tried it with my HTC One X with JB 4.1.1.

it workes perfect in my test, but in my practical use i have still some problems.

i try to sync about 200 mp3 files with complete about 800 MB to the internal storage of my device.

in the first quater of sync job it stops wiht this error:

-------------start log-----------------

=> 3831430 2002-03-05 00:30 PB_Hits_2000_2003/Sarah Connor - Lets get back to bed boy.mp3

=> 3917824 2004-07-19 17:25 PB_Hits_2000_2003/Sarah Connor - Musil is the key.mp3

=> 3471360 2009-11-22 14:24 PB_Hits_2000_2003/Sasha - I Feel Lonely.mp3

=> 3688576 2004-07-20 05:29 PB_Hits_2000_2003/Sasha - Im Still Waitin.mp3

=>ADB sync error: Invalid argument

Can't copy to android

-------------end log-----------------

as the sync stops every time on the same place i can think about to possible problems:

1.) som special caracters in filesnames

2.) some problems with subfolders

but i dont know what exectly ist is, because there is no special caaracters but special directory names.....

do you have any idea ??
[Nook Touch General] Renate:
adbsync transfers in straight, case-sensitive sort order of the files.

What comes immediately after "Sasha - I'm Still Waitin.mp3"?
[Nook Touch General] DeanGibson:
Please don't hijack the thread

No it's not; it's related to whether adbd starts as root or not.
[Nook Touch General] Renate:
True, but adbd also checks the value of ro.secure internally.

More:

In my abdb the text "ro.secure" appears at 0x1a808

I changed that to "persist.z" (because it's the same number of chars).

I then setprop persist.z to 0 or 1 and got the expected results after restarting of # or $
[Nook Touch General] pbelcl:
It was a very heavy problem!

i have some mp3 Files automatically ripped from my original CD's to have it mobile for my phone.

the software i use sometimes generates the names of the files with "hidden spaces" in the names.

hidden space is a caracter you can generate with ALT+255 on keyboard and it lookes like a space.

adb sees this not as an space but as a special caracter and so it cant handle it.

so this problem does not come from adbsync.exe but from my files and some dirty characters.

i solved it already and im am still testing adbsync.exe.....

so far everything looks nice!!

even the videos already synced on my One X ;)
[Nook Touch General] Renate:
I'm cleaning up the code to have full support for UTF-8 on the Android side and UTF-16 on the Windows side.

I've got a new version working, but I'll have to do complete testing.

Then you'll be able to sync Café.mp3 and 你好嗎.mp3 without any problems.
[Nook Touch General] pbelcl:
that sounds WONDERFUL!!!
[Nook Touch General] Renate:
Ok, yet another version with yet more options.

My only excuse is that this is designed to be stuck in a script or a batch.

Once you get all the flags the way that you want you won't have to look at it.

adbsync C:\Stuff sdcard/Stuff /hc /au /s /d /v

This will copy updated files (but not new files) to the android.

This will copy new files (but not updated files) to the host.

It will display the differences before copying and a summary afterwards.

The changes are:

The /d flag will display differences but will group them together.

The /l flag will still display everything but in a strict Linux order.

Full Unicode names are supported.

The /o flag specifies a pattern for only. /o*.jpg /ivacation* will only process non-vacation jpg.

The /q flag will quiet copying messages. /d, /l, /v will still make output.

Both the /h and /a flags take additional chars. /hscu will create subdirs, new files and update files on the host.

Using just /h will use the default of cu, which will not create subdirs.

The /c flag no longer exists because the option has been split between /h and /a.

It will display the file name before the copying is complete/bombed.

Download in the signature. Comments/bug reports are welcome.
[Nook Touch General] Renate:
Don't you hate it when people change command line arguments to an existing program?

Sorry...

I've done some minor shuffling of command line arguments.

You can get a reminder of what everything does by:

adbsync
[color=red][i]or[/i][/color]
adbsync /?

The optional /d flag is now used for specifying device.

The device name can be found by adb devices

This is helpful if you have two devices connected or the emulator running.

With only one device connected you need not use the /d flag.

The /l (listing) option now takes over previous options.

/l lists everything, /ld lists differences, /lh lists host only, /la lists android only.

adbsync C:\Stuff sdcard/Stuff /dnook:5555 /ascu /s /ld /v

(I have nook in C:\Windows\System32\drivers\etc\hosts and I connected using adb connect nook.

If I had connected using adb connect 192.168.1.2 the device ID would have been 192.168.1.2:5555)

Download in the signature.
[Nook Touch General] pbelcl:
testing....

therefore i deleted some files on android and tried to sync music folder

adbsync /ascu /v /s /ld p:/music /mnt/sdcard/music

error:

"Specified root directory for android does not exist"

the root folder "music" already exists on my device!?

or does the error mean something else ?
[Nook Touch General] Renate:
It seems to be saying that mnt/sdcard/music does not exist.

Is your sdcard mounted on / or mounted on /mnt/ ?

My program does not follow links, you have to use a real directory.

My Nook uses /sdcard/Music, my Kyocera Rise uses /mnt/sdcard/Music
[Nook Touch General] pbelcl:
Strange, because the older versions worked with this settings.

I'll try to check, which name my device uses.....
[Nook Touch General] Renate:
That should get you "Unknown command flag M", it does on mine.

At the very least it should get you "Not enough arguments supplied".

Leading forward slashes indicate flags.

Also the slash on P:\Music was backwards

adbsync /ascu /v /s /ld p:\music mnt/sdcard/music
[color=red][i]or[/i][/color]
adbsync /ascu /v /s /ld p:\music "/mnt/sdcard/music"

Try a simple case:

adbsync /v p:\music mnt/sdcard/music

It should just generate a summary of file counts.
[Nook Touch General] pbelcl:
when i try adb push:

adb push "p:\music" "mnt/sdcard/music"

this works!!

when i try

adbsync /v "p:\music" "mnt/sdcard/music"

every Time: "Specified root directory for android does not exist"

so i think the destination folder cant be the problem...
[Nook Touch General] Renate:
Ok, I've got to put more specific messages in.

If it can't stat the root for any reason it reports it as missing.

Um, you could do a bit of experimentation to narrow this down.

adbsync /v P:\Music system

(It's not going to write files and system is ro anyway.)

I'm still not clear on why it's not working now.

Did it stop working by the first unicode version?

Check under Properties in Explorer for the BuildDate of adbsync.exe
[Nook Touch General] pbelcl:
adbsync /v P:\Music system

gives also back:

"Specified root directory for android does not exist"

i did not expect this, but you are right!!

an older version works properly.

sorry but the build date in my explorer says the downlaod date, but i thik you can work it out with older files in your history....
[Nook Touch General] Renate:
No, if you are looking at the Properties, the "BuildDate" is actually the build date.

I'm using adbsync on two devices using USB and WiFi.

I don't know what the problem is.

I'm doing a new version with more error reporting.
[Nook Touch General] pbelcl:
I am mobile now till tomorrow, so no more build search possible....

wonderful, then I do further tests towmorrow :)
[Nook Touch General] Renate:
Hmm, let's try this again...

There was a stupid bug in there that would prevent it from working.

Try the new version in the signature.

Minor changes: All file times reported are UTC. Elapsed time noted for file copies.
[Nook Touch General] Ansago:
First off, just want to say thanks for this! It's a great little utility.

However, I'm running into a problem: I am able to sync my files fine using the "adbsync <dir> "sdcard/My Files/Books" /a /v" command. However, when I browse to the directory on my microSD card in my Library, attempting to open the .epub files results in a "This NOOK cannot read this file. It may be an unsupported format." error.

The files in question were downloaded via the dropbox app from Project Gutenberg. The same files are able to be opened fine if I use ADE to sync them over USB, or drag and drop them to the Nook's internal storage.

Thanks for any help!
[Nook Touch General] Renate:
Hmm, that's strange.

I just synced a directory with 6000 files in a deep tree and it worked all fine.

The files were all sizes from 100 bytes to 20 Megs.

I actually used adb to pull back the 20 Meg file at the same time that I was still syncing the rest of the directory.

A binary comparison came up identical

Have you tried to adb pull the files back to your desktop and do a fc /b to see if they are the same?
[Nook Touch General] pbelcl:
works now..

Hi renate,

first thanks for your excellent work! your adbsnc is really the missing link of adb ;)

i tried the fixd version with my real life dvice and it seems that all runs perfect.

next days i'll try to delete ALL of my files on device and maka a complete new sync.

then i'll tell how it works.....
[Nook Touch General] fritzthevan:
Thanks so much for this - it's a huge help.

after doing adbsync /hscu /s /icm*.zip;dirtoignore* hostdir storage/sdcard0

A couple of things to note:

1) empty directories on the Android were not copied (not an issue for me, but worth mentioning)

2) dirtoignore was copied, whether the spec was dirtoignore* or dirtoignore/* (am I doing something wrong?)

3) otherwise, everything copied perfectly

Some folks may like a "mirror" switch, where if a file is deleted in source it gets deleted in target. One can thus keep a current copy of their Android sdcard on their computer. Not asking - just saying. Or is there a way to do this now (I tried)?
[Nook Touch General] Renate:
I'm glad that you get some utility out of adbsync.

Directories are created as a side effect of creating files.

They are not created explicitly.

On the Android side that would require switching protocols to a shell.

The filtering, both /o and /i are applied to only the filename, not the path.

Getting a system to work on both directories and filenames might get cumbersome.

Deleting orphaned files would require switching protocols to a shell.

Machine interaction with a shell is always iffy.

There's no reliable, portable way to get feedback on your actions.
[Nook Touch General] fritzthevan:
Thanks for the info. It's working fine for me like it is, and is much appreciated. The directories thing is no big deal - it just means an extra 20 GB or so are transferred one time.

I did my first sync this morning and it worked. There was one anomaly, but surely I misunderstand the commandline specs.

I did: adbsync /hscu /s $hostpathexample storage/sdcard0

$hostpathexample is e.g. D:\jim\fred

it found the correct modfied/new files to grab, then put them in not in $hostpathexample, but in $pathtoadbsync/storage/sdcard0

I moved $hostpathexample to $pathtoadbsync/storage/sdcard0 and all is well. The lazy solution!
[Nook Touch General] Renate:
I'm confused with all these dollar signs.

I have no idea what you are talking about.

If you are running it in a batch file with environment vars it's %mystuff%

If you are running it in a makefile it's $(MYSTUFF)
[Nook Touch General] osm0sis:
This should be moved to Android Development and Hacking > Android Software Development!

Great work! I'm looking forward to trying this out as my new backup solution since I was getting tired of adb pulling the whole sdcard down each time when likely 4/5ths of the files hadn't changed. :D
[Nook Touch General] pbelcl:
AW: ADB sync utility - adbsync

Same as i!

I use adbsync since two months and it works fine for me.

Specially my pictures folder with 2000 jpg files does not change lots of files, so it is very comfortable and quick to sync it instead of pushing 800 Mb every time.

Thanks Renate for this wonderful program.....
[Nook Touch General] ApokrifX:
From thread hijacker:

Right, but how do I switch it easily?

I guess, both conditions need to be satisfied to get root prompt?

I’ve got the answer finally… but it doesn’t work for me: http://xdaforums.com/showthread.php?t=1687590

adbd Insecure lets you run adbd in root mode if your device is rooted.
[Nook Touch General] osm0sis:
If you use a custom recovery you've got adb root when you're booted to it. Easiest method for most devices, I'd imagine.
[Nook Touch General] ApokrifX:
Right.

Judging from my little Linux experience, some services may reconfigure themselves (calls setuid to drop its privileges) and run under lower privilege account. Not sure, if it’s the case with adbd, thought.

So far I was not able to figure out how to run adbd as root for BlueStacks emulator. :(

I.e. if I login to terminal on device, do su, kill adbd and start it again – I’m not getting # for "adb shell" still. :crying:

It runs as shell account, not as root:

ps
shell 1025 1 3512 252 ffffffff 00000000 S /sbin/adbd

getprop ro.secure
0
[Nook Touch General] Renate:
When you restart adbd, you are starting it from a shell and your userid id is shell, adbd will also have shell as userid.

Type id to see who you are.

On my Kyocera Rise:

shell@android:/ $ id
id
uid=2000(shell) gid=2000(shell) groups=1003(graphics),1004(input),1007(log),1009(mount),1011(adb),10
15(sdcard_rw),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats)
shell@android:/ $ su
su
shell@android:/ # id
id
uid=0(root) gid=0(root)