[Q] adbd always starts up! How do I have it start up only when required? - Paranoid Android Q&A

Hi,
I have a nexus one running PA-3.99rc2 with the following superuser modifications:
* replaced stock superuser app with SuperSU (system app)
* installed adbtoggle (system app)
* I do have the exposed framework and xprivacy installed, with no restrictions on the settings app, the adbtoggle app and the supersu app.
In the developer options, I have
* "Root Access" set to disabled.
* USB debugging" unchecked
* "select debug app" -> no debug app selected
However, what happens is that whenever I connect a USB cable, I can just run 'adb shell' and get a root prompt.
C:\> adb shell
[email protected]:/
Click to expand...
Click to collapse
This is possible irrespective of the adb toggle setting or the root access setting or the USB debugging setting.
I am simply handed a shell even when USB debugging is turned off, whether I asked for it or not.
I haven't tried it over wifi but I have reason to believe that it would be accessible all the same.
When I toggle ADB using the app or the settings panel, I do see the notification that usb debugging was turned on or off - but in reality it has no effect on the actual state of the debug bridge (which is permanently on.)
I did notice:
[email protected]:/ # cd /
cd /
[email protected]:/ # grep -e 'start adbd' init*
grep -e 'start adbd' init*
init.mahimahi.usb.rc: start adbd
init.mahimahi.usb.rc: start adbd
init.mahimahi.usb.rc: start adbd
init.mahimahi.usb.rc: start adbd
init.mahimahi.usb.rc: start adbd
init.rc: start adbd
init.usb.rc: start adbd
init.usb.rc: start adbd
init.usb.rc: start adbd
init.usb.rc: start adbd
Click to expand...
Click to collapse
All the init scripts in "/" have exec, and are owned by root: "-rwxr-x--- root root", unmodified since the ROM's installation.
Are the init scripts starting up adbd irrespective of my settings? Or am I having/doing something wrong?
Has anyone else observed this behaviour?
Is there any way to fix this behaviour and have adbd run only when asked to?
Thanks in advance,
fruit-salad
===================
[email protected]:/ # uname -a
uname -a
Linux localhost 2.6.38.8-evervolv-02117-g69a13bd #1 PREEMPT Sat Sep 28 03:33:41
PDT 2013 armv7l GNU/Linux
I'm running Paranoid Android 3.99.1-RC2- Release 2 from (d-h.st/BuG)
gApps not installed yet.
boot, system and cache were wiped before install, however I did retain my sd-ext partition.
I don't have any old odex files on the sd-ext, a2sd re-optimized the apps on my sd-ext when enabled.
UPDATE:
========
my default.prop has:
#
# ADDITIONAL_DEFAULT_PROPERTIES
#
persist.sys.usb.config=mass_storage,adb
persist.service.adb.enable=1
persist.sys.strictmode.disable=true
ro.secure=0
ro.allow.mock.location=1
ro.debuggable=1
Click to expand...
Click to collapse
but trying to change
persist.service.adb.enable=1 to persist.service.adb.enable=0
and
persist.sys.usb.config=mass_storage,adb to persist.sys.usb.config=mass_storage
isn't helping. Changes are lost after an update.
According to ?t=2209401 build.prop isn't editable -- is default.prop also not editable?
I did remount / "rw" before editing.
Help?

Related

[GUIDE] Installing stock kernel with ice glacier any

I recently came across a couple of threads in which it seems it was desirable (for some) to run the stock kernel, but with the ice glacier ROM. There were a couple of methods that I saw, neither of which seemed to work for me (one was an update kernel zip file package to be applied from recovery mode from the sdcard, and the other was more involved (see THISthread). The kernel provided in that thread is actually not the true STOCK kernel, as best as I can tell. It is likely equivalent, but uname -r still returns a Gr8gorilla lable.
So I decided to try the following method. First, if you have a nandroid/clockwork recovery backup of your device before installing ice, then you already have everything you need to revert to the stock kernel. Here is the procedure.
1) reboot phone into recovery
2) go into backup and restore
3) select advanced restore
4) select the very first backup set (the stock, probably first rooted one).
5) select restore boot partition
After this completes, you'll have ice but with stock kernel. However, your wireless will not work until you place the correct kernel module file corresponding to your kernel (bcm4329.ko) in the /system/lib/modules directory. In your nandroid backup set, there is a system.img file. Transfer this file to your computer, and use unyaffs to extract its contents and look for lib/modules/bcm4329.ko
6) while in recovery mode, make sure to mount /system
7) remove or rename the /system/lib/modules/bcm4329.ko file
8) adb push bcm4329.ko /system/lib/modules/bcm4329.ko
9) unmount /system from recovery, and reboot.
That's it. I tested this and ended up seeing:
Code:
Linux localhost 2.6.32.21-g899d047 #1 PREEMPT Tue Oct 26 16:10:01 CST 2010 armv7l GNU/Linux
and my wireless was working just fine. I have attached the wireless kernel module corresponding with stock kernel, and I have attached the boot.img from stock, in case you're reading this, and by some strange reason, you don't actually have an original backup.
I don't personally plan on running stock kernel, I just wanted to see if I _could_ if I wanted to.
Hope you find this useful.
Kambiz
One thing I noted btw, is that after doing this, when I did adb shell, it dropped me into a non-root shell by default, and I had to type "su" or "su - " to gain root. The other thing to note, is that the stock initrd, has the following default.prop entry:
ro.secure=1
whereas ice has:
ro.secure=0
What does this mean?! (besides double rainbow all the way across the sky)?
Setting ro.secure=0 allows adb root functions to work.
My MyGlacier 4G MINE!!!
grankin01 said:
Setting ro.secure=0 allows the "adb remount" command to work.
My MyGlacier 4G MINE!!!
Click to expand...
Click to collapse
Right. That's what I thought. But I have to say, it seemed to work anyway, because I did:
$ su -
# mount -o remount,rw /system
and then
# cd /system/lib/modules
# mv bcm4329.ko bcm4329.ko.ice
# cp /sdcard/stock-bcm4329.ko bcm4329.ko
# chmod 644 bcm4329.ko
# cd /
# mount -o remount,ro /system
Then I rebooted, and the "stock" driver file that I just put in place was persistent. So I'm not sure if clockworkmod is doing something to ensure ro.secure=0 ... I'm not sure.
No, it means that "adb root" and "adb remount" and any of the other adb root functions will have root access to your device through Android Debug Bridge (adb) by default. My adb shell always comes up with a $ prompt and I have to "su" for root. Setting this to 0 should let you type "adb root" or " adb remount" from your command shell on your desktop and allow you a root prompt device shell or rw access to system without having to "su" or "mount -o remount,rw /dev/block/mmcblk0p25 /system".
My MyGlacier 4G MINE!!!
so this is the true stock kernel?
tiger013 said:
so this is the true stock kernel?
Click to expand...
Click to collapse
Yes. I made a clockworkmod backup (nandroid backup) after rooting my phone with visionary+, but didn't alter anything else. So once I overwrote everything with Ice Glacier, I still have stock (post OTA update to 2.2.1) kernel and wireless drivers. (attached to OP).
I don't know how to convert them to a flashable update.zip, but I was able to load them using the procedure above.
EDIT:
Notice that the output of "uname -a" when run from adb shell is:
Linux localhost 2.6.32.21-g899d047 #1 PREEMPT Tue Oct 26 16:10:01 CST 2010 armv7l GNU/Linux
The Gorilla kernels have EXTRAVERSION strings added (the kernel version follows after "Linux localhost" in that string)
thank you! I added it to my thread
thanks for this peeps

The Android Shell

The Android Shell
A "shell" is a program that listens to keyboard input from a user and performs actions as directed by the user. Android devices come with a simple shell program. This shell program is mostly undocumented. Since many people are curious about it I thought I'd write up some documentation for it.
Currently this documentation is incomplete, sorry!
Common problems
The built-in shell has very limited error handling. When you type a command name incorrectly it will say "permission denied", even though the real problem is that it couldn't find the command:
$ dir
dir: permission denied <---- this is a misleading error message, should say 'dir: not found'
$ ls
... listing of current directory
The PATH variable
The Android shell will run any program it finds in its PATH. The PATH is a colon (':') seperated list of directories. You can find out what your shell's PATH is set to by using the built-in echo command:
$ echo $PATH
/data/local/bin:/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
Depending upon your shell, you may see a different result.
Built in Commands
Every shell has a few built-in commands. Some common built-in commands are:
echo -- prints text to stdout.
set -- sets shell variables
export -- makes shell variables available to command-line programs
cd -- change the current directory.
pwd -- print name of the current directory.
Commands
To find out what commands you have available to you, use the "ls" command on each of the directories in the PATH variable.
Finding documentation for the Android commands.
Many of the Android commands are based on standard Linux (or bsd) commands. If you're curious about a command, you can sometimes learn how it works by using the "man" command on a desktop Linux or OSX (Apple Macintosh) computer. The Linux or OSX version of the command may be different in details, but much of the documentation will still apply to the Android version of the command.
Another source of documentation for people without a Linux or OSX machine handy is to use a web browser and use a web search engine to search for the text: "man Linux command-name".
List of commands
The following is a list of the commands that are present on a Nexus S phone running an Android 2.3.3 "user-debug" build. Many of these commands are not present on a "user" phone. (They are missing from a "user" phone because they are specific to developing or debugging the Android operating system.)
$ ls /data/local/bin
/data/local/bin: No such file or directory
Notice that by default there is no /data/local/bin directory. You can create this directory using the "mkdir" command if you like.
$ ls /sbin
opendir failed, Permission denied
The /sbin directory exists, but you don't have permission to access it. You need root access. If you have a developer phone, or otherwise have root access to your phone you can see what's in this directory.
$ su
# ls /sbin
ueventd
adbd
# exit
$
Notice that the shell prompt changes from a '$' to a '#' to indicate that you have root access.
Notice also that neither of the /sbin commands are useful to the shell -- the adb and ueventd files are 'daemon' programs used to implement the Android Debugger "adb" program that is used by developers.
$ ls /vendor/bin
gpsd
pvrsrvinit
Vendor/bin is where device vendors can put device-specific executables. These files are from a Nexus S.
$ ls /system/sbin
/system/sbin: No such file or directory
This directory does not exist on a Nexus S.
$ ls /system/bin
am
am is the Android Activity Manager. It's used to start and stop Android activities (e.g. applications) from the command line. Type am by itself to get a list of options.
amix
aplay
Command line audio file player.
app_process
applypatch
Used to apply patches to android files.
arec
Command line audio recorder.
audioloop
bluetoothd
BlueTooth daemon
bmgr
Backup manager - type command by itself to get documentation.
bootanimation
Draws the boot animation. You may have to reset your phone to get out of this.
brcm_patchram_plus
bugreport
cat
Copy the contents of a file to standard output.
chmod
Change the mode of a file (e.g. whether it can be read or written.)
chown
Change the owner of a file.
cmp
Compare two files byte-by-byte
dalvikvm
The dalvik virtual machine. (Used to run Android applications.)
date
Prints the current date and time
dbus-daemon
dd
Convert and copy a file. By default copies standard in to standard out.
debuggerd
dexopt
df
Shows how much space is free on different file systems on your device.
dhcpcd
dmesg
dnsmasq
dumpstate
dumpsys
dvz
fsck_msdos
gdbserver
getevent
getprop
gzip
hciattach
hd
id
ifconfig
Shows the current configuration of network interfaces (IP, MAC address etc)
iftop
Shows the current processes using the network interfaces (top, but for networks)
ime
input
insmod
installd
ioctl
ionice
iptables
Manage the firewall
keystore
keystore_cli
kill
Send signals to processes.
linker
ln
Used to set up a file system link.
log
logcat
Prints the Android runtime log.
logwrapper
ls
Lists files.
lsmod
lsof
make_ext4fs
mediaserver
mkdir
Make a directory.
monkey
A program that sends random events, used to test applications. (Like having a monkey playing with the device.)
mount
mtpd
mv
Move a file from one directory to another. (Only on the same file system. Use "cat a > b" to copy a file between file systems.
nandread
ndc
netcfg
netd
netstat
newfs_msdos
notify
omx_tests
pand
ping
pm
pppd
printenv
ps
List active processes.
qemu-props
qemud
racoon
radiooptions
reboot
Reboot the device.
record
renice
rild
rm
Remove a file.
rmdir
Remove a directory.
rmmod
route
rtp_test
run-as
schedtest
schedtop
sdcard
sdptool
sendevent
service
servicemanager
setconsole
setprop
setup_fs
sh
showlease
sleep
smd
stagefright
start
Starts the Android runtime.
stop
Stops the Android runtime.
surfaceflinger
svc
sync
system_server
tc
testid3
toolbox
top
Shows which processes are currently using the most CPU time.
umount
uptime
Prints how long your device has been running since it was last booted.
vdc
vmstat
vold
watchprops
wipe
wpa_cli
wpa_supplicant
$ ls /system/xbin
add-property-tag
btool
check-lost+found
dexdump
dhdutil
hcidump
latencytop
librank
opcontrol
oprofiled
procmem
procrank
rawbu
scp
Secure copy program. (Used to copy files over the network.)
showmap
showslab
sqlite3
Used to administer SQLite databases.
strace
System trace command - use to see what system calls a program makes.
su
Start a shell with root privileges.
Versions of the Android Shell
Android 1.0 used a shell that had no tab completion or history editing.
Android 2.3 added history editing. You can for example use the up/down arrows to edit previous commands.

Reeder A7ix generic x86 turkish tablet rooted using only adb successfully

This has been a great forum so I thought I'd share my experience rooting another misc tablet from china. A reeder A7IX from Turkey. It has a nice 1920x1200 display, crappy z2520 processor.
*
Possible Problem 1: 'fastboot oem unlock' does not work and I could only connect with fastboot under windows using the provided manufacturer flash tool from reeder. This lets you install a custom recovery.
Problem 2: there is no obvious custom recovery available for this device
Problem 3: most google searches for installing supersu require custom recovery
Problem 4: SRSroot, the first google hit, reports it is already rooted,as do root checking apps but it apps that require root do not work.
*
Solution: since the 'adb root' command is successful, you can manually execute commands with adb to install SuperSU.
1. Go to http://forum.xda-developers.com/showthread.php?t=1538053
Click CWM / TWRP / MobileODIN installable ZIP: http://download.chainfire.eu/supersu
(At this point you could try adb sideloading the zip, maybe it works? I didn't try it)
Extract the zip file to a place where you can access with ADB.
2. In the zip file there is a folder /META-INF/com/google/android/update-binary
Open update-binary in a text editor
At the top it has instructions on how to manually root. I followed the ones for API 7+ and 17+ and 19+ but not 20+ since it is android 4.2
Here is my copy from update-binary for example:
# To install SuperSU properly, aside from cleaning old versions and
# other superuser-type apps from the system, the following files need to
# be installed:
#
# API** source*********************** target***************************** chmod** chcon********************** required
#
# 7-19* common/Superuser.apk********* /system/app/Superuser.apk********** 0644*** ubject_r:system_file:s0** gui
# 20+** common/Superuser.apk********* /system/app/SuperSU/SuperSU.apk**** 0644*** ubject_r:system_file:s0** gui
#
# 17+** common/install-recovery.sh*** /system/etc/install-recovery.sh**** 0755*** *1************************* required
# 17+******************************** /system/bin/install-recovery.sh**** (symlink to /system/etc/...)******* required
# *1: same as /system/bin/toolbox: ubject_r:system_file:s0 if API < 20, ubject_r:toolbox_exec:s0 if API >= 20
#
# 7+*** ARCH/su********************** /system/xbin/su******************** *2***** ubject_r:system_file:s0** required
# 7+********************************* /system/bin/.ext/.su*************** *2***** ubject_r:system_file:s0** gui
# 17+******************************** /system/xbin/daemonsu************** 0755*** ubject_r:system_file:s0** required
# 17+******************************** /system/xbin/sugote**************** 0755*** ubject_r:zygote_exec:s0** required
# *2: 06755 if API < 18, 0755 if API >= 18
#
# 19+** ARCH/supolicy**************** /system/xbin/supolicy************** 0755*** ubject_r:system_file:s0** required
# 19+** ARCH/libsupol.so************* /system/lib(64)/libsupol.so******** 0644*** ubject_r:system_file:s0** required
#
# 17+** /system/bin/sh or mksh *3**** /system/xbin/sugote-mksh*********** 0755*** ubject_r:system_file:s0** required
# *3: which one (or both) are available depends on API
*
What does it all mean? Basically you need to transfer files from the zip file using 'adb push' and then 'adb shell chmod' as per the above list. There is one 'ln -s' as well for install-recovery.sh. I found the chcon is not required and I ignored it. (ARCH is x86).
e.g. for the first line
# 7-19* common/Superuser.apk********* /system/app/Superuser.apk********** 0644*** ubject_r:system_file:s0** gui
you need to use the commands (where (ZIP/) is from where you extracted the ZIP file):
adb root
adb push (ZIP/)common/Superuser.apk /system/app/Superuser.apk
adb shell chmod 0644 /system/app/Superuser.apk
*
The exception is
# 17+******************************** /system/bin/install-recovery.sh**** (symlink to /system/etc/...)******* required
adb shell ln -s /system/etc/install-recovery.sh /system/bin/install-recovery.sh
*
Have fun! and of course at your own risk.
Do you think this same procedure would work with the Reeder A10iX?

[Q][ROOT] Root cannot access /data (adbd insecure).

Hi there everyone!
I'm trying to `adb backup` a device with no screen. I installed CWM, a rootkit, and SuperSU/adbd insecure, fully updated. Now I have the following problem:
Code:
# Without adbd insecure, su simply fails, no message on phone from SuperSU:
pc$ adb shell
[email protected]:/ $ su
1|[email protected]:/ $
# With adbd insecure, validated in SuperSU
pc$ adb shell
[email protected]:/ # cd /data
[email protected]:/data # ls
opendir failed, Permission denied
255|[email protected]:/data # su system
DIE: credentials different than expected
1|[email protected]:/data # whoami
whoami: unknown uid 0
1|[email protected]:/data # su
[email protected]:/data # ls
opendir failed, Permission denied
Again, nothing shows up on the screen (I'm checking that using ADB Control, which, incidentally, has to be killed before launching `adb backup`, otherwise adb stops after a few seconds.)
Any help is wholefully welcome!
Configuration:
Hardware: i9195 with dead screen & digitizer, 8gb internal memory.
OS: Android 4.2.2
Mods: CWM installed using heimdall, RootKit from this thread, then SuperSU updated
Additional apps: adbd insecure, adb up to date on computer

[ROOT] FireTV2 - SSH unable to connect

All I've done is root, reboot, disable updates, reboot, install system tools via adbfire, reboot, install ssh, reboot.
So in theory this should affect all who attempt to use it.
Installed SSH via adbFire, started via ADB shell:
ADB Shell:
Code:
[email protected]:/ $ sshstatus
ssh is not running
1|[email protected]:/ $ su
[email protected]:/ # sshstart
[3993] Nov 29 04:11:19 Running in background
Mac:
Code:
$ ssh [email protected]
Warning: Permanently added '10.10.10.117' (RSA) to the list of known hosts.
CANNOT LINK EXECUTABLE DEPENDENCIES: "libc.so" is 32-bit instead of 64-bit
ADB Shell:
Code:
[3995] Nov 29 04:11:22 Child connection from 10.10.10.115:64826
[3995] Nov 29 04:11:23 Pubkey auth succeeded for 'root' with key md5 96:54:9d:f7:95:9e:4e:27:61:b3:7e:9c:fe:57:25:72 from 10.10.10.115:64826
[3995] Nov 29 04:11:23 Exit (root): Disconnect received
Looking at the filesystem you can see that both the 32bit and 64bit library files are there (output trimmed).
Code:
[email protected]:/ # find /|grep libc
/system/lib/libc.so
/system/lib64/libc.so
If I do the crazy thing of renaming the 32bit libc (so that it does not load, forcing usage of 64bit lib) it does allow SSH to work but that is way too risky of a configuration, so I won't use that.
It sounds like there is a linker path problem. The tools probably need to be properly updated for 64-bit support.
zeroepoch said:
It sounds like there is a linker path problem. The tools probably need to be properly updated for 64-bit support.
Click to expand...
Click to collapse
Zeroepoch is exactly correct. adbFire's ssh tools are 32-bit and compiled for the ATV/1. I don't have an eta for an update, sorry.

Categories

Resources