ADB in recovery question - Samsung Galaxy Nexus

Earlier today when I was having some trouble trying to get my GN booting, I went into CWM and plugged in the USB cord, and was able to ADB into the phone in recovery mode. All my files were there and I was able to push/pull what I needed.
After a full reinstall and re-root, now something has changed. When I go in by ADB in CWM recovery, all the directories appear to be empty and I can't adb pull any files out.
Any idea what changed and how to make it so I can access files again by ADB in recovery?
Just to show you what I mean, here is me doing the same ls command from the OS and from recovery:
D:\root>adb-windows shell
[email protected]:/ # cd data
cd data
[email protected]:/data # ls
ls
NVM0
NVM1
NVM13
NVM2
NVM3
NVM5
NVM6
anr
app
app-private
backup
cal.bin
dalvik-cache
data
dontpanic
drm
local
lost+found
media
misc
property
radio
resource-cache
smc
system
user
[email protected]:/data # reboot recovery
reboot recovery
D:\root>adb-windows shell
~ # cd data
cd data
/data # ls
ls
media
/data # exit
exit
D:\root>
Click to expand...
Click to collapse

Have you tried su then ls?

No difference - with ADB in recovery, su gives me:
/sbin/sh: su: not found
The sdcard directory is empty too in recovery.
And now that my phone is unbootably crashed again... I have a nandroid backup sitting on internal storage and I'm trying to find a way to yank it out with access only to bootloader and recovery.

Ok I feel silly. Had to mount everything under mounts and storage. Now I can see it all.
It turns out that because /data and /sdcard actually reside in the same place... if /data is not mounted on GN, then you can't see /sdcard either.

cmstlist said:
Ok I feel silly. Had to mount everything under mounts and storage. Now I can see it all.
It turns out that because /data and /sdcard actually reside in the same place... if /data is not mounted on GN, then you can't see /sdcard either.
Click to expand...
Click to collapse
no, /sdcard/ is just a symlink to /data/media, put there for backwards compatibility. if you 'ls /data/media/' you should be able to see all "sdcard" contents.

Related

Mounting /system as rw

Alright, so I've been trying to mount the /system partition as rw today now that we have perm-root and I've been failing. I'm tried multiple mount options such as
mount -o rw,remount -t ext3 /system
mount -o rw,remount -t ext3 /dev/block/mmcblk0p15 /system
and a few others. The command works but when I try to uninstall an application via the package manager:
pm uninstall /system/app/amazonmp3.apk
pm uninstall /system/app/amazonmp3
I get failure.
I was also searching in the init.rc scripts in /, and noticed that it mounts the /system twice. Once in rw and then again in ro. I can't change that file though since for whatever reason, I still can't access the /system even with perm-root (s-off).
Titanium Backup also doesn't detect any /system applications.
Any thoughts, or enlightening clarifications? I'm not a Linux beginner and have experience in system administration all the way from Debian Sid to Arch Linux.
EDIT:
Solution: I have ro.secure=0 now and the remount is now successful.
You are using the pm command incorrectly. The argument is package name, not file name.
pm uninstall com.amazon.mp3
pm list packages for a full list.
That would be the reason. Unfortunately I can't look at the man pages of these commands on the phone ;D.
You edited your post to show that you now have r/w access to the /system folder, but you didn't say how you achieved ro.secure=0.
Care to share? I'm having the same issue.
perm root will give you ro.secure=0
jgro1976 said:
You edited your post to show that you now have r/w access to the /system folder, but you didn't say how you achieved ro.secure=0.
Care to share? I'm having the same issue.
Click to expand...
Click to collapse
rosecure=0 is set in the ramdisk of the kernel. It allows easy mounting rw , as in adb remount, however shouldn't be needed. Use this to mount as rw:
# mount -o rw,remount /dev/block/mmcblk0p25 /system
Replace rw with ro and run again when your done to return system to ro. I just tested it and it does mount as rw
Just to make sure it worked, I type that and get:
Usage: mount [-r] [-w] [-options] [-t type] device directory
after trying this.
jgro1976 said:
Just to make sure it worked, I type that and get:
Usage: mount [-r] [-w] [-options] [-t type] device directory
after trying this.
Click to expand...
Click to collapse
U sure you typed it exactly as I did?
There is a space after /dev/block/mmcblk0p25 before /system
Edit: and no space between comma and remount as in rw,remount
Yeah, that's how I typed it, exactly as you had it =\
jgro1976 said:
Yeah, that's how I typed it, exactly as you had it =\
Click to expand...
Click to collapse
Hmm, and you did this from root prompt # not $.
Can anyone else confirm or deny that command for me. I'm gonna flash a unmodified kernel when I get home tonight and see if that makes a difference.
fastludeh22 said:
Hmm, and you did this from root prompt # not $.
Can anyone else confirm or deny that command for me. I'm gonna flash a unmodified kernel when I get home tonight and see if that makes a difference.
Click to expand...
Click to collapse
I can confirm it doesn't work on my G2 either. I'm using Cyanogen RC1 btw.
try
mount -o remount,rw /dev/block/mmcblk0p25 /system
maybe the rw has to come after remount.
Anyways, I know mine works on permrooted stock
That did the trick, thanks!
ratchetrizzo said:
try
mount -o remount,rw /dev/block/mmcblk0p25 /system
maybe the rw has to come after remount.
Anyways, I know mine works on permrooted stock
Click to expand...
Click to collapse
jgro1976 said:
That did the trick, thanks!
Click to expand...
Click to collapse
So weird. If I type it that way, I get the mount options menu u were getting. If I type it my way it works.
I was messing around with remounting the /system partition with rw permissions, and the thing is that it does work as in, it doesn't give you an error when mounting, but it still doesn't let you access it. It's weird.
As for the ro.secure, I just used installed bacon bits, and it did it for me.
There's an app for that! I'm using a market app called mount /system (rw / ro). You can just search mount rw in the market, its free too
Sent from my T-Mobile G2 using XDA App
Can't you just use adb remount?
It worked for me (GT-P1000, CM 10.1-20130218-experimental- cdesai)

[SOLVED?] Busybox causes /system to be read-only?

First, my Euro Desire Z is S-Off (using the gfree method) and perm-rooted.
I was messing with installing some new keyboard layouts to the /system folder, when I found and installed busybox from the market to use its cp command...
Then I discovered I could no longer write to /system -- I could before busybox
I booted to recovery, installed my nandroid backup (taken before installing busybox), and I still can't get write access to /system
I did a factory wipe (still have S-Off) ran visionary to root and permroot ( I get the # prompt just fine) and still no write access to /system.
I restored my nandroid to get my apps back and still can't seem to get write access.
Any ideas
Hmm -- I just found and installed "mount /system" from the market and that did it -- I can now write to /system.
Not sure why it stopped working before... Busybox may have been a red herring.
I think it was just that you still had /system mounted as read-only, and that app just mounted it as read-write (i.e. "mount /system -o rw, remount" )
steviewevie said:
I think it was just that you still had /system mounted as read-only, and that app just mounted it as read-write (i.e. "mount /system -o rw, remount" )
Click to expand...
Click to collapse
Yeah -- I had it RW and something must have remounted it to RO --perhaps when I was doing an adb session...
Speaking of BusyBox -- whats the best version people are using for the DZ?

[Q] How do i transfer files to GNex when in recovery mode?

So i've made a mistake. I forgot to download GAPPS but i've already done a factory reset and installed a new rom. I cant seem to mount the usb storage trough clockwork recovery. Is there a way to push the zip file to the device?? Or what should i do?
Thanx
xclusiv8 said:
So i've made a mistake. I forgot to download GAPPS but i've already done a factory reset and installed a new rom. I cant seem to mount the usb storage trough clockwork recovery. Is there a way to push the zip file to the device?? Or what should i do?
Thanx
Click to expand...
Click to collapse
If you only forgot gapps you can restart, the ROM and the phone will work fine you just won't have Google apps. Once it's on you can just copy the file like usual and return to recovery and flash it
Sent from my Galaxy Nexus using xda premium
Good question though. What IF he didnt flash the ROM, how do you get a file on the SDcard if you cant mount it in recovery?
adb push ./"filename.zip" /sdcard
Phone will boot just fine w/o GAPPS.
But you can just use adb push <FILE> <DIRECTORY>
for example:
Code:
adb push gapps.zip /sdcard/
Thanx for the help guys =)
This happens to me all the time. The Mounts section of CWM select "mount as USB" drive. Windows should see this drive and transfer away.
merge5 said:
This happens to me all the time. The Mounts section of CWM select "mount as USB" drive. Windows should see this drive and transfer away.
Click to expand...
Click to collapse
GN internal storage can't be mounted as USB - not even in recovery.
The only way I've found to push/pull files in CWM on the GN is over ADB. If the files in /sdcard/ don't appear, go into mounts and storage, and mount /data. Then try again.
/sdcard/ is nothing more than a symlink to /data/media.
I transfer files over ADB with
'adb push update.zip /data/media/'
no need to mount /data before.
just reboot open up your computer and youll see the gnex just transfer the gapps to your sd card and then reboot in recovery to flash
cmstlist said:
GN internal storage can't be mounted as USB - not even in recovery.
The only way I've found to push/pull files in CWM on the GN is over ADB. If the files in /sdcard/ don't appear, go into mounts and storage, and mount /data. Then try again.
Click to expand...
Click to collapse
Good point. I stand corrected. That was how I did it on my OG Droid. Sorry for the confusion.
bk201doesntexist said:
/sdcard/ is nothing more than a symlink to /data/media.
I transfer files over ADB with
'adb push update.zip /data/media/'
no need to mount /data before.
Click to expand...
Click to collapse
I'm not sure why but CWM on my phone used to auto mount /data and now it doesn't anymore. So to see anything from adb in recovery, I now have to go to mounts first.
Sent from my Galaxy Nexus using Tapatalk
cmstlist said:
I'm not sure why but CWM on my phone used to auto mount /data and now it doesn't anymore. So to see anything from adb in recovery, I now have to go to mounts first.
Sent from my Galaxy Nexus using Tapatalk
Click to expand...
Click to collapse
What cwm version are you on, for instance?
Latest CWM touch as of today, and also tried it with latest CWM non-touch.
Incidentally I just bumped into a caveat of transferring files to the GN in recovery mode. The permissions are set strangely when you push files over ADB in recovery, and as a result when booted into the OS I was unable to rename any of the pushed files/folders or put new files in. Since the DCIM directory was one that I'd pushed over, new photos weren't saving. And I did not have permission to change permissions.
This is pretty much a brute force method - so I rebooted into recovery again, mounted /data, did adb shell, cd sdcard, and then:
chmod -R 777 *
And upon booting back into the OS, everything works properly again.
I know that messing with permissions is usually a dangerous thing. My logic was that anything stored in /sdcard is supposed to be a file that any app would be allowed to access as long as it has SD permissions - it's been that way in every version of the OS through to 4.0.
But anyway, if there's something I should do to decrease the "unsafeness" of this situation, please advise me. I guess in theory this would give a malicious app permission to execute code from /sdcard, which would make me more vulnerable?
EDIT: Okay more to report. To see the permissions properly when booted into the OS, you have to go into /data/media rather than /sdcard (same directory but permissions appear differently).
When I went in there and typed ls -n, I found that all the files I had pushed in recovery have UID & GID of 0. All files I had created afterwards had UID & GID of 1023. That explains everything. The owner is root for files that came from ADB in recovery, and media_rw for files created in the OS.
I can use chown, but it looks like the version of chown that comes with busybox does not have -R recursion implemented. Hrm. Aha! In CWM, chown does support -R. And we're off to the races. So from recovery I did:
cd /data/media
chown -R media_rw.media_rw *
cmstlist said:
Latest CWM touch as of today, and also tried it with latest CWM non-touch.
Incidentally I just bumped into a caveat of transferring files to the GN in recovery mode. The permissions are set strangely when you push files over ADB in recovery, and as a result when booted into the OS I was unable to rename any of the pushed files/folders or put new files in. Since the DCIM directory was one that I'd pushed over, new photos weren't saving. And I did not have permission to change permissions.
This is pretty much a brute force method - so I rebooted into recovery again, mounted /data, did adb shell, cd sdcard, and then:
chmod -R 777 *
And upon booting back into the OS, everything works properly again.
I know that messing with permissions is usually a dangerous thing. My logic was that anything stored in /sdcard is supposed to be a file that any app would be allowed to access as long as it has SD permissions - it's been that way in every version of the OS through to 4.0.
But anyway, if there's something I should do to decrease the "unsafeness" of this situation, please advise me. I guess in theory this would give a malicious app permission to execute code from /sdcard, which would make me more vulnerable?
EDIT: Okay more to report. To see the permissions properly when booted into the OS, you have to go into /data/media rather than /sdcard (same directory but permissions appear differently).
When I went in there and typed ls -n, I found that all the files I had pushed in recovery have UID & GID of 0. All files I had created afterwards had UID & GID of 1023. That explains everything. The owner is root for files that came from ADB in recovery, and media_rw for files created in the OS.
I can use chown, but it looks like the version of chown that comes with busybox does not have -R recursion implemented. Hrm. Aha! In CWM, chown does support -R. And we're off to the races. So from recovery I did:
cd /data/media
chown -R media_rw.media_rw *
Click to expand...
Click to collapse
that would explain it: i always use /data/media, didn't find any permission issues yet. thanks.

[HOW TO] add extra +700mb to Internal memory storage +600-900MB from /system

[Tweak root] add extra +700mb to Internal memory storage from /cache & +600-900MB from /system folders.
just run terminal with root & paste code
su
chmod -R 777 /cache
mkdir /cache/"your-program-folder"
mount -o bind /cache/"your-program-folder" /storage/sdcard0/"your-program-folder"
add extra +600mb (+900mb if you have LiteRom) from /system folder.
su
mkdir /system/share
chmod -R 777 /system/share
mount -o bind /system/share /storage/sdcard0/sharе
before you can write to /storage/sdcard/share mount it RW
su
mount -o rw,remount /system
after every reboot do it again. how add script to startup folder, any Idea?
all work great. I have 4.5GB + 700MB + 800MB internal storage for my music and maps.
But you cant use any OTA updates because your download /cache folder filed now. Remove all data before update
rm -R /system/share/*
rm -R /cache/*
Re: [Tweak root] add extra +700mb to Internal memory storage
Are you sure you got these commands right? And why don't you just make a script to automatically run these commands at boot? You know, so you don't have to keep running the commands over and over? And you have the work "program" spelled wrong. Its spelled with only 1 "m". Program, not programm.
Sent from my XT907 using Tapatalk 2
Re: [Tweak root] add extra +700mb to Internal memory storage
So what happens if you are using your whole internal sd including this 700 megs and you reboot? Does the system freak out?
Sent from my XT907 using Tapatalk 2
Update
sniperkill
absolutely right. And why don't you just make a script to automatically run these commands at boot?
How, do it, init.rc not work.
Clienterror said:
So what happens if you are using your whole internal sd including this 700 megs and you reboot? Does the system freak out?
Sent from my XT907 using Tapatalk 2
Click to expand...
Click to collapse
everything will be fine, just live little more space on /cache (100mb at least)
UPDATE 1st post. add extra +600mb (+900mb if you have LiteRom) from /system folder. Now I have 6GB internal storage for my music and maps.
su
mkdir /system/share
chmod -R 777 /system/share
mount -o bind /system/share /storage/sdcard0/share
before you can write to /storage/sdcard/shear mount it RW
su
mount -o rw,remount /system
But you cant use any OTA updates because your download /cache folder filed now. Remove all before update
rm -R /system/share/*
rm -R /cache/*
serraxer said:
sniperkill
absolutely right. And why don't you just make a script to automatically run these commands at boot?
How, do it, init.rc not work.
everything will be fine, just live little more space on /cache (100mb at least)
UPDATE 1st post. add extra +600mb (+900mb if you have LiteRom) from /system folder. Now I have 6GB internal storage for my music and maps.
su
mkdir /system/share
chmod -R 777 /system/share
mount -o bind /system/share /storage/sdcard0/share
before you can write to /storage/sdcard/shear mount it RW
su
mount -o rw,remount /system
But you cant use any OTA updates because your download /cache folder filed now. Remove all before update
rm -R /system/share/*
rm -R /cache/*
Click to expand...
Click to collapse
Well, make a new folder on your sdcard, I used root explorer. I called it "67tweaks", I then zipped up the folder, then navigated to my zipped folder and I removed the .zip extension (doing it this way allowed me to make a new text document, but theres prolly an easier way, but this is the way i used) and then I long pressed it so it would let me open it up as a text document. I deleted some jibberish that was inside, I then started with #!/system/bin/sh, then space, then pasted your commands under the space and I then placed the file under system/etc/init.d folder. Now every time I boot up, the script gets run. You can also use an app like "ROM toolbox" and go to scripts and just create a new script and select it to run at boot, or you can use SMmanager and create a script to run at boot.
serraxer said:
sniperkill
absolutely right. And why don't you just make a script to automatically run these commands at boot?
How, do it, init.rc not work.
I'm no dev so I wouldn't be able to make a script to run at boot, but if you don't have init.d support you can add a script to your init.qcom.post_boot.sh file in system/etc folder and it should run at boot.
Sent from my HTCONE using Tapatalk 2
Click to expand...
Click to collapse
Looks right to me.
Thanks for the info. I am learning to love my M more and more.
thinks, I'm going to have a try.
serraxer said:
[Tweak root] add extra +700mb to Internal memory storage from /cache & +600-900MB from /system folders.
just run terminal with root & paste code
su
chmod -R 777 /cache
mkdir /cache/"your-program-folder"
mount -o bind /cache/"your-program-folder" /storage/sdcard0/"your-program-folder"
add extra +600mb (+900mb if you have LiteRom) from /system folder.
su
mkdir /system/share
chmod -R 777 /system/share
mount -o bind /system/share /storage/sdcard0/sharе
before you can write to /storage/sdcard/share mount it RW
su
mount -o rw,remount /system
after every reboot do it again. how add script to startup folder, any Idea?
all work great. I have 4.5GB + 700MB + 800MB internal storage for my music and maps.
But you cant use any OTA updates because your download /cache folder filed now. Remove all data before update
rm -R /system/share/*
rm -R /cache/*
Click to expand...
Click to collapse
I cut and pasted this exactly and it doesn't work. Can you please reply with exact sequences. I keep getting mkdir failed for /cache/your-program-folder, File exists
Will this work on a bionic?
Sent from my DROID BIONIC using XDA Premium HD app

[Q] Need help deleting a directory

So here's the thing i've been exploring the possibilities of USBHost and decided to try an usb stick so i installed Paragon https://play.google.com/store/apps/details?id=com.paragon.mounter
It took me a while to get the hang of things. At first my usbstick was formatted in fat32. I specified in paragon i would like the default mount point to be USBStorage instead of /paragonNTFS. I made a small typo at first and named the folder usbStorage
now here comes the problem.
for some reason the app created 2 subfolders called sdb1 and sdb2 and i cannot remove them
Things i've tried:
cyanogenmod file manager in root access mode
-- delete directory > "This operation needs elevated permissions. Try switching to root access mode" (translated from dutch so wording may be a bit off
-- modifying permissions of folders > denied > changing permissions failed. for security reasons some filesystems, such as on sdcards do not allow changing permissions
Same problem for Astro file manager
Same problem when attaching the tablet to computer. parent directory (and sub dirs) get "removed" in windows but when checking the file system on the tablet, the opposite is true and the directories is still present
and now it's starting to piss me off. I want that folder "usbStorage" and it's subfolders "sdb1" and "sdb2" removed. so my guess is it'll have to be done by terminal commands but my terminal experience is ZERO.
in preperation of you guys helping me installed https://play.google.com/store/apps/details?id=jackpal.androidterm the same one used in cyanogenmod roms. I tried a bit of tinkering myself but prob doing something wrong
what i've tried (in sequence, --ok behind the command means it was succesfully executed)
su --ok
cd sdcard --ok
*rm -rf /usbStorage >> *rm: not found
rm -rf /usbstorage --ok, but folder was still present
rm -rf usbstorage --rm failed for usbStorage, Directory not empty
cd usbStorage --ok
rm -rf sdb1 --ok, rm failed for sdb1, Permission denied
at that point i gave up. I hope you guys can help me out
I do have paragon configured properly now and my USBstick in NTFS is getting recognised. Upon mounting of the usbstick, it now creates a folder called "USBStorage" where the contents of the usb stick is properly displayed.
so where are those android terminal / linux masters to help me out
only thing i can add is that when opening paragon with the stick attached but unmounted i do see a line above it /dev/block/sda1 but that doesn't seem to affect mounting in the specified directory
Bump, anyone? I want and need this folder removed
Verstuurd vanaf mijn Nexus 7 met Tapatalk
From my understanding of your post.
You are rooted and using cyanogenmod?
Did you try going into the app information and clear data?
In the app drawer hold the app and then drag it to App Info
Clear data.
Did that solve it? If not continue below.
Make sure you don't have the USB stick mounted and or plugged in.
Then go into terminal and type
su
Then type.
mount
The mount command shows all listed mount points. If you don't see the usbStorage or whatever mounted.
Then type.
busybox rm -rf usbStorage
Or whatever the main directory is...
For example directory is at.
/sdcard/usbStorage
cd /sdcard
rm -rf usbStorage
Let me know how you make out.
Sent from my Galaxy Nexus using xda app-developers app
nope, my phone is running CM 10.2 (not relevant to the question) this is the nexus section and its my nexus 7 2013 running stock rom but rooted yes that needs the folders removed.
The folders i need to delete according to the Nexus 7 mount main mount path SD content
main path: /storage/emulated/0 or /storage/emulated/legacy (both are the same according according to ParagonNTFS as a folder the mount path /sdcard/USBStorage = /storage/emulated/0/USBStorage or /storage/emulated/legacy/USBStorage
important lines?
/dev/fuse /storage/emulated/0/ fuse rw,nosuid,nodev,realtime, user_id=1023, default_permissions,allow_other 0 0
/def/fuse /storage/emulated/legacy fuse rw,nosuid,nodev,relatimeuser,user_id=1023, group_id=1023,default_permissions,allow_other 0 0
folders to delete are
/storage/emulated/0/usbStorage
/storage/emulated/0/usbStorage/sdb1 <= can select these just fine
/storage/emulated/0/usbStorage/sdb2
/storage/emulated/0/ParagonNTFS <= simply selecting this folder prompts CM manager "this operation needs elevated priviledges. Try switching to rootmodus, even when the CM filemanager already is in root mode
so i went
Opening terminal
su
cd sdcard (command ok)
cd usbStorage (commando ok)
busybox rm -rf sdb1
rm: can't remove 'sdb1': permission denied
Then i tried
cd /sdcard
rm -rf usbStorage
rm failed for usbStorage, Directory not empty
cd usbStorage
rm -rf sdb1
rm failed for sdb1, Permisison denied
busybox rm -rf sdb1
rm: can't remove 'sdb1': Permision denied
According to Cyanogen mod file manager:
Filesysteminfo:
Status: rw
linkpath?: /storage/emulated/0
Device: /dev/fuse
Type: fuse
Options: rw,nosuid,nodev,relatime,user_id=1023,default_permissions,allow_other
Dump / Pass: 0 / 0
even with the app ParagonNTFS uninstalled it doesnt work
hmm
try
close the app ParoganNTFS and uninstall it.
then try to delete those directories.
Also when you type
mount
does it show any of the directories you are trying to delete as mounted?
if it is try
umount /sdcard/usbStorage/sdb1
rm -rf /sdcard/usbStorage/sda1
were you able to delete the dir?
I had the same problems under very similar circumstances. Stickmount rather than paragon. The only way I could delete the dir was to boot into recovery (team win recovery project v2.7.1.1) and delete it with TWRP's terminal command. Something in the OS apparently locks on to the mount and simply will not let it go ever. It has to be done before android starts. It's very annoying. I am beginning to really be disgusted with many of the decisions google is making with regard to android. Why do they hate sdcard expansion so much? its absurd.
---------- Post added at 04:22 AM ---------- Previous post was at 04:17 AM ----------
Oh and by the way, even though the OS latched on to that folder as if its very existence depended on it, I was never able to even see the files on the USB memory stick with any file explorer. Worked just fine in kit kat and before. In some ways lollipop really sucks.

Categories

Resources