Hopefully this is the right place for this.
Trying to write a script that will auto mount/unmount my SMB shares using CIFS based on this post:
http://forum.xda-developers.com/showthread.php?t=1151949
Everything works well except for unmounting the share.
It's weird - when I adb shell and issue "umount /sdcard/cifsshare" as superuser the share unmounts fine. If I create a script and put in a single line "umount /sdcard/cifsshare" and run the script via adb shell as superuser I get the error: failed: No such file or directory. What's the difference?
This is driving me nuts!!!!!!!!!!
I've also tried "umount /mnt/sdcard/cifsshare" as suggested in the linked post but this didn't work either......:crying:
Please help - I'm about to throw this phone out the window!
You can use the mount command on your device terminal to view all mountpoints. How is your SMB share listed?
Petrovski80 said:
You can use the mount command on your device terminal to view all mountpoints. How is your SMB share listed?
Click to expand...
Click to collapse
Thanks, good idea.
mount shows in mounted as /storage/sdcard0/cifsshare but unfortunately again - it works if I issue the command "umount /storage/sdcard0/cifsshare" at the command line but if I create a script with the same line in it and run the script I still get the error: failed: No such file or directory
This doesn't make any sense?
rob151515 said:
Thanks, good idea.
mount shows in mounted as /storage/sdcard0/cifsshare but unfortunately again - it works if I issue the command "umount /storage/sdcard0/cifsshare" at the command line but if I create a script with the same line in it and run the script I still get the error: failed: No such file or directory
This doesn't make any sense?
Click to expand...
Click to collapse
You could try to use the mount command in that script, and see what mountpoints that shows.
Petrovski80 said:
You could try to use the mount command in that script, and see what mountpoints that shows.
Click to expand...
Click to collapse
Ok I'm not quite sure what happened but it seems to be working now....
I did what you said, I put mount in the script and it was still indicating /storage/sdcard0/cifsshare but using this path with umount was still giving me the error. I then put "ls -l /storage/sdcard0/cifsshare" as a command directly above "umount /storage/sdcard0/cifsshare" in the script and it seems to have started working - no more error....
very weird.....
Anyway I appreciate your help on this - thanks!
Ok, good thing that it works now.
Sent from my Galaxy Nexus using Tapatalk 2
rob151515 said:
Ok I'm not quite sure what happened but it seems to be working now....
I did what you said, I put mount in the script and it was still indicating /storage/sdcard0/cifsshare but using this path with umount was still giving me the error. I then put "ls -l /storage/sdcard0/cifsshare" as a command directly above "umount /storage/sdcard0/cifsshare" in the script and it seems to have started working - no more error....
very weird.....
Anyway I appreciate your help on this - thanks!
Click to expand...
Click to collapse
Are you shebanging your script properly? The first line of a shell script should point to your shell environment. For instance:
Code:
#!/system/bin/sh
umount /sdcard/cifsshare
If you don't shebang properly, the script can sometimes do some funky things.
Cilraaz said:
Are you shebanging your script properly? The first line of a shell script should point to your shell environment. For instance:
Code:
#!/system/bin/sh
umount /sdcard/cifsshare
If you don't shebang properly, the script can sometimes do some funky things.
Click to expand...
Click to collapse
I don't think I am (bit of a noob i'm afraid) - I have #!/bin/bash not #!/system/bin/sh at the top of the script.
The bash shell is not available on JB by default. Use the path to sh as suggested by cilraaz.
Sent from my Galaxy Nexus using Tapatalk 2
Petrovski80 said:
The bash shell is not available on JB by default. Use the path to sh as suggested by cilraaz.
Sent from my Galaxy Nexus using Tapatalk 2
Click to expand...
Click to collapse
Ok sorry, thought it was working - well it was sort of.....
I wanted to add a second share to the script.
My working script:
#!system/bin/sh
umount /sdcard/cifsshare1
Now I added a second line to the script and the whole thing starts failing again:
#!system/bin/sh
umount /sdcard/cifsshare1
umount /sdcard/cifsshare2
causes the error 'failed: No such file or directory'.
what's really strange is this works:
#!system/bin/sh
umount /sdcard/cifsshare1
this doesn't:
#!system/bin/sh
umount /sdcard/cifsshare1
#test
Is this weird or am I doing something totally wrong - it's like it will run fine as long as there's only one line in the script????
I should also mention that I'm running it using from adb shell:
sh ./cifs_unmount.sh
is this correct?
What are you using to write the script?
For example, Windows notes can introduce undesired formatting, especially on line breaks...
danger-rat said:
What are you using to write the script?
For example, Windows notes can introduce undesired formatting, especially on line breaks...
Click to expand...
Click to collapse
Unfortunately I am using Windows but I am using plain old notepad so I would have thought that would be ok.
rob151515 said:
#!system/bin/sh
umount /sdcard/cifsshare1
umount /sdcard/cifsshare2
causes the error 'failed: No such file or directory'.
Click to expand...
Click to collapse
You need the leading slash on your path:
#!/system/bin/sh
rob151515 said:
Unfortunately I am using Windows but I am using plain old notepad so I would have thought that would be ok.
Click to expand...
Click to collapse
Go get NotePad++, as it has the ability to write with windows end lines as well as Unix end lines.
Sent from my Galaxy Nexus using Tapatalk 2
Related
Debian Image Builder...
So basically, I've been reading several different articles, etc. on running Debian and/or Ubuntu on Android. I did this on my Eris and D1 in the past, and I figured that it would work even better on the Galaxy Nexus. Of course it does... Anyway, it can be run from a loop mounted image or a separate partition on most phones. However, for phones like this one with no sdcard slot, it makes sense to just do the image thing.
After building and rebuilding an image a few times, I decided to do what I normally do and turn those crazy linux commands into a script. It's not really all that complex or fancy, but it works and can be improved. I hope you find it helpful.
NOTE: This is really just the first step in getting Debian running on your phone. This will just create the image. You still have some work to do. There are other ways to do this, but I like having control of the initial image...
1/14/2012 - fixed some typos and added 'apt' as a default package (debootstrap did this by default, but apparently multistrap doesn't)
1/16/2012 - removed multistrap and went back to debootstrap for now
1/21/2012 - added a setup script to do the second stage and updates after booting into Debian on the phone, fixed extra package install code
1/22/2012 - updated variable code per swordrune10's suggestion
Download: https://github.com/gnarlyc/DebianImageBuilder
Currently requires Debian 6, but feel free to fix that for me.
Rock on.
Thanks. I had fun with Debian on my Eris back when that was being worked on. I am sure this will be much faster on this beast.
synesthete said:
Thanks. I had fun with Debian on my Eris back when that was being worked on. I am sure this will be much faster on this beast.
Click to expand...
Click to collapse
It does, and it's pretty sweet with a bluetooth keyboard & mouse and a monitor via a MHL video cable. I've even compiled a kernel or two on it.
Where do we put the image? Do we have to create a new partition?
Sent from my Galaxy Nexus using XDA App
ttereve said:
Where do we put the image? Do we have to create a new partition?
Sent from my Galaxy Nexus using XDA App
Click to expand...
Click to collapse
No, you don't have to create a partition. Here's what I do:
I use Connectbot for a terminal emulator, but there are others out there.
One time:
1) 'mkdir /data/local/debian' (don't type the single quotes)
2) copy the image to /sdcard/
Each time I start up (actually, I've made a script for this too):
1) 'su'
2) 'mount -o loop -t ext2 /sdcard/linux.img /data/local/debian'
3) 'chroot /data/local/debian /bin/bash'
4) ta-da!
You should be at a Debian bash prompt. Check /etc/apt/sources.list to make sure it's there and has 'deb http://ftp.us.debian.org/debian squeeze main'. You might also have to do 'dkpg --configure -a'. If it looks like that's needed each time, I'll automate it. If you install a desktop gui like xfce or whatever, you'll probably want to install tightvncserver in Debian and get an Android VNC client from the Market. I'll probably add more options to make these things a little easier in the future.
I'm still going through the entire process over and over until I get things how I want it, so the script will be updated as I get the time.
I'm guessing we can use ext3 (or even ext4) instead of ext2?
ttereve said:
I'm guessing we can use ext3 (or even ext4) instead of ext2?
Click to expand...
Click to collapse
I dunno. It won't hurt to try!
Is there any chance that this will work on GSM GN?
Sent from my Galaxy Nexus using xda premium
JTECJ said:
Is there any chance that this will work on GSM GN?
Sent from my Galaxy Nexus using xda premium
Click to expand...
Click to collapse
Yes. This just builds the rootfs in an image. It should work for nearly any arm based Android device. I'm still working out some kinks with getting vnc and SSH servers working though. These worked fine when I used debootstrap to create the rootfs, but multi strap is much more flexible. So, I'm going to keep trying multi strap for a bit.
alright I can get into [email protected] bash but i can't start ssh because well, there is no ssh in/etc/init.d/ how do I get it in there? (i built my own ubuntu rootfs with rootstock)?
ttereve said:
alright I can get into [email protected] bash but i can't start ssh because well, there is no ssh in/etc/init.d/ how do I get it in there? (i built my own ubuntu rootfs with rootstock)?
Click to expand...
Click to collapse
Did you install openssh-server?
EDIT: Yeah, some things aren't working quite right with installing and updating packages. I might have to re-work it with debootstrap again... Oh well.
Ok. Give me a day or two. I've re-written the script using debootstrap instead. I'll update the repo as soon as I do my initial test, which should be later tonight.
sweet I got it all to work! I'll try and get a script up for the way I did it.
btw I used a rootstock ubuntu rootfs
now I need to figure out how to setup gnome through command line!
ttereve said:
sweet I got it all to work! I'll try and get a script up for the way I did it.
btw I used a rootstock ubuntu rootfs
now I need to figure out how to setup gnome through command line!
Click to expand...
Click to collapse
Cool! I read something about rootstock, but never really looked too deep. Yeah, post your code. That would be great. I have used debootstrap before, so I know it works. The thing that I never liked is that you have to run '/debootstrap/debootstrap --second-stage' after you boot into Debian on the phone. With multistrap, the packages are supposed to all be there and ready to go. (At least, that's how I understand it.) Anyway, I'm working out debootstrap again, and will just do a one-shot startup script or something. Or maybe, I'll switch gears and do it your way instead...
from: http://androlinux.com/android-ubuntu-development/how-to-build-chroot-arm-ubuntu-images-for-android/
build rootfs
Code:
sudo rootstock \
--fqdn ubuntu \
--login ubuntu \
--password ubuntu \
--imagesize 4G \
--seed linux-image-omap,build-essential,ssh,tightvnc
then make an image:
Code:
dd if=/dev/zero of=ubuntu.img bs=1MB count=0 seek=4096
format as ext4
Code:
mkfs.ext4 -F ubuntu.img
mount empty image
Code:
sudo mount -o loop ubuntu.img /mnt
extract rootfs inot image
Code:
sudo tar -C /mnt -zxf armel-rootfs-datetag.tgz
and unmount
Code:
sudo umount /mnt
this is my script to get chroot working (but this script fails and idk why so any help would be appreciated) (modified from the script http://burningbroccoli.se/post/949205350/chrootd-ubuntu-on-samsung-galaxy-s-android):
Code:
#!/bin/sh
echo "mount the image"
mount -o loop -t ext4 /sdcard/ubuntu.img /data/local/ubuntu
echo 'Mounting proc,sys and dev'
busybox mount -t proc proc /data/local/ubuntu/proc
busybox mount --bind /sys /data/local/ubuntu/sys
busybox mount --bind /dev /data/local/ubuntu/dev
echo 'Exporting a proper path'
export PATH=/bin:/usr/bin:/sbin:/usr/sbin:$PATH
echo 'Chrooting and starting ssh server'
chroot /data/local/ubuntu /bin/bash
echo "And your ip is:"
busybox ifconfig | busybox grep "inet addr"
I looked at rootstock. It doesn't appear to be Debian friendly, but maybe I'm just missing something. As soon as I'm happy with this on Debian, I'll look into making it work on Ubuntu also. I also realized that debootstrap has an option to install extra packages, so that's cool.
Right now, this is working well for me, but there are things that I would like to add.
ran into a problem, apparently it doesnt know let so it pretty much didnt work..
Code:
./debianImageBuilder.sh: 20: let: not found
running oneiric and the UI is gnome3
---------- Post added at 04:53 PM ---------- Previous post was at 04:37 PM ----------
nvm, i got it to work by modifying it to this.. u can do whatever to the code, im just happy to help... tho im not sure why let doesnt work for me x.x
Code:
export image_name=debian.img
export build_folder=image_folder
real_image_size=$(6442450944)
echo "******************************"
echo "Installing dependencies"
echo "******************************"
apt-get install debootstrap
echo "******************************"
echo "Gather info"
echo "******************************"
echo -n "What size image would you like to create? (in GBs): "
read image_size
real_image_size=$(((($image_size * 1024) * 1024) * 1024))
swordrune10 said:
ran into a problem, apparently it doesnt know let so it pretty much didnt work..
Code:
./debianImageBuilder.sh: 20: let: not found
running oneiric and the UI is gnome3
---------- Post added at 04:53 PM ---------- Previous post was at 04:37 PM ----------
nvm, i got it to work by modifying it to this.. u can do whatever to the code, im just happy to help... tho im not sure why let doesnt work for me x.x
Code:
export image_name=debian.img
export build_folder=image_folder
real_image_size=$(6442450944)
echo "******************************"
echo "Installing dependencies"
echo "******************************"
apt-get install debootstrap
echo "******************************"
echo "Gather info"
echo "******************************"
echo -n "What size image would you like to create? (in GBs): "
read image_size
real_image_size=$(((($image_size * 1024) * 1024) * 1024))
Click to expand...
Click to collapse
Cool. That does look a bit cleaner. The code for installing extra packages wasn't right/all there, so I'm working on that now.
Thanks for this script. It worked perfectly for me. It's great to be able to apt-get things on my phone, and it's interesting to run debian's utilities on Android. A lot of other methods are about getting some sort of Linux desktop on Android, but I really appreciate the barebones CLI that this provides. To my knowledge this is the only way to be able to run ping6 on Android.
To anyone thinking of setting this up - make sure to install busybox!
I made a couple of helper scripts to get cleanly in and out of the chroot, and to make the sdcard directory available within debian. I'm keeping this stuff stored in /sdcard/debian:
Code:
[email protected]:/sdcard/debian # ls
debian.img
debroot
start.sh
stop.sh
start.sh
Code:
mount -o loop -t ext2 debian.img debroot
busybox mount --bind /sdcard debroot/mnt
chroot debroot /bin/bash
stop.sh
Code:
umount /mnt/sdcard/debian/debroot/mnt
umount /mnt/sdcard/debian/debroot/dev/pts
umount /mnt/sdcard/debian/debroot/proc
umount /mnt/sdcard/debian/debroot/sys
umount /mnt/sdcard/debian/debroot
Hi,
I recently had to unroot and I backed up all my data from the SD card. After flashing CWM again I (ADB) pushed my backup back onto the SD card. (Yes, I know it's not really a SD card).
Now I can't take any pictures because the camera app throws a permission error. It's not crashing, it simply doesn't save the images.
But a logcat says more then I can:
Code:
E/CameraStorage( 4453): Failed to write image
E/CameraStorage( 4453): java.io.FileNotFoundException: /mnt/sdcard/DCIM/Camera/IMG_20120131_111328.jpg: open failed: EACCES (Permission denied)
E/CameraStorage( 4453): at libcore.io.IoBridge.open(IoBridge.java:406)
E/CameraStorage( 4453): at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
E/CameraStorage( 4453): at java.io.FileOutputStream.<init>(FileOutputStream.java:128)
E/CameraStorage( 4453): at java.io.FileOutputStream.<init>(FileOutputStream.java:117)
E/CameraStorage( 4453): at com.android.camera.Storage.addImage(Storage.java:58)
E/CameraStorage( 4453): at com.android.camera.Camera$ImageSaver.storeImage(Camera.java:995)
E/CameraStorage( 4453): at com.android.camera.Camera$ImageSaver.run(Camera.java:935)
E/CameraStorage( 4453): Caused by: libcore.io.ErrnoException: open failed: EACCES (Permission denied)
E/CameraStorage( 4453): at libcore.io.Posix.open(Native Method)
E/CameraStorage( 4453): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
E/CameraStorage( 4453): at libcore.io.IoBridge.open(IoBridge.java:390)
E/CameraStorage( 4453): ... 6 more
ls -al shows the following for /sdcard/DCIM and /sdcard/DCIM/Camera
Code:
drwxrwxr-x root sdcard_rw 2012-01-29 20:53 DCIM
drwxrwxr-x root sdcard_rw 2012-01-28 15:36 Camera
Can someone please tell me where the permission error is?
Thanks.
I had the same issue as you.
The underlying permissions might be messed up. See if the permissions in /data/media look correct. (Things shouldn't be owned by root/0)
This worked for me -- install busybox, then this:
Code:
./busybox chown 1023:1023 -R /data/media
dlzinc: you just fixed a huge issue for me. I was having issues removing files in /sdcard, and my media players couldn't view the album art in my music folder. It was driving me nuts. The command you posted fixed it.
I have no idea how the /data/media permissions got messed up
dlzinc: thanks to you, I've resolved my issue of not being able to write to the sdcard on my nexus phone after i upgraded yakju 4.0.4 to 4.1.1 and didn't managed to push busybox over. Installing the latest busybox and changing the owner of /data/media as you suggested worked for me.
For those who may be searching for similar solutions, the symptoms i faced were:
Camera not able to save any photos
SwiftKey not able to update language packs
Installed BusyBox, now how do I put in that piece of code?
bellerophon90 said:
Installed BusyBox, now how do I put in that piece of code?
Click to expand...
Click to collapse
Launch Terminal Emulator, and enter the command there, like so:
Code:
cd /system/bin/
./busybox chown 1023:1023 -R /data/media
dlzinc, thank you so much for this. Your code fixed my issue as well. I went the more round about way of using adb shell from PC when the phone was connected to it via USB to run the code, but the results are the same.
I did exactly that and it came up permission denied? How do I fix these permissions?
Sent from my Galaxy Nexus using xda app-developers app
bellerophon90 said:
I did exactly that and it came up permission denied? How do I fix these permissions?
Sent from my Galaxy Nexus using xda app-developers app
Click to expand...
Click to collapse
You have to make sure that you are SU in the terminal emulator before you run the command. At the first prompt just type "su" and give the app superuser permission. You should be able to run the command after that.
Thanks guys so much! its fixed now.
This didn't work at at all for me. I have a toro. Does that make a difference?
I think this is happening because I copied my old micro SD pictures to my Win 7 PC, and copied them on to the SGN. So there's an ownership problem on the /data/media/DCIM/Camera folder (bekit thinks) and now it's constantly force closing. I thought it was all the ROMs I was flashing...
Thanks heaps! Camera wouldn't save any images after update to 4.1.1....this fixed the problem...all working now!
sorry but...
lokety said:
Launch Terminal Emulator, and enter the command there, like so:
Code:
cd /system/bin/
./busybox chown 1023:1023 -R /data/media
Click to expand...
Click to collapse
can i get a lil noob help here Ok so it seems this is the fix i need as i just went to 4.1.1 and pushed my backup - now this issue. Thing is I cant get this busybox command to work (this is the first time using terminal emulator or busy box) so i have both apps installed - but when i go to terminal and input the code i get 'busybox not found'... Is there a way to do without busybox or..? according to the busybox app it has been installed (went through it all). Any help is much appreciated!
Is busybox installed in that location or somewhere else? On my phone it's in/system/xbin/, not bin.
Sent from my Galaxy Nexus using Tapatalk 2
skols said:
Is busybox installed in that location or somewhere else? On my phone it's in/system/xbin/, not bin.
Sent from my Galaxy Nexus using Tapatalk 2
Click to expand...
Click to collapse
according to busybox app it says installed to /system/xbin/ ....
---------- Post added at 08:22 AM ---------- Previous post was at 08:18 AM ----------
skols said:
dlzinc, thank you so much for this. Your code fixed my issue as well. I went the more round about way of using adb shell from PC when the phone was connected to it via USB to run the code, but the results are the same.
Click to expand...
Click to collapse
can this also be done using the gnex toolkit (i otice it has a command line option) ? can you tell me what to type in? :crying: thanks!
hmmmm82 said:
according to busybox app it says installed to /system/xbin/ ....
---------- Post added at 08:22 AM ---------- Previous post was at 08:18 AM ----------
can this also be done using the gnex toolkit (i otice it has a command line option) ? can you tell me what to type in? :crying: thanks!
Click to expand...
Click to collapse
I actually used the adb command from the cmd window after navigating to where my adb.exe was located ("Program Files(x86)\Android\android-sdk\platform-tools" for me). I don't remember everything I did though. Before that doing that though, try the terminal emulator first. After you open it, make sure you are SU. If the prompt is a #, then you are. If not, type su and hit enter. You'll have to give the app superuser permissions. After that's done run the following:
cd /system/xbin/
./busybox chown 1023:1023 -R /data/media
That should do it if busybox is installed in /system/xbin/ . If not you could try the gnex toolkit command line option when your phone is plugged into the USB. I don't have that installed on the computer I'm on now, so I can't say for sure. You'll have to navigate to the same place on your phone and run that same busybox command again, but you'll be doing from that command line instead.
I hope this helps!
skols said:
I actually used the adb command from the cmd window after navigating to where my adb.exe was located ("Program Files(x86)\Android\android-sdk\platform-tools" for me). I don't remember everything I did though. Before that doing that though, try the terminal emulator first. After you open it, make sure you are SU. If the prompt is a #, then you are. If not, type su and hit enter. You'll have to give the app superuser permissions. After that's done run the following:
cd /system/xbin/
./busybox chown 1023:1023 -R /data/media
That should do it if busybox is installed in /system/xbin/ . If not you could try the gnex toolkit command line option when your phone is plugged into the USB. I don't have that installed on the computer I'm on now, so I can't say for sure. You'll have to navigate to the same place on your phone and run that same busybox command again, but you'll be doing from that command line instead.
I hope this helps!
Click to expand...
Click to collapse
That did it! thanks so much not sure what the issue was but its all good now!
You're welcome! I'm glad it worked for you.
Sent from my Galaxy Nexus using Tapatalk 2
dlzinc said:
I had the same issue as you.
The underlying permissions might be messed up. See if the permissions in /data/media look correct. (Things shouldn't be owned by root/0)
This worked for me -- install busybox, then this:
Code:
./busybox chown 1023:1023 -R /data/media
Click to expand...
Click to collapse
Thanks guys, this solved my problem with the camera and several other applications, who shows "write errors".
/Hermann
This worked perfectly!! Thanks guy!
After rooting my Galaxy Nexus with Wug's Root Toolkit and sim unlocking with the Docomo hack, and then restoring my apps/data (can't recall if I restored from GN Toolkit or Root Toolkit), my camera app was messed up--could snap pix but they didn't save; and video always fc'ed. The solution turns out to be to rename or delete the DCIM folder. I couldn't delete--so I renamed. Now I am trying to delete that DCIM.old folder and contents (eating up 1+G on my storage), but cannot delete either individual files or the folder. I'm sure there is a simple solution, but I can't find it. Help (even with a condescending attitude ) much appreciated!
zzcat
If you use a file explorer, that has it's standard directory at / then all you need to do is navigate to /mnt/sdcard/ then make sure it's mounted as R/W and not R/O, if all that is the way I said it, you shouldn't have problems deleting anything, if so, use the ADB and type:
Code:
adb shell rm /mnt/sdcard/<Folder>
That should then do the trick
You could also try the following Apps:
- Rootexplorer (paid)
- Astro File Manager
familyguy59 said:
If you use a file explorer, that has it's standard directory at / then all you need to do is navigate to /mnt/sdcard/ then make sure it's mounted as R/W and not R/O, if all that is the way I said it, you shouldn't have problems deleting anything, if so, use the ADB and type:
Code:
adb shell rm /mnt/sdcard/<Folder>
That should then do the trick
Click to expand...
Click to collapse
FamilyGuy, thanks for the suggestion, the problem seems to be bad permissions and I can't figure out how to fix them. Tried the "fix permissions" from recovery, as well as when booted, to no avail.
Typing
adb shell rm -rf /[directory]
gives me "permission denied"
So tried
chmod 666 /sdcard/.../*
but get an "operation not permitted" message.
So I'm really stuck here...
familyguy59 said:
If you use a file explorer, that has it's standard directory at / then all you need to do is navigate to /mnt/sdcard/ then make sure it's mounted as R/W and not R/O, if all that is the way I said it, you shouldn't have problems deleting anything, if so, use the ADB and type:
Code:
adb shell rm /mnt/sdcard/<Folder>
That should then do the trick
Click to expand...
Click to collapse
Update: solved
boot into recovery mode
mount /data
adb shell
rm, rmdir etc. all work as expected from here, no need to chown or chmod anything
zz
I see you've solved this, but i thought i would throw this in anyway...
The easy way is to delete the files from /data/media
The sdcard directory is a symlink, so go to the true folder and you should have more success...
Sometimes the file ownerships get messed up after a cycle of recovering the OS and restoring files.
http://forum.xda-developers.com/showthread.php?t=1515291&page=2
If you have any other directories/files that you can't modify or delete, then boot into CWM recovery, plug in the USB cable, go into adb shell. Also make sure that /data is mounted in the CWM mounts menu. Then:
cd /data/media
chown -R media_rw.media_rw *
This fixed it for me and others.
cmstlist said:
Sometimes the file ownerships get messed up after a cycle of recovering the OS and restoring files.
http://forum.xda-developers.com/showthread.php?t=1515291&page=2
If you have any other directories/files that you can't modify or delete, then boot into CWM recovery, plug in the USB cable, go into adb shell. Also make sure that /data is mounted in the CWM mounts menu. Then:
cd /data/media
chown -R media_rw.media_rw *
This fixed it for me and others.
Click to expand...
Click to collapse
Thanks for this and other suggestions--my solution was trial and error, thrashing around in the dark (my unix command line chops are really, really rusty), and these are far more elegant. It's good to understand the underlying problem, your wisdom is appreciated.
Yes, permissions were messed up after rooting and applying a sim unlock hack, wiping and restoring from pre-unlock backup set. I see it so clearly now...
Problem can somebody help me?
Hello. I have a problem with my motorola defy+ running on gb 2.3.6 and is not ROOTED. Still he has an annoyng problem. After installing an aplication (not from the market) i saw that it didn't save data on the sd card. I uninstalled it and after a data factory reset i install apps such as temple run and Brother in Arms 2. At temple run it gave me this mesage
"File Access Problem Caution, unable to write files. This means your game progress can't be saved! Reason: Access to the path "/mnt/sdcard/Android/data/com.imangi.templerun/files/spaceholder.dat" is denied."
Also at Brother in Arms 2 the game didn't save. I rest the phone abouat 7-8 times.I changed the sd card. Note that the card was a 16 gb kingmax class 6 and put the 2 gb card that came with the phone. It all work smoothly. So what is the problem the sd card or the phone's software. Please answer i'm desparate and tired of wasting time.
This thread is about the Samsung Galaxy Nexus which has no external SD and uses a very different storage structure. I'm afraid we can't really help you here. Try the Defy forum.
Sent from my Galaxy Nexus using Tapatalk 2
zzcat said:
FamilyGuy, thanks for the suggestion, the problem seems to be bad permissions and I can't figure out how to fix them. Tried the "fix permissions" from recovery, as well as when booted, to no avail.
Typing
adb shell rm -rf /[directory]
gives me "permission denied"
So tried
chmod 666 /sdcard/.../*
but get an "operation not permitted" message.
So I'm really stuck here...
Click to expand...
Click to collapse
Before chmod the folder, you needed to be root by entering 'su' after 'adb shell' .
It worked from cwm, because cwm gives root access.
Linux/Android are all about permissions.
Sent from my i9250
cmstlist said:
Sometimes the file ownerships get messed up after a cycle of recovering the OS and restoring files.
http://forum.xda-developers.com/showthread.php?t=1515291&page=2
If you have any other directories/files that you can't modify or delete, then boot into CWM recovery, plug in the USB cable, go into adb shell. Also make sure that /data is mounted in the CWM mounts menu. Then:
cd /data/media
chown -R media_rw.media_rw *
This fixed it for me and others.
Click to expand...
Click to collapse
I tried your theory, and it didn't work, still get the message" unable to change ownership permission denied, in recovery mode.
we are still trying to find a solution, here is the discussion: http://www.slatedroid.com/topic/32434-i-got-my-smartq-t20/page__st__260 on Post # 277
rocketero said:
I tried your theory, and it didn't work, still get the message" unable to change ownership permission denied, in recovery mode.
we are still trying to find a solution, here is the discussion: http://www.slatedroid.com/topic/32434-i-got-my-smartq-t20/page__st__260 on Post # 277
Click to expand...
Click to collapse
Sorry to hear that. It sounds like the problem you are having is with a completely different device, so I can't really say why this may be occurring - I don't know how your device's file system is structured. This advice is specifically for the Galaxy Nexus. If a version of CWM exists for your smartQme device, I can't speak to whether it works properly and interprets commands the same way ours does.
cmstlist said:
Sorry to hear that. It sounds like the problem you are having is with a completely different device, so I can't really say why this may be occurring - I don't know how your device's file system is structured. This advice is specifically for the Galaxy Nexus. If a version of CWM exists for your smartQme device, I can't speak to whether it works properly and interprets commands the same way ours does.
Click to expand...
Click to collapse
it's a 9.8 inches tablet branded named called "LePanII'. it has ICS now, before we had Honeycomb 3.2.1.
The manufacture of this tablet did such a bad partitioning that the /system partition was left only with merely 4MB of free space in it.
rocketero said:
it's a 9.8 inches tablet branded named called "LePanII'. it has ICS now, before we had Honeycomb 3.2.1.
The manufacture of this tablet did such a bad partitioning that the /system partition was left only with merely 4MB of free space in it.
Click to expand...
Click to collapse
Good luck with your issue. I doubt it's related to the one we were having on the GNex though.
cmstlist said:
Sometimes the file ownerships get messed up after a cycle of recovering the OS and restoring files.
http://forum.xda-developers.com/showthread.php?t=1515291&page=2
If you have any other directories/files that you can't modify or delete, then boot into CWM recovery, plug in the USB cable, go into adb shell. Also make sure that /data is mounted in the CWM mounts menu. Then:
cd /data/media
chown -R media_rw.media_rw *
This fixed it for me and others.
Click to expand...
Click to collapse
Sorry if my question is dumb.
Does this command solve the problem for all the folders and sub-folders in sdcard? Thank you for your help!
Sent from my Galaxy Nexus
/data/media # chown -R media_rw.media_rw*
BusyBox v1.20.2-jb static (2012-10-25 21:29 +0100) multi-call binary.
Usage: chown [-RhLHP]... OWNER[<.|:>[GROUP]] FILE...
Change the owner and/or group of each FILE to OWNER and/or GROUP
-R Recurse
-h Affect symlinks instead of symlink targets
-L Traverse all symlinks to directories
-H Traverse symlinks on command line only
-P Don't traverse symlinks (default)
I got this after giving the commands from recovery in adb shell.
What does that mean?
Jar3112 said:
/data/media # chown -R media_rw.media_rw*
BusyBox v1.20.2-jb static (2012-10-25 21:29 +0100) multi-call binary.
Usage: chown [-RhLHP]... OWNER[<.|:>[GROUP]] FILE...
Change the owner and/or group of each FILE to OWNER and/or GROUP
-RRecurse
-hAffect symlinks instead of symlink targets
-LTraverse all symlinks to directories
-HTraverse symlinks on command line only
-PDon't traverse symlinks (default)
I got this after giving the commands from recovery in adb shell.
What does that mean?
Click to expand...
Click to collapse
OK solved, I forgot the space before the *!
Worked like a charm!!
Sent from my Galaxy Nexus
"rm -rf" command cannot run on the device
I've got an new device LG Optimus LTE II (LGE F160L) and install "Better Terminal Emulator Pro"
The Android version is 4.0.3
The kernel is 3.0.8-00001-g65e7cd3
1. I properly rooted the device
2. I used "su" command before runnig follow the commands.
3. When I try to run "rm -rf /sdcard/.ads" command, it showed "No such file or directory"
I've found the command "-rf" has been trade as a diretory but parameters.
How does it happened?
How can I resolve this?
I think it's because the folder /sdcard/.ads doesn't actually exist because /sdcard is a symbolic link to /mnt/sdcard. So to answer your question, I think the following might work:
Code:
rm -rf /mnt/sdcard/.ads
If that doesn't work, I dunno...
THK Malnilion,
I have also tried "rm -rf /mnt/sdcard/.ads", but didn't work with a respond of "rm failed for -rf, No such file or directory."
the "rm" command thought "-rf" is a file or a directory., and the "-rf" should be parameters.
Ah, I see, this might be a limitation of busybox, then.
Malnilion said:
I think it's because the folder /sdcard/.ads doesn't actually exist because /sdcard is a symbolic link to /mnt/sdcard. So to answer your question, I think the following might work:
Code:
rm -rf /mnt/sdcard/.ads
If that doesn't work, I dunno...
Click to expand...
Click to collapse
Malnilion said:
Ah, I see, this might be a limitation of busybox, then.
Click to expand...
Click to collapse
Oh, really?
I need to run a lot of testing scripts in "Gscripts". I see, why those scripts don't work on this device.
Then, how can I update the busybox? Those testing is my work!! Otherwise, I need to change back to HTC Desire which scripts are working well.:crying::crying: OH, Nooooo........:crying::crying::crying:
aswasw said:
Oh, really?
I need to run a lot of testing scripts in "Gscripts". I see, why those scripts don't work on this device.
Then, how can I update the busybox? Those testing is my work!! Otherwise, I need to change back to HTC Desire which scripts are working well.:crying::crying: OH, Nooooo........:crying::crying::crying:
Click to expand...
Click to collapse
Are you using the same terminal emulator application and version on the Desire?
drumist said:
Are you using the same terminal emulator application and version on the Desire?
Click to expand...
Click to collapse
Yes, of course. But the andorid version is 2.3.7.
I use "rm -r /mnt/sdcard/.ads" without parameter "f" as a mistake, and the script runs without a respond of error. ^_^
I used R.E browse to /mnt/sdcard , I found directory "/mnt/sdcard/.ads" has been removed !!!!!!!
I try to remove other directory with the "rm -r" command which seems non-forced remove command, but in fact, the command remove the folder, and everything in the folder, too.
OMG...Is there something has been modified in the kernel??
I have managed to get CIFS working on stock Nexus 10.
It's quite a bit more problematic on the Nexus 10 than normal.
There are 2 main issues to deal with. Newer versions of the Linux kernel require a UNC variable to be passed to them and the current version of busybox doesn't do this. There is a patch out. I have extracted the patched busybox binary from craigacomez's AOSP Nexus 10 rom.
(Check it out here: http://forum.xda-developers.com/showthread.php?t=1998585 ). Otherwise it should work on the stock mount command if you specify the unc= mount option with the share.
The other issue is the multiuser stuff. If you execute the mount command from inside Terminal Emulator (or a script program) it looks like it mounts ok and you can 'ls' in the directory but it doesn't work for Android apps, they just see an empty directory but if you do it via a 'adb shell' it works fine in Android apps. My theory is ADB is outside of the multiuser stuff. adb actually ships on the device.
1) Unlock bootloader (fastboot oem unlock)
2) Flash recovery adb flash recovery whatever.img
3) Root device (flash CWM-SuperSU-0.98.zip)
4) Install BusyBox (from the market)
5) Copy md4.ko and cifs.ko to device. The files can go anywhere you like. In this example I will just use the root of the sdcard. Some people like them in /system/modules or /system/lib/modules
6) busybox mount -o rw,remount /
7) adb shell
8) Override /system/bin/busybox with the patched version (maybe move it first so it's backed up).
9) insmod /sdcard/md4.ko
10) insmod /sdcard/cifs.ko
11) busybox mount -t cifs -o username=MYUSER,password=MYPASS,unc=\\\\192.168.1.1\\storage //192.168.1.1/storage /data/media/0/cifs/Storage
You will need to manually preform the last 3 commands each time you reboot the device from a adb shell.
NOTE: You can probably get rid of the -o flags completely. In theory the patched version of busybox makes the UNC bit redundant. Possibly you can use the stock busybox with the UNC flag and avoid using the patched one totally. I have just included it to be sure.
Make sure you type 'busybox mount' not 'mount', by default they are different binaries. Otherwise you can remove the /system/bin/mount command and make a new one linking /system/bin/mount to /system/bin/busybox.
Possibly there is some way to get the mount working in the multiuser environment without requiring busybox. If you figure it out please tell ☺
Some threads on the issue:
http://forum.xda-developers.com/showthread.php?p=34397868#post34397868
http://forum.xda-developers.com/showthread.php?t=733490&page=6
http://www.mail-archive.com/[email protected]/msg17650.html
The modules are for 3.4.5-g4e6298b.
EDIT: I added nls_utf8.ko by request
EDIT2: Since adb comes on the device, it is possible to use it to connect to local host:
1) Install cifs modules to /system/lib/modules
2) Install Script Manager from the play store
3) Copy script to device
4) Start SManager
5) Find your script and open it.
6) Tick the su box
7) Hit save
8) Goto home sccreen
9) Add a 'SMShortcuts' widget to your home screen
10) "Add one script shortcut"
11) Choose your script
12) Optionally use this pretty icon ☺
13) Give it a nice name like "Mount Shares"
Here is a shell script...
Code:
#!/system/bin/sh
# Your settings here
USERNAME="USERNAME"
PASSWORD="PASSWORD"
IPADDRESS="192.168.1.1"
SHARE="storage"
MOUNT_POINT="/data/media/0/cifs/Storage"
# If you need to change the mount command edit this
MOUNT_CMD="\
mount -t cifs \
\
-o \
user=$USERNAME,\
password=$PASSWORD,\
unc=\\\\\\\\\\\\\\\\$IPADDRESS\\\\\\\\$SHARE \
\
//$IPADDRESS/$SHARE \
$MOUNT_POINT"
COMMANDS="\
insmod /system/lib/modules/md4.ko; \
insmod /system/lib/modules/nls_utf8.ko; \
insmod /system/lib/modules/cifs.ko; \
$MOUNT_CMD
"
# Starting ADB...
PORT=`getprop service.adb.tcp.port`
setprop service.adb.tcp.port 5555
adb kill-server
adb start-server
stop adbd
start adbd
adb connect localhost
# Make sure we only use the first device (sometimes there is more than one)
SERIAL=`adb devices | head -n2 | tail -n1 | cut -f1`
if [ "$SERIAL" = "" ] ; then
echo "ERROR: Could not find ADB device.";
fi
echo Mounting share via adb...
adb -s $SERIAL shell su root -c "$COMMANDS"
# If you started adb, then stop it here for security:
adb disconnect localhost
stop adbd
setprop service.adb.tcp.port $PORT
start adbd
RESULT=`mount | grep $MOUNT_POINT`
if [ "$RESULT" = "" ] ; then
echo "Mounting failed..."
else
echo "Mounting sucess!"
fi
echo Done... You may close this script window.
EDIT3: Added usbserial.ko, option.ko and usb_wwan.ko
EDIT4: Some users have reported that the need to modify the script to get it working with their version of SU.
EDIT5: I have uploaded modules for 4.2.2, kernel 3.4.5-gaf9c307 but I haven't actually tested them myself (still on 4.2.1). Apparently the adb loophole has also been patched but it is possible to reenable it by putting a RSA key onto the device. Check out this set of instructions here.
EDIT6: I have updated to 4.2.2 on my Nexus 10 and can confirm the new modules work.
You must setup the adbkey or you will get a "device: offline" message. By default adb when adb first runs it tries to create the keys in the $HOME dir which is /data/.android, but the data directory isn't accessible by the 'shell' user.
I got it working simply by setting the HOME variable to /sdcard and restarting the adb server in the script then Android popped up a query (I have update the script above).
IMPORTANT: The Android Media scanner recursively scans folders for media to add the the database so it shows up in programs like Google Music. On large shares this can be a long process and use heaps of battery life. To prevent this add a blank file with the name ".nomedia" to the root of your mount points (or each individual share if you aren't used 1 folder for all your mounts). This will stop music showing up in programs though.
If you find that the device stops responding (the launcher might work but apps fail to load) or you get reboots (often after the previous bug) this is probably due to a bad wifi connection.
Is it posible to make a CWM flash file?
Great
This is great progress, do you know if there is some way I can use the same to mount my usb OTG with ADB shell so that I can read/write to my pen drives from my android apps/file managers?
I have tried using the busybox mount but that didn't work, do I need the modified mount or will none of this help anyway?
alias_neo said:
This is great progress, do you know if there is some way I can use the same to mount my usb OTG with ADB shell so that I can read/write to my pen drives from my android apps/file managers?
I have tried using the busybox mount but that didn't work, do I need the modified mount or will none of this help anyway?
Click to expand...
Click to collapse
Code:
busybox mount -t FSTYPE /dev/block/sda1 MOUNT_LOCATION
Example:
Code:
busybox mount -t vfat /dev/block/sda1 /storage/sdcard0/usbotg
craigacgomez said:
Code:
busybox mount -t FSTYPE /dev/block/sda1 MOUNT_LOCATION
Example:
Code:
busybox mount -t vfat /dev/block/sda1 /storage/sdcard0/usbotg
Click to expand...
Click to collapse
How is this different to what I'm doing already? Mounting this way doesn't work, only the process that mounted it can see the files.
Although I don't have nexus 10, I am having the similar mounting issue on my nexus 7 until I saw this post.
Advise about "adb shell" really helps me resolve the multiuser issue.
Thanks for sharing.
Any chance you could post the nls-utf8.ko for utf8 support?
Thanks!
H3g3m0n said:
1) Unlock bootloader (adb oem unlock)
Click to expand...
Click to collapse
Isn't it fastboot that unlocks the bootloader, and not adb? (unless adb can do it too; I've only heard of fastboot though)
momulah said:
Is it posible to make a CWM flash file?
Click to expand...
Click to collapse
Not a high priority right now as currently you need to do the manual adb shell stuff by hand to get things mounted, a little extra setup work isn't a huge difference.
alias_neo said:
How is this different to what I'm doing already? Mounting this way doesn't work, only the process that mounted it can see the files.
Click to expand...
Click to collapse
Are you mounting in a 'adb shell' or locally in something like terminal emulator? My OTG cable won't be here for a while so I can't really test myself.
weasal said:
Any chance you could post the nls-utf8.ko for utf8 support?
Thanks!
Click to expand...
Click to collapse
Posted, haven't tested it but it seemed to insmod fine.
espionage724 said:
Isn't it fastboot that unlocks the bootloader, and not adb? (unless adb can do it too; I've only heard of fastboot though)
Click to expand...
Click to collapse
Yeh typoed, i'll fix that now.
Currently I'm thinking of ways to hack around the 'adb shell' requirement, as a basic hackish fix would be to make a program that turns on adb wireless, connects to the local device and issues a command. Of course possibly there is a 'proper' way to do mounting. Another lazy way for those with their shares on a Linux system would be a script issue commands to the server via a ssh, getting it to log back into the phone and mount stuff over adb wireless.
alias_neo said:
How is this different to what I'm doing already? Mounting this way doesn't work, only the process that mounted it can see the files.
Click to expand...
Click to collapse
I've been working on getting OTG support natively in my AOSP based custom ROM and I have had some success... check out my ROM for details
H3g3m0n said:
Currently I'm thinking of ways to hack around the 'adb shell' requirement, as a basic hackish fix would be to make a program that turns on adb wireless, connects to the local device and issues a command. Of course possibly there is a 'proper' way to do mounting. Another lazy way for those with their shares on a Linux system would be a script issue commands to the server via a ssh, getting it to log back into the phone and mount stuff over adb wireless.
Click to expand...
Click to collapse
Just wanted to thank H3g3m0n as I was able to successfully mount over adb. Also came up with a workaround to bypass connecting to a PC, grabbed the arm fastboot binary from this thread and installed it on my nexus 7. Used it to connect wireless adb on the 10 and ran the mount commands on the 7.
H3g3m0n said:
Posted, haven't tested it but it seemed to insmod fine.
Click to expand...
Click to collapse
Thanks, I'll give it a try!
You might find my posts #156 and #162 at http://forum.xda-developers.com/showthread.php?t=1781411&page=17 helpful.
Sorry for the noob ? ...
What are the KO's do?
What is the practical use of then.
Sorry I did a little research on then but I could not find an answer in layman terms
Thank you for allowing me to learn.
Sent from my toroplus using xda premium
spdwiz18 said:
Sorry for the noob ? ...
What are the KO's do?
What is the practical use of then.
Sorry I did a little research on then but I could not find an answer in layman terms
Thank you for allowing me to learn.
Sent from my toroplus using xda premium
Click to expand...
Click to collapse
http://en.wikipedia.org/wiki/Loadable_kernel_module
craigacgomez said:
http://en.wikipedia.org/wiki/Loadable_kernel_module
Click to expand...
Click to collapse
That helps allot.... Now i have an understanding of ko's in general. But what specificly do the modules this thread refers to do and the practical use of then. Thanks foot the help.
Sent from my toroplus using xda premium
spdwiz18 said:
That helps allot.... Now i have an understanding of ko's in general. But what specificly do the modules this thread refers to do and the practical use of then. Thanks foot the help.
Sent from my toroplus using xda premium
Click to expand...
Click to collapse
These modules are needed to enable support for CIFS (Windows share) mounts...
spdwiz18 said:
That helps allot.... Now i have an understanding of ko's in general. But what specificly do the modules this thread refers to do and the practical use of then. Thanks foot the help.
Sent from my toroplus using xda premium
Click to expand...
Click to collapse
Basically you can setup a shared folder from a remote computer. It allows you to have files on another system accessible as if it was part of the internal storage in the device.
Just found out that Android ships with the adb binary on the device itself (after crosscompiling it myself :/, oh well the experience was useful).
It should be possible to setup a script to start the adb server, connect to the localhost and execute the mount without too much difficulty.
Ok, added a script and instructions to the front page for simple on tablet mounting.