I have written the following shell script:
alias mount='/system/xbin/busybox mount'
set -e
set -x
MNT=sda1
function mkdir_ext() {
if [ ! -d $1 ]; then
mkdir -p $1
fi
chown $2 $1
chmod $3 $1
}
mkdir_ext /storage/emulated/$MNT root:media_rw 777
mount -t ext4 /dev/block/$MNT /storage/emulated/$MNT
mkdir_ext /data/media/$MNT root:media_rw 777
sdcard -u 1023 -g 1023 /storage/emulated/$MNT /data/media/$MNT
After executing the commands above, mount reports:
root#NEO-X8:/sdcard # mount|grep sda
/dev/block/sda1 /storage/emulated/sda1 ext4 rw,seclabel,relatime,data=ordered 0 0
/dev/fuse /data/media/sda1 fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
I am working via ssh, remotely, using rooted ssh/sftp daemon, and while logged in as root, I can list the files in /storage/emulated/sda1.
From what I understand, android is case-insensitive in regards to filesystems by design, so the filesystem has to be fused.
The problem is, I see just an empty directory in /data/media/sda1. Even stranger is that, if I navigate to /storage/emulated/sda1 from the device as root with bash shell X, I also see an empty directory.
I have tried different other apps and I've tried to also use sdcard_rw instead of media_rw (with the uid / gid 1015 instead of 1023), nothing works.
How to get ext4 to work for all apps on a rooted Minix NEO X8-H? Using anything but ext4 is not an option, the 4TB drive already contains important data. As a side note, sda1 is just a small 1GB partition.
I will assume that your device is rooted from what you have done so far so will not go into that. Though I cannot be certain this is your issue I shall explain how I solved a similar problem.
Resent versions of android with the intent on improving device security are now using the (somewhat half arsed) feature of making mounts performed by most processes not visible to other processes. Working around this is frustratingly device specific, however it appears the Minix NEO X8-H is using a "vanilla" style source build of android. Therefore you have a good chance of using StickMount in order to mount the USB stick, it should enable the global mounting of USB devices running any file-system supported by your ROM (which should include ext4 given you have already mounted it before).
I have not tested this personally on your device so cannot guarantee it will work but have had success with a number of other android devices so this is certainly worth a shot.
I use mkfs -t ext4 /dev/sdf2 format SDcard and insert into samsung s4 anrdoid phone.
adb shell
su
mount /dev/block/mmcblk1p2 /root
I cant't mount this SDcard, I have googled it but no solution.
The last, I found this can succeed :)))
mk2fs -t ext4 /dev/sdf2
and ...
I have get the root access on my phone.In adb shell,I type the commands as below:
#create a file about 10M
dd if=/dev/zero of=/mnt/sdcard/AAA.pdf bs=1024 count=10000
#format this file
mkfs.ext2 -F /mnt/sdcard/AAA.pdf
#create a folder which is used to be mounted
mkdir /mnt/sdcard/aaa
#mount
mount -t ext2 -o loop /mnt/sdcard/AAA.pdf /mnt/sdcard/aaa
chmod 777 /mnt/sdcard/aaa
#umount
umount /mnt/sdcard/aaa
It runs properly. But if I want to mount again, it failed. After I type mount -t ext2 -o loop /mnt/sdcard/AAA.pdf /mnt/sdcard/aaa,it says ioctl LOOP_SET_FD failed: Device or resource busy. I dont know how could this happen. Can anybody help?
If it is already mounted, you can't mount it again unless you pass it the 'remount' option. That option may or may not be available in Android's mount command since it is not standard mount.
1- Android toolbox has not good support of loop devices. Try to use busybox's one.
2- Check that you have a remaining free loop device using losetup.
For umount:
umount /mnt/sdcard/aaa
losetup -d /dev/loop0
Although on my device mounted loop fs is not accessible by none root user (dir permission 777). There is seclabel flag and I think it is a reason.
I recently did a factory reset of my android phone. Prior to the reset, I was able to install applications through adb install. The phone was not rooted.
After the factory reset, I mostly get "Operation not permitted" for nearly every command in adb shell (including ones that don't exist):
$ install
install: permission denied
$ push
push: permission denied
$ remount
remount: permission denied
$ su
su: permission denied
$ kmmsaldfmaldskfmlasdf
kmmsaldfmaldskfmlasdf: permission denied
$
Most of the PATH is unreadable to me (except for /system/bin and /system/xbin):
$ echo $PATH
/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
$ ls /sbin
opendir failed, Permission denied
$ ls /vendor/bin
/vendor/bin: No such file or directory
$ ls /system/sbin/
/system/sbin/: No such file or directory
If I run adb root:
$ adb root
adbd cannot run as root in production builds
From my search (which has already robbed me of way more time than necessary), some pointers are to default.prop:
$ cat default.prop
#
# ADDITIONAL_DEFAULT_PROPERTIES
#
ro.secure=1
ro.allow.mock.location=0
ro.debuggable=0
persist.service.adb.enable=1
$
But I have no write access to default.prop:
$ ls -l default.prop
-rw-r--r-- root root 118 1969-12-31 19:00 default.prop
$
I also seem unable to remount. I have been able to use adb successfully on the non-rooted device, why so much grief now? Has anyone come across this problem? My own phone is virtually unusable to me, and of course I am unable to do any development.
Trying to remount as rw:
$ mount
rootfs / rootfs ro,relatime 0 0
tmpfs /dev tmpfs rw,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
/dev/stl9 /system rfs ro,relatime,vfat,log_off,check=no,gid/uid/rwx,iocharset=cp437 0 0
/dev/stl10 /cache rfs rw,nosuid,nodev,relatime,vfat,llw,gid/uid/rwx,iocharset=cp437 0 0
/dev/stl6 /mnt/.lfs j4fs rw,relatime 0 0
/dev/stl11 /data rfs rw,nosuid,nodev,relatime,vfat,llw,check=no,gid/uid/rwx,iocharset=cp437 0 0
$ mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /
mount: Operation not permitted
My phone is a Samsung Galaxy Y, which could matter
You need to issue commands like install from the PC command line:
C:\> adb install ...
instead of from within the adb shell. If that doesn't work, you may need to run
adb remount
and/or reboot your phone and/or reinstall the phone driver. See this thread for more info.
I've found that the path in an adb shell session can have all sorts of non-existent directories on it. I don't know why that is, but it normally doesn't screw up anything.
Assuming that you didn't put a new version of Android on your phone, my guess is that your phone is no longer in developer mode.
Go to Settings. Scroll down until you see the System heading. Under it, you should see several options. If Developer is not one of them, click on About phone, then scroll down to Build number. Click on Build number 7 times. That should bring back Developer mode.
Try executing these commands from in recovery, most recent recoveries are debuggable=1
other then that decompile the kernel and change ro.debuggable=0 to 1 and that will allow you to remount with adb and allow adb to run as root!
I might have found a solution for you
Recently i updated my (rooted) LGP500 from Froyo (android 2.2.1) to Gingerbeard (android 2.3.3). After that i found myself in a situation, quite similar to yours (the same, to be honest). I lost my SU credentials, and desperately tried to find a solution to that problem. I was so desperate - i even tried famous Android 4.2 method of enabling developer settings, tapping my poor device like a madman for quite some time.
So... i've had exactly the same issue. While surfing the web i found out that the problem was actually in the Gingerbeard build, and stumbled upon some interesting solutions.
And, after all the effort - it took me quite some time to figure out which way is the best - i (finally) had my 2.3.3 device rooted.
Note that i only share these things in educational purposes only. No offence taken if you brick your device by accident.
Before proceeding check if:
You have properly installed ADB drivers (if not - will show an error
with the following text: "could not find online device, please enable
USB debugging!"; solution - install or reinstall ADB drivers. Mind
that you have to install drivers with your device connected, BUT "USB
debugging" disabled.
You have "USB debugging" and "Allow mock locations" checked.
It is highly advisable to have a backup to prevent any data loss.
(At least export your contacts to .vcf file)
If everything is OK:
Install UnlockRoot (you can find Unlock_Root_2.3.0.exe here) and execute it.
Run "root" (You can actually ignore everything but the "root" button). Choose your device in the pop-up menu.
Reboot your device (to finish the installation of the SU binary - you will be prompted in the app if you wish to reboot, but are free to do it yourself through adb shell )
And voila! your device is rooted, just like that.
You should install the SuperSU app from Google Play. That is the only super-user app which enabled root functionality correctly on my device (Galaxy S4).
After that do adb shell and su. If you want to pull a file from /data directory, you will need to change permissions of that file (using chmod). Then it should work!
I had this problem endlessly on my galaxy S3
When i built my android kitchen i found a way around this
Root the device if you need elavated permissions
Unpack build the kernel for your device
in the default.prop change these values to the corresponding
ro.secure=0
ro.debuggable=1
Compile/repack and flash
Enable USB debugging
Your user capabilities are being stripped somewhere. Look at the /proc/<shell process>/status to see the capability mask.
You could try SUInstaller.
http://theroot.ninja/apks/SUInstaller.apk
Basically sets up su on your phone. This MAY work,from memory i used one click androroot to root samsung y.
If this fails,try booting into recovery and flashing supersu, can try samsung galaxy method,or base yours on it,
http://www.android.gs/root-samsung-galaxy-s3-with-cwm-recovery-and-supersu/
Goodluck.
I'm looking for a way to mount Samaba shares programatically.
I am aware of this question which, if it works, would allow browsing a Samba share within my app, but I want the shares to be available to other apps once mounted.
I know ES File Explorer can do this, so it must be possible to implement in code, but I'm trying to figure out how it's done. The only method I can think of is opening a Process with Runtime.getRuntime().exec(...) but then there's the issue of what commands to send. I've been playing about in a terminal emulator app and the standard mount command doesn't seem to be working. I've tried the following:
mount -t smbfs //[ipaddress] /mnt/sdcard/net/Share1
and
mount -t cifs //[ipaddress] /mnt/sdcard/net/Share1
but in both cases I'm getting the rather uninformative error message "mount: no such device"
Where could I be going wrong?
Probably smbfs/cifs are currently not supported by your kernel. As Delyan said, ensure your kernel can mount these filesystem :
$ cat /proc/filesystems
nodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev cgroup
nodev tmpfs
nodev debugfs
nodev sockfs
nodev usbfs
....
If they are not listed, you should try to do a modprobing (sometimes the module you want just have to be activated), get root access then :
# modprobe <modulename(without.ko)>
e.g. :
# modprobe cifs
If it doesn't work you will have to change or recompile your kernel (including appropriate modules).
I ran into the exact same problem. Cifs manager was working, but the command from the terminal was not. For me anyway, it turned out that I just had to modify the command slightly and it worked. Try the following command:
mount -o username=guest,password=guest -t cifs //[ipaddress]/[share] /sdcard/cifs/nas
Make sure that the local folder /sdcard/cifs/nas (or your desired equivalent) exists before running the command or you might get a "file or directory doesn't exist" error.
I haven't been able to find anything on this. Apologies if this duplicates anything in existence.
I'm currently have a virtual version of Ubuntu 10.10 accessing a shared folder in my main OS (Arch Linux) to build Android. I can successfully build it and run the emulator from my virtual machine. (The make file updates my shell appropriately, correct?) When I go to my actual OS and try to run the same emulator, I get an error that states:
$ ./out/host/linux-x86/bin/emulator
emulator: ERROR: You did not specify a virtual device name, and the system directory could not be found
I have tried setting ANDROID_PRODUCT_OUT to the same value on my actual computer, but I still get the same error. Is this just a simple error, or should I just stick to running the emulator on my virtual machine?
This isn't a complete answer, but I was able to do what I wanted to by creating an Ubuntu partition on my computer and chrooting into it and forwarding the X display.
References for doing this:
http://source.android.com/source/initializing.html
https://wiki.archlinux.org/index.php/Change_Root
After setting up my Ubuntu environment, I made the following script to chroot into it (this is nearly taken directly from the 2nd source):
xhost +
cd /mnt/ubuntu
mount /dev/sda2 /mnt/ubuntu
mount -t proc proc proc/
mount -t sysfs sys sys/
mount -o bind /dev dev/
mount -t devpts pts dev/pts/
mount -o bind /mnt/data mnt/data/
mount -o bind /home home/
chroot /mnt/ubuntu /bin/sh -c "export DISPLAY=:0.0; /bin/bash -i"
umount {proc,sys,dev/pts,dev}
umount {mnt/data,home}
cd .. && umount ubuntu
Then go to your android root directory ($android), set up the environment and build it. Starting the emulator should then start it in the current X session.
cd $android
. build/envsetup.sh
lunch full-eng
make -j16
emulator