permission denied writing to LUN/file error as root? - Xiaomi Mi 5s Plus Questions & Answers

Hope I am putting this in the correct section, but I am looking for some technical help.
I am running the latest global stable rom (8.2.2.0), have the bootloader unlocked and it is rooted.
What I am trying to do is write to the file:
/sys/class/android_usb/android0/f_mass_storage/lun/file
but when I try to echo into the file, I get error 1. Running that through toybox or busybox gives a better error of permission denied. I changed the permissions to 777 on the file (to open it up completely) and same thing. I tried changing the owner of the file to root:root and that was successful, but still couldn't write to that file.
My goal is to re-enable mass storage via a shell script, but writing to that file is part of the process. Any thoughts as I am currently stumped. My best guess is that I need to modify the file /init.usb.rc but that requires making a custom kernel and ROM which is currently beyond my abilities.

So, quick update on this... was reading online that I'd need to remove the immutable flag on the file but it seems that file doesn't support chattr or lsattr.
The whole folder path doesn't support lsattr or chattr. Tried from recovery and same thing.
Still thinking about this but I am getting more and more stumped. Any developers or linux experts have any thoughts?
lsattr and chattr both throw the error "not a typewriter". Was thinking that maybe my busybox is out of date... going to try updating it and see if that helps.

Update 2 - updating busybox changed the "not a typewriter" error to an invalid ioctl error.
So, from what I can tell, this basically means that lsattr and chattr don't work on the sysfs file system type. And since the file doesn't allow you to add anything to it, mass storage on this phone (with the global stable ROM) is not possible.

Related

Stock 2.1 rom rooted ROM Manager won't FIX Permissions

I searched and got on IRC and can't get a fix for this. WHen i try to use the Fix permissions option in ROM Manager Premium i get the following error.
"error occurred while attempting to run privelaged commands"
I checked superuser and ROM Manager is in there so i selected "forget" then rebooted and tried "fix permissions" again. I got the promp to allow SU and then the error.
Any idea how i can fix this? Is this a bug or a isolated problem?
Not sure if it is related or not but I had to same problem until I bought the full version off of the market.
Maybe it's part of the extended functionality?
As I noted I have "Rom Manager Premium" I don't think it's related anyway.
Just found the answer to this (as I too was having this problem). See the link below:
http://androidforums.com/899973-post26.html
It has to do with busybox not installed in the correct place.
One more thing: Make sure that busbox is set to "755" so that it can execute.
Thanks
sw99 said:
Just found the answer to this (as I too was having this problem). See the link below:
http://androidforums.com/899973-post26.html
It has to do with busybox not installed in the correct place.
One more thing: Make sure that busbox is set to "755" so that it can execute.
Click to expand...
Click to collapse
Thanks for the link to the fix!
I am unable to get the busybox file to copy from the /data.... directory into the /system/bin/ directory. Any ideas?
jtoole1 said:
I am unable to get the busybox file to copy from the /data.... directory into the /system/bin/ directory. Any ideas?
Click to expand...
Click to collapse
did you mount the system partition prior to trying this?
I'm also having an issue moving the file using root explorer. Any other ideas?
the_grobe said:
I'm also having an issue moving the file using root explorer. Any other ideas?
Click to expand...
Click to collapse
Yeah, same here. My problem is that I've never used Root Explorer before. At the top it says mounted as r/w (in the /system/bin directory) , but it won't copy the file using the Root Explorer program. When I click [Paste] it doesn't give me an error, but when I go and check the directory, the file is not there. I even tried refresh. Any ideas?
UPDATE: I have not solved the problem yet, but I did notice that the /system/bin directory that I am trying to copy to says "0K bytes available," which is probably why it won't copy. So I guess my (no copy) problem is due to my lack of understanding of the file structure of the DI.
UPDATE: I finally got it working. Here is what I did.
1. Boot phone into recovery
2. Push busybox from /sdk/tools folder to sdcard
Code:
adb push busybox /sdcard/busybox
adb shell
3. Installed busybox to /system/xbin
Code:
$ su
#export PATH=$PATH:/system/bin
#cd /system/xbin
# cat /sdcard/busybox > busybox
# chmod 06755 busybox
# busybox --install -s /system/xbin
# rm /sdcard/busybox
# exit
$ exit
4. Booted up phone, and ROM manager fixed permissions as per request.
Hope that helps.
Thanks. I appreciate your feedback. But it looks like I wasted my money again on a useless program like "Root Explorer." I was hoping that I wouldn't have to do all of that command line crap anymore after having rooted.
Does anyone know if there is a file manager out there that will push/pull files via cut/paste rather than using a seperate computer with a command line interface?
I don't think that there is going to be a program like that until we've got full NAND unlock.
the_grobe said:
I don't think that there is going to be a program like that until we've got full NAND unlock.
Click to expand...
Click to collapse
Is someone working on that? I believe the facts are, that the Unrevoked team knows how to do it...but they won't give us the means to do it. Probably because they think we'll shoot ourselves in the foot...and blame them...and they're probably right!
I can not do the cat command it tels me Cant create busybox, read only file system.
Any ideas????????????????
when i was modding widget locker i was using linda file manager free to cut and paste out of the system folder im gonna try it right now to fix this problem ill let u know if it works

[Q] Anyone have Linux/Ubuntu/Fedora Working Currently On GB?

Problem:
I've worked with every available distribution of Linux, trying to get the damn thing working on my phone. Troubleshooting the ***t out of it, and no deal. Constant errors/files not found etc. So, rather than post my logs and ask for help troubleshooting them (as I've obviously been unable to do), I thought I'd just ask:
Does anybody have a Linux build (besides android!) working on their phone that's running Gingerbread or ICS? If yes, can you post your software specs?
Here are mine currently:
Busybox- v1.19.3-Stericson in /system/xbin
Firmware Version- 2.3.5
Baseband Version- T959VUVKG6
Kernel- 2.6.35.7-T959VUVKI3-CL611444
Build Number- Gingerbread.VUVKI3
Mod Version- Octaine Team Acid
Thanks, this has been a pain in my **s for too long now!
S
I had both Fedora and Ubuntu working on Froyo at one point through lots of modifying and editing of the scripts.
What do you need them for anyway? I think it's more of a hassle to set them up than it's worth.
Well, I am working quite a bit now with linux for servers and such, and it's good to have a system (even minimal) that I can use/reference, plus it helps me get better at it.
Get this: I was so frustrated that I went back to BlackIce (keeping my gb bootloaders) and the damn thing loads right up, ubuntu 11.04, no problem. So, I then loaded up Valhalla's GB build and, sure enough, that works too. So, going with my luck I load octane 2.x GB which i've been digging of late and no deal, ubuntu just won't load.
Now, trying the same trick I cannot get it to work. It just won't load now when I SH it. Here's the instructions that worked before (and I've tried them all!):
http://www.nerd65536.com/2011/07/installing-ubuntu-in-android-version-2.html
Also, I hard bricked again (corrupted bootloaders from a Parallels Windows stallout) but did Adam's UnBrickable Mod and that's all better. Everybody needs to check it out, it's awesome:
http://forum.xda-developers.com/showthread.php?t=1333424
So FBI, any idea why linux is so temperamental? Once it SH's properly, it always works.
(Thanks to all the developers for their great roms!)
Yeah I noticed that slight changes from different ROMs based on the same kernel base had that effect too. I'm thinking it had to do something with the busybox installations since I had to edit the script sometimes. For some reason on some installs running mount won't work unless you use it as busybox mount. It was very iffy like that. I haven't even tried it again because of how frustrating it is to get even a boot. The other thing is that if you try to do a shutdown from ubutu/fedora it doesn't even kill the processes all the way so the only way you can clear some ram up with with a reboot.
Yeah man, I was figuring Busybox myself. I've tried old installs, new installs, xbin only, bin only, xbin & bin, etc. It's so frustrating because I can't figure it out. When it was working it was great, pretty stable.
So the first problem always lists as:
Remounting /system rw...
Mount: no such file or directory
Usage: mount [-r] [-w] etc, etc
So does this tell us that the system is not mounted rw? I used the Mount/system r/w application, but I cannot verify it's doing it's job. Everything is rooted properly, CWM also.
In Terminal on the phone I ran:
"mount | grep system"
which gave me
"/dev/block/st19 on /system type ext4 (rw,relatime,barrier=0,data=writeback)"
which leads me to believe the system is r/w.
I'm converting the system back from ext4 using CWM Voodoo to disable Lagfix and system Lagfix to see if this has any effect. Will report.
No deal. Didn't do a damn thing. I'm going to crack this if it's the last thing I do....
I'm using Better Terminal Pro, Bash shell, and under command line in options it lists the Shell as: /system/bin/sh-
The sh install.sh also tells me:
"Mounting: Loopback mount
mknod: /dev/block/loop254: File exists"
Does this mean that all (255) of my loops are used? Do I need to remove programs?
The available loop device thing never got resolved. Nameless originally fixed it by making it use 254 so that there was a low chance of the loop device being available, but the phone's OS is very iffy about letting a new loop device get assigned to a system image file. Can't really help you out since I never got it to consistently mount with different roms.
Linux on SGS4G Working! Done and Done!
Figured it out.
I can get Ubuntu 11.04, 11.10 & Debian 6 to mount repeatedly in all sorts of ui updatable configurations using this information:
http://www.nerd65536.com/2011/07/installing-ubuntu-in-android-version-2.html
It's a friggin Christmas Miracle! Can't tell you how much time I've wasted working this out, and it all boils down to the sh and run scripts.
So, without further ado, here goes.
!!Make sure you're rooted!!
!!The quotes just tell you what to type. Don't type them!!
1.
Download one of the three builds on the website listed above (or build your own, it should work fine). Extract it from tar.bz2, they should all extract to a linux file, this includes the necessary scripts. Put it on the sd-card on your phone.
2.
Download the new scripts that (Nerd) listed found here: http://ohm.nerd65536.com/android-linux/scripts-latest.tar.bz2
And extract them. You'll have another file that says linux. Open it, take the three files inside (install.sh, root-scripts & scripts) and paste them in the linux folder you moved to your sd-card. They will overwrite the ones currently there. These scripts work for sgs4g, the originals did not.
3.
Install the latest BusyBox in xbin if it's not already installed (must be rooted). Latest is 1.19.3
4.
Download a terminal client, like Better Terminal Emulator or Android Terminal Emulator. I use the first. The terminal needs to run the commands as root, especially the linux vnc command as it didn't want to work for me no matter if I started by typing su. Better Terminal Emulator has a check box to always start in root.
5.
Open up your terminal emulator and type su if you are not rooted there. Then change directory to the linux file on the sd-card. run the sh file there.
Like this:
"su"
"cd /sdcard/linux"
"sh install.sh"
If it works, the resulting dialog in terminal won't throw up any problems.
6.
Get back to / on sd by typing in terminal:
"cd /"
You should then have a: / # prompt, which means you are still rooted.
Enter:
"linux"
Which should result in a: [email protected]:/#
This means Linux is running. Congratulations. It should continue to run unless you shut down your phone.
7.
Download a VNC client, like Android VNC Viewer (free) or Remote VNC Pro, which I use. Add a new entry in it, with the following settings:
Host: localhost
Port: 5901
Password: cheesecake
Color: 24-bit
Name: Linux
When that's done save if you can or back out if you can't, and go back to your terminal emulator.
8.
It should still say: [email protected]:/#
If it doesn't, fine, if it does, just go back to root prompt by typing:
"exit"
Which should get you: / #. Then type:
"linux vnc"
Which should run itself and mount the chroot environment. It should tell you your new 'X' desktop is localhost:1, and have a: / # prompt again.
It might also ask you for a password, if so then put whatever password you'll remember in that's longer than 6 characters and verify it. This only happens once.
9.
Go back to your VNC client and if you entered a password in step 8. then edit your listing to your password instead of cheesecake, if not then don't.
Click on the Linux link and BAM! (shameless Emerilism), you're at your Linux desktop which should be running a iceWM desktop interface, which is fast. The LXDE desktop is nicer and if you want that then go into you're terminal and get into the linux shell by typing:
"linux"
And then switch to LXDE by typing:
"apt-get autoremove icewm- lxde+"
Which will run through the removal/ installation, and verify you want to download the <400mb files. Type:
"y"
And give it time to finish. When finished, just go back to your VNC client and hit Linux again, and you will have a nice looking functional desktop, with a cpu load graph on the bottom. I tried using Gnome desktop and Unity 2d, but both of these would install and not fully run with all options. They are heavier and slower, but cool non-the-less. Let me know if anyone has luck with these on Android.
Notes-
You only have to type "linux vnc" once in terminal to start linux every time you boot your phone. Otherwise, just open your VNC client and click on Linux to use it. Easy!
You will want to update and upgrade your linux after install, do so by typing in terminal:
"apt-get update"
"apt-get upgrade"
Also, you might run across a problem if you try to add-apt-repository, that's because that python command is not present. To use it, enable by typing:
"apt-get install python-software-properties"
Also of note, the downloadable linux builds are sized to about 2.15gig on your sd, which is big enough for most. There is a way to resize them which I tried but it gave me trouble in loading. I will try again and see if I can get it to work.
Here's the link from Dangermouse:
http://www.androidfanatic.com/community-forums.html?func=view&catid=9&id=1610
Thanks to Nerd65536 for the info, write-up and files. He fixed my problem.
sconsylman said:
Also of note, the downloadable linux builds are sized to about 2.15gig on your sd, which is big enough for most. There is a way to resize them which I tried but it gave me trouble in loading. I will try again and see if I can get it to work.
Here's the link from Dangermouse:
Click to expand...
Click to collapse
You're welcome.
It's actually a lot easier than that to make the image larger. Just pop the SD card into a Linux machine and:
(Assuming the original file is: /media/phone/linux/linux.img)
Code:
resize2fs /media/phone/linux/linux.img 4095M
And you're done. resize2fs is made of magic!
Note: Most SD cards are FAT32, which has a filesize limit of 4GiB. The above instructions will make the file a megabyte less than that.
nerd65536:
Thanks! Worked like a charm. Had to e2fsck -f /media/SDCARD/linux/linux.img (phone plugged in to Mint) before i did it to check over the file system, but then it ran immediately. Much appreciated.
Have you had any luck on native boot? I've been working a little on this, as I can't run BackTrack arm well virtually, it gets buggy. Granted the telephony systems won't work during, but the functionality should be pretty good if we could run it standard.
Also, while I'm thinking of it, is it possible to run the img from an ext4 partition on the card? I have an existing one being used for link2sd files and would much prefer using it as it's a far superior file system to fat32, without the 4G limits. Vnc should have no problem graphically, but would the linux.img chroot properly?
It would probably work but you would have to alter the script to mount the other partition if it doesn't do it automatically and change the path. Shouldn't be too hard.
I'm getting an error when I try running sh install.sh:
Code:
# sh install.sh
readlink: applet not found
Remounting /system rw ...
sh: Can't open /linux/scripts/fsrw
Installing scripts in /system/bin ...
cd: can't cd to /linux/scripts
cp: write error: No space left on device
cp: omitting directory 'root-scripts'
Unable to chmod /system/bin/root-scripts: No such file or directory
cp: omitting directory 'scripts'
Unable to chmod /system/bin/scripts: No such file or directory
cp: omitting directory 'tmp'
Unable to chmod /system/bin/tmp: No such file or directory
Mounting the Linux image ...
install.sh: /system/bin/linux: not found
Customizing the image ...
install.sh: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
install.sh: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
Installing root-scripts ...
mkdir failed for /data/local/mnt/root/scripts, No such file or directory
Unable to chmod /data/local/mnt/root/scripts: No such file or directory
cp: can't stat '/linux/root-scripts/*': No such file or directory
Unable to chmod /data/local/mnt/root/scripts/*: No such file or directory
Install finished
# linux
linux: not found
NuVanDibe said:
I'm getting an error when I try running sh install.sh:
Code:
# sh install.sh
readlink: applet not found
Remounting /system rw ...
sh: Can't open /linux/scripts/fsrw
Installing scripts in /system/bin ...
cd: can't cd to /linux/scripts
cp: write error: No space left on device
cp: omitting directory 'root-scripts'
Unable to chmod /system/bin/root-scripts: No such file or directory
cp: omitting directory 'scripts'
Unable to chmod /system/bin/scripts: No such file or directory
cp: omitting directory 'tmp'
Unable to chmod /system/bin/tmp: No such file or directory
Mounting the Linux image ...
install.sh: /system/bin/linux: not found
Customizing the image ...
install.sh: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
install.sh: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
Installing root-scripts ...
mkdir failed for /data/local/mnt/root/scripts, No such file or directory
Unable to chmod /data/local/mnt/root/scripts: No such file or directory
cp: can't stat '/linux/root-scripts/*': No such file or directory
Unable to chmod /data/local/mnt/root/scripts/*: No such file or directory
Install finished
# linux
linux: not found
Click to expand...
Click to collapse
cp: write-error.. no space left on device? You need more space dude

Can't Modify System on Android O DP3 with Root?

Hello,
I have root and busybox on my Pixel, but AdAway is failing to copy the hosts file, and I am unable to modify permissions of the system folder. I just keep getting the error "operation failed" using Solid File Explorer.
Anyone know why? I obviously have root access, why am I being denied?
SubjectGinger said:
Hello,
I have root and busybox on my Pixel, but AdAway is failing to copy the hosts file, and I am unable to modify permissions of the system folder. I just keep getting the error "operation failed" using Solid File Explorer.
Anyone know why? I obviously have root access, why am I being denied?
Click to expand...
Click to collapse
was it working on any other android O developer preview releases ?
my best guess is that android O is using toybox instead of toolbox for mount and it matters in what orders the parameters are passed to the mount command.
mount -o remount,rw /system was working in 7.1.2 , but it is not working on 8.0, it must be mount -o rw,remount /system
the app developers will have to change the command in their apps...
of course this is only a wild guess, because there can be a lot of other reasons, this just something that I stumbled upon and got help with here on XDA. (thanks again @jcmm11 !!!)
Make sure you have the newest version of Chainfires SuperSU for pixel that fixes the system mounting
Just go to preferences and tick " enable systemless mode"

how to copy over busybox config file? (completelinuxinstaller)

Hello everyone.
I have been wanting to get to grips with linux for a while now and decided linux decided to try completelinuxinstaller as i was having some problems with linux deploy.
i set up everything as the app asked. Downloaded .img files, extract, rename file and launch.. but in the android terminal i get a error which said:
chroot: can't execute '/root/init.sh': Permission denied
After days of searching and trying minor fixes i got no where until i found a list of instructions on how to fix this error.
(This error is becoming common on Samsung devices running android version 4.4.2, and can be expected to happen with some other devices, or newer versions of android. Although I haven't yet found the exact cause of the error, an effective workaround has been found:
The error seems to be coming from something in the busybox executable installed by the Complete Linux Installer app; many have reported that using other versions of busybox removed this problem, and the following version (free download on Google Play) has been confirmed to work: BusyBox
After using that app to install an updated busybox binary, simply copy the new binary over the existing busybox binary at /data/data/com.zpwebsites.linuxonandroid/files/busybox
Finally, in a rooted terminal window, type chmod 0755 /data/data/com.zpwebsites.linuxonandroid/files/busybox (see the more detailed instructions in the How do I install the most up-to-date version of bootscript.sh on my device? section of this FAQ)
Now you should be able to start linux using your Complete Linux Installer app on your device.)
But the problem is no matter what explorer i use i am not able to find the busybox config file. Where they said it would be doesnt exist. Even if i go to android/data its not there. Just the .com for all other apps. do you know where the busybox might be ?. On the busybox installer it says it is in /system/xbin but again i cant find it on my device.
And if i may chew your ear off for one more moment. How can i change the .config file ?
Thank you for your time

"No such file or directory" if tried run binary file in TWRP

I need to run a binary file, dalvikvm which located in /system/bin from TWRP terminal, but no matter what, it says, "No such file or directory found", and then I found that this is link file located another directory, I cd'd there and tried, but still the same result
I can be able to run the same file in Termux without any issues
Can anybody please help me on this?
Thanks
Hi, I think you need to mount the system partition before being able to access it. It's not mounted by default on TWRP, but when the phone is on it is (otherwise Android wouldn't work)
If you need help on how to mount partitions on TWRP, ring me (or google it, it's actually pretty simple)
Raiz said:
Hi, I think you need to mount the system partition before being able to access it. It's not mounted by default on TWRP, but when the phone is on it is (otherwise Android wouldn't work)
If you need help on how to mount partitions on TWRP, ring me (or google it, it's actually pretty simple)
Click to expand...
Click to collapse
Thanks for replying, it wasn't mounted at first, so I had mounted, still it didn't work, while some of the files in bin do work, some don't.
Then I copied the file to /sdcard and /tmp, and tried execute from these folders, still
Well, if when you're free, can you confirm if it's running on yours?
File: /system/bin/dalvikvm
Thanks once again
mizzunet said:
Thanks for replying, it wasn't mounted at first, so I had mounted, still it didn't work,
...
Thanks once again
Click to expand...
Click to collapse
I didn't found it inside, but it may be because I'm not rooted.
While searching around I've found this :
No such file or directory while running dalvikvm
I built AOSP Android and push the dalvik virtual machine in my device just to see if my built dalvik vm runs properly. I pushed it my device /opt directory but when I run dalvikvm, I get the error...
stackoverflow.com
It might get you out of trouble
Raiz said:
I didn't found it inside, but it may be because I'm not rooted.
While searching around I've found this :
No such file or directory while running dalvikvm
I built AOSP Android and push the dalvik virtual machine in my device just to see if my built dalvik vm runs properly. I pushed it my device /opt directory but when I run dalvikvm, I get the error...
stackoverflow.com
It might get you out of trouble
Click to expand...
Click to collapse
I looked into it.
I had no opt folder in root directory. So I made one, and moved dalvikvm to there and tried execute this time, it said permission denied, so I gave it chmod 755. But after that, it says "there no such file or directory".
Well, do you telegram account, so I could contact you there.
Thanks
Raiz said:
I didn't found it inside, but it may be because I'm not rooted.
While searching around I've found this :
No such file or directory while running dalvikvm
I built AOSP Android and push the dalvik virtual machine in my device just to see if my built dalvik vm runs properly. I pushed it my device /opt directory but when I run dalvikvm, I get the error...
stackoverflow.com
It might get you out of trouble
Click to expand...
Click to collapse
And even "file" binary, it says, there no file.
mizzunet said:
I looked into it.
I had no opt folder in root directory. So I made one, and moved dalvikvm to there and tried execute this time, it said permission denied, so I gave it chmod 755. But after that, it says "there no such file or directory".
Well, do you telegram account, so I could contact you there.
Thanks
Click to expand...
Click to collapse
This is really curious, tbh I'm not an expert around that subject, idk what's wrong with this binary...
Hopefully someone who knows more may help you with that. Have a nice day
This is because the binary you are trying to execute was compiled to run in the Android context, but you're trying to execute it in the TWRP one. Each binary has a path to a linker used during execution. The problem is that it refers to a linker that doesn't exist in TWRP.
Suppose we want to execte a binary file and obviously we can't:
Bash:
x00h:/ # /system/bin/awk
/sbin/sh: /system/bin/awk: No such file or directory
Let's take a look to its linker:
Bash:
x00h:/ # strings /system/bin/awk | head -n 1
/system/bin/linker64
Then, you will actually discover that it's sym linked to a linker that is available only when Android is running:
Bash:
x00h:/ # ls -ald /system/bin/linker64
lrwxr-xr-x 1 root shell 38 2009-01-01 00:00 /system/bin/linker64 -> /apex/com.android.runtime/bin/linker64
Since TWRP comes with its linker in /sbin/linker64, we can sym link it to /system/bin/linker64.
So, the hack:
Bash:
x00h:/ # mkdir -p /apex/com.android.runtime/bin/
x00h:/ # ln -s /sbin/linker /apex/com.android.runtime/bin/linker
x00h:/ # ln -s /sbin/linker64 /apex/com.android.runtime/bin/linker64
Retry, and it works:
Bash:
x00h:/ # /system/bin/awk
usage: /system/bin/awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]
Pray to God the TWRP's linker will be compatible and do the job (most binaries works fine), but sometimes you may get CANNOT LINK EXECUTABLE.

Categories

Resources