[Q] How can I run a terminal command at boot? - Eee Pad Transformer Q&A, Help & Troubleshooting

I want to use cifsmanager to mount Windows shares at boot time. The command I normally have to use is
su
insmod /system/lib/modules/cifs.ko
This then allows me to mount SMB shares just fine. But I have to execute this everytime after a reboot of the TF.
I read you can put it in /etc/init.d/
But I am not sure how to get it to execute on boot.

deadman3000 said:
I want to use cifsmanager to mount Windows shares at boot time. The command I normally have to use is
su
insmod /system/lib/modules/cifs.ko
This then allows me to mount SMB shares just fine. But I have to execute this everytime after a reboot of the TF.
I read you can put it in /etc/init.d/
But I am not sure how to get it to execute on boot.
Click to expand...
Click to collapse
It's not technically the best way, but the easiest way is to add the insmod line to /init.rc. You won't need the su as everything run in init.rc is run as root.
My preferred method is to make a script(e.g. cifs.sh) and mark it executable, then add "exec /path-to-script/cifs.sh" to the init.rc. That way I can edit the script without scrolling through the whole init.rc, and anytime you update the system, you just have to readd the exec line, instead of the whole script code.

Related

CIFS Manager on CM 7

Here is what I've tried:
1. Settings -> about tablet to get kernel version: 2.6.32.39-cyanogenmod [email protected] #1
2. Go to http://droidbasement.com/db-blog/ and find the kernel for gTab. There are several one, I just picked one with Gingerbread and downloaded
lib-2632.39_gb.tar.gz
Unpack on put cifs.ko under /system/lib/modules
3. Install CIFS Manger
4. Run CIFS Manager, add the share
5. If there is problem mount it in rw mode, use option "rw,noperm" (thanks, rajeevvp)
The share is successfully mounted.
Thanks!
redhonker said:
Here is what I've tried:
1. Settings -> about tablet to get kernel version: 2.6.32.39-cyanogenmod [email protected] #1
2. Go to http://droidbasement.com/db-blog/ and find the kernel for gTab. There are several one, I just picked one with Gingerbread and downloaded
lib-2632.39_gb.tar.gz
Unpack on put cifs.ko under /system/lib/modules
3. Install CIFS Manger
4. Run CIFS Manager, add the share
The share is successfully mounted.
The only issue I have is that it can't seem to mount a share in read-write mode even though it's shared with write permission. Does anyone know how to fix it?
Thanks!
Click to expand...
Click to collapse
After pushing the cifs module to the tablet you need to add an chmod and then you also need a insmod line every time you want to use it (at least after following a reboot).
Go back and read the instructions on droid basement. He has the details of the steps following loading the cifs.ko.
Good luck.
Sent from my ADR6300 using Tapatalk
CIFS manager already loads the module fine. Are you saying in order to mount in rw mode, it needs permission on cifs.ko file?
redhonker said:
CIFS manager already loads the module fine. Are you saying in order to mount in rw mode, it needs permission on cifs.ko file?
Click to expand...
Click to collapse
No, you don't.
CIFS Manager should have an option to do a read-write mount.
Otherwise, you can try changing the mounting back into read-write mode:
Code:
$ su
# /system/xbin/mount -w -o remount /CIFS/PATH
Replace, /CIFS/PATH with the directory you provided to CIFS Manager.
Also, understand my cautions, as mentioned in the other thread, about mixing and matching kernels and kernel modules. I would suggest that you also install the kernel that goes with the module file you downloaded--ie. get the one in the same blog post.
Appreciate your advice on not mixing kernel and modules. I could not tell which exact build CM 7 uses so I had to pick one. When I get more experienced with Android, I may start changing kernels.
Doesn't CIFS uses rw mount by default? If not, what's the option? rw? I've tried that as well.
If I change the system file to mount it by default, I'd have to save the password on the command line, right? Will wireless be ready at that time? And if server or wireless is not ready at the time, I'd need to manually remount with some tool, do I?
Thanks!
redhonker said:
Appreciate your advice on not mixing kernel and modules. I could not tell which exact build CM 7 uses so I had to pick one. When I get more experienced with Android, I may start changing kernels.
Doesn't CIFS uses rw mount by default? If not, what's the option? rw? I've tried that as well.
If I change the system file to mount it by default, I'd have to save the password on the command line, right? Will wireless be ready at that time? And if server or wireless is not ready at the time, I'd need to manually remount with some tool, do I?
Thanks!
Click to expand...
Click to collapse
Cm7 includes pershoots kernel. The gb one.
Sent from my ADR6300 using Tapatalk
not to confuse issue with whatop is having but I wonder if anyone has run into a problem with cifs in which it doesn't include all of the folders from your windows shares.
redhonker said:
Here is what I've tried:
1. Settings -> about tablet to get kernel version: 2.6.32.39-cyanogenmod [email protected] #1
2. Go to http://droidbasement.com/db-blog/ and find the kernel for gTab. There are several one, I just picked one with Gingerbread and downloaded
lib-2632.39_gb.tar.gz
Unpack on put cifs.ko under /system/lib/modules
3. Install CIFS Manger
4. Run CIFS Manager, add the share
The share is successfully mounted.
The only issue I have is that it can't seem to mount a share in read-write mode even though it's shared with write permission. Does anyone know how to fix it?
Thanks!
Click to expand...
Click to collapse
OP,
See modified instructions from your first post. This should get you up and running.
1. Settings -> about tablet to get kernel version: 2.6.32.39-cyanogenmod [email protected] #1
2. Go to http://droidbasement.com/db-blog/ and find the kernel for gTab. There are several one, I just picked one with Gingerbread and downloaded
lib-2632.39_gb.tar.gz
Unpack on put cifs.ko under /system/lib/modules/2.6.32.39-cyanogenmod/
From ADB or terminal emulator (enable SU and do not need the adb part)
adb remount
adb shell chmod 644 /system/lib/modules/2.6.32.39-cyanogenmod/MODULE.ko
adb shell insmod /system/lib/modules/2.6.32.39-cyanogenmod/MODULE.ko
3. Install CIFS Manger
4. Run CIFS Manager, add the share
I wanted to help you with this earlier but been sidetracked. I hope this helps
redhonker said:
Doesn't CIFS uses rw mount by default? If not, what's the option? rw?
Click to expand...
Click to collapse
Yes, by default it should be mounted read-write. If, for some reason, it gets mounted read-only, you can use the remount command I gave earlier to make the mount read-write again.
But, there could be other reasons for you not being able to write to the share directory. Permission and UID/GID mismatches could be one reason. Try adding the "noperm" flag to tell Linux not to check permissions locally ie. do the permission checking only on Windows:
Code:
/system/xbin/mount -t cifs //SERVER-IP-ADDRESS/SHARENAME /some/path -o rw,noperm,domain=DOMAIN,username=USER.NAME,password=PASSWORD
If I change the system file to mount it by default, I'd have to save the password on the command line, right? Will wireless be ready at that time? And if server or wireless is not ready at the time, I'd need to manually remount with some tool, do I?
Click to expand...
Click to collapse
Which system file? If you mean /etc/fstab, then that file does not exist on Android.
CIFS Manager (I haven't used it) should have an option to let you store the password securely. On normal Unix systems, the mount command accepts a "credentials=/some/file.txt" option which can be used in place of the "domain=XXX,username=YYY" options when mounting. Unfortunately, the mount command on the gTablet does not understand that option--I checked: you have to do it the old-fashioned way. You can't even skip the "password=" bit. On Unix, if you skip that, the mount command will prompt you for the password.
The solution, if you don't use CIFS Manager, is to place all the commands--the insmod and the mount--into a shell-script and give it 700 permissions. That way only the owner can see what's inside it and you can run the script after the wireless has come up.
noperm does the trick. Will update first post.
Oozura said:
From ADB or terminal emulator (enable SU and do not need the adb part)
adb remount
adb shell chmod 644 /system/lib/modules/2.6.32.39-cyanogenmod/MODULE.ko
adb shell insmod /system/lib/modules/2.6.32.39-cyanogenmod/MODULE.ko
[/B]
Click to expand...
Click to collapse
Could you explain the exact process for doing this from a terminal emulator. My main hold up is the /system directory being read only, so I can't copy the module (CIFS.KO in this case) to that directory.
h3llphyre said:
Could you explain the exact process for doing this from a terminal emulator. My main hold up is the /system directory being read only, so I can't copy the module (CIFS.KO in this case) to that directory.
Click to expand...
Click to collapse
You don't need to put cifs.ko into /system. If CIFS Manager asks for the path to a cifs.ko file, then you can put the file anywhere you want.
I have a new problem. There seems to be a limit on the file size. I have a 3 GB file shows up as 28 KB. Does anyone have success with large file? Thanks
I tried your instruction... there are two problems...(my rom is also cm7.0.3)
1. I can't put the cifs.ko into /system/lib/modules~ it seems that it is forbid to copy some files into system folder...
2. so I tried to put the cifs.ko in the /mnt/cifs.ko, and made the related setting in cifs manager(path to cifs.ko), then i mounted, but it showed that:"no route to host"
but i am sure that my ip and password is correct... so is there anyone know how to solve this problem?
I used Root Explorer. I am sure there are other means to put it under /system. I am not sure if that's necessary
savage0 said:
I tried your instruction... there are two problems...(my rom is also cm7.0.3)
1. I can't put the cifs.ko into /system/lib/modules~ it seems that it is forbid to copy some files into system folder...
2. so I tried to put the cifs.ko in the /mnt/cifs.ko, and made the related setting in cifs manager(path to cifs.ko), then i mounted, but it showed that:"no route to host"
but i am sure that my ip and password is correct... so is there anyone know how to solve this problem?
Click to expand...
Click to collapse
I literally just went through this today. Download Terminal Emulator (free on the market).
PS: Don't type the '#' sign below.
#su
#/system/xbin/mount -w -o remount /system
#cp /SDCARD/cifs.ko /system/lib/modules/2.6.32.41-cyanogenmod/
#/system/xbin/mount -r -o remount /system
Then, just add the path /system/lib/modules/2.6.32.41-cyanogenmod/ into CIFS Manager. Should be all set.
redhonker said:
I have a new problem. There seems to be a limit on the file size. I have a 3 GB file shows up as 28 KB. Does anyone have success with large file? Thanks
Click to expand...
Click to collapse
File size limits depend on the underlying filesystem.
I tried the following command on an external NTFS formatted USB HDD connected to a Linux desktop mounted on the gTablet at /mnt/usbdisk via CIFS, and had no problems.
Code:
# ls -l /mnt/usbdisk/rvp/bak/hda3.img
-rw-rw-rw- 1 root root 8011422720 Apr 17 2010 /mnt/usbdisk/rvp/bak/hda3.img
# dd if=/mnt/usbdisk/rvp/bak/hda3.img of=/dev/null bs=1M skip=7500
140+1 records in
140+1 records out
147102720 bytes (140.3MB) copied, 150.135761 seconds, 956.8KB/s
The command skips the initial 7.5 GB of a 8,011,422,720 byte file and reads the rest (~140 MB).
rob_z11 said:
not to confuse issue with whatop is having but I wonder if anyone has run into a problem with cifs in which it doesn't include all of the folders from your windows shares.
Click to expand...
Click to collapse
I had the same issue, but I found the guide on abettergeek which helped me fix it. Turns out the problem is that the mount point created by Cifs Manager doesn't have execute permissions.
I don't have enough seniority to post the link, but it's a recent post on abettergeek.com. If someone with enough seniority wants to paste it, some others may find it extremely helpful.
archmcd said:
I had the same issue, but I found the guide on abettergeek which helped me fix it. Turns out the problem is that the mount point created by Cifs Manager doesn't have execute permissions.
I don't have enough seniority to post the link, but it's a recent post on abettergeek.com. If someone with enough seniority wants to paste it, some others may find it extremely helpful.
Click to expand...
Click to collapse
The link I believe you are refering to is here: http://blog.abettergeek.com/hardwar...n-cyanogenmod-7-0-3-on-the-viewsonic-gtablet/
I have the same issue. I haven't tried this fix yet, but I will give it a go.
ByteWrencher
Pls, where I can put "rw,noperm" in cifs manager? I tried in module path as:
/system/lib/modules/slow-work.ko:/system/lib/modules/cifs.ko rw,noperm
And:
/system/lib/modules/slow-work.ko:/system/lib/modules/cifs.ko:rw,noperm
But still don't working as rw.
Ty.

[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

Set bash as default shell

For a long time I have been running bash on my phone. However at some point you get tired of having to manually enter bash all the time from ssh, adb etc. Therefore I transferred my boot.img to my computer, changed the "console" line in init.rc to point at bash instead of sh and flashed it back to my phone. To my surprise this did not help. Neither adb nor ssh switched to bash by making this change.
I then created a symlink from bash to sh, but this does not work 100% as bash switches to sh mode when arg(0) = "sh", I don't like that.
So I made a script that calls bash and replaced sh with that. But for some reason this can make problems with you boot process some times.
This is where bind mounts come in.
By adding a small init.d script that bind mounts my bash calling script with the sh binary (yes bind mount also works for files), the boot process gets to use it's bellowed sh while I get to use bash as default from everywhere. Because the script is mounted to the sh binary (Not linked), a reboot will reset it back to to original file.
Now we just add /system/etc/bash.bashrc and place an alias from sh to bash so that the custom script is not called more than it has to. Also I have added the option to add a custom .bashrc in /mnt/sdcard/ that is called from /system/etc/bash.bashrc, and a /system/etc/debian_chroot file support for those of you that has a chroot system installed.
Why use bash?
Well you can add custom layout to your shell, create/change global variables which normally only can be done from init.rc, create aliases, execute custom scripts and so on to make your shell environment just the way you like it.
The update.zip contains a bash binary that looks for /etc/bash.bashrc, the bash call script to replace sh, a bash.bashrc file that creates the android missing user variables and more, and the init.d script that mounts the bash call script.
Requirements
init.d support
busybox
Download
Bash Route 1.0.0 (MD5: ebb539f5d07944ead77439b89e76f524) - bash_route-signed.zip
Sh is actually a symlink to mksh, so just delete it, and replace (not true for /sbin/sh, its linked to busybox)
From my fingers to your eyez
cdesai said:
Sh is actually a symlink to mksh, so just delete it, and replace (not true for /sbin/sh, its linked to busybox)
From my fingers to your eyez
Click to expand...
Click to collapse
It does not matter. The point is when someone/something makes a call to sh, bash switches to sh mode. It does not matter if you link bash to sh, mksh or copies bash to either two or whatever. You need to replace arg(0) with "bash" instead of "sh". The only way to do this is to make a script that answers the call and redirects that call to bash along with the message (the rest of the arguments). That way arg(0) will be replaced with "bash" and the bash shell will run it's regular mode instead of the "sh" mode.
dk_zero-cool said:
It does not matter. The point is when someone/something makes a call to sh, bash switches to sh mode. It does not matter if you link bash to sh, mksh or copies bash to either two or whatever. You need to replace arg(0) with "bash" instead of "sh". The only way to do this is to make a script that answers the call and redirects that call to bash along with the message (the rest of the arguments). That way arg(0) will be replaced with "bash" and the bash shell will run it's regular mode instead of the "sh" mode.
Click to expand...
Click to collapse
Necrobumping this thread for a few reasons.
1.) You have posted in the Android Software and Hacking General section. I was looking for something similar to this for GS3-LTE. Your updater script is specifically for MTD devices....like i9000 ICS or so on.
2.) There are mistakes in your script to install. unmount is not a linux busybox command. umount is though.
I will try out your idea. Thanks
You got this still? The zip has gone down.

Fix fix_permissions

Apparentely fix_permissions doesn't work in stock roms (or at least in XKPU + XDA_bam kernel v11).
In order to fix permissions, /sbin/fix_permissions reads /data/system/packages.xml. However that file is not there, but in /dbdata/system/.
I temporarily solved the problem creating a symbolinc link to the file, but in this way "fix_permissions" will not work from CWM (it doesn't mount /dbdata).
The only way to successfully run "fix_permissions" is to run it from from adb or terminal emulator, when /dbdata is already mounted.
(I suggest you not to simply copy the file from /data to /dbata. The one in /dbdata is continuously updated)
The only way to completely solve the problem is to edit /sbin/fix_permissions, but apparently the file is regenerated after every reboot and I don't know how to permanently change it (I think we need to change boot.img, that's why I specified rom and kernel), but I really don't care that much since the command works from adb/terminal emulator.
Anyway, here the commands to create the symbolic link. You need to run them only once from adb/terminal emulator:
Code:
su
mount -o remount rw /system
ln -s /dbdata/system/packages.xml /data/system/packages.xml
mount -o remount ro /system
After that, whenever you need to fix permissions, you simply need to run this from adb/terminal emulator:
Code:
su
fix_permissions
Before you create the symbolic link, you can check if the problem exists in your rom/kernel by running "fix_permissions". The error is:
Code:
cat: can't open '/data/system/packages.xml': No such file or directory
Thanks! Gonna fix that in the next release
loSconosciuto said:
Apparentely fix_permissions doesn't work in stock roms (or at least in XKPU + XDA_bam kernel v11).
In order to fix permissions, /sbin/fix_permissions reads /data/system/packages.xml. However that file is not there, but in /dbdata/system/.
I temporarily solved the problem creating a symbolinc link to the file, but in this way "fix_permissions" will not work from CWM (it doesn't mount /dbdata).
The only way to successfully run "fix_permissions" is to run it from from adb or terminal emulator, when /dbdata is already mounted.
(I suggest you not to simply copy the file from /data to /dbata. The one in /dbdata is continuously updated)
The only way to completely solve the problem is to edit /sbin/fix_permissions, but apparently the file is regenerated after every reboot and I don't know how to permanently change it (I think we need to change boot.img, that's why I specified rom and kernel), but I really don't care that much since the command works from adb/terminal emulator.
Anyway, here the commands to create the symbolic link. You need to run them only once from adb/terminal emulator:
Code:
su
mount -o remount rw /system
ln -s /dbdata/system/packages.xml /data/system/packages.xml
mount -o remount ro /system
After that, whenever you need to fix permissions, you simply need to run this from adb/terminal emulator:
Code:
su
fix_permissions
Before you create the symbolic link, you can check if the problem exists in your rom/kernel by running "fix_permissions". The error is:
Code:
cat: can't open '/data/system/packages.xml': No such file or directory
Click to expand...
Click to collapse
This should have been included in the specific ROM's thread not creating another thread. Closing this since XDA_Bam has stated the fix will be implemented.

[Q] NEED HELP LG Optimus Elite Virgin Mobile

Hello Forum!
So i am currently using a Virgin Mobile LG Optimus Elite.
After 2 days of refuge here on the forums i amazingly found a small little program that was intended to root p500 devices and worked for mine.
I did run root checker and all plus i have root access so it is rooted.
My problem is,
1.) I cannot edit my build.prop
2.) Install Xbox Smartglass (which is the whole reason i'm killing myself for all this right now)
I'm running 2.3.7 gingerbread, and the smartglass app requires 4.0 and up.
I am certain this phone can run the app.
From the very beginning i tried to take the easy path out by manually downloading the .apk from an outside source but when i try to install it
i get an error stating that it had a problem "parsing" the info.
Running my little research i found you could edit the build.prop file to make the play store think you were running another device that was compatible. Then realizing my device must be rooted first, began my 2 days long journey to root the stubborn thing.
After root success, I installed ES File Explorer. From there, i went to my build.prop, proceeded to edit it with the ES text editor. Re-wrote the 2 lines required then when i went to save, "Error occurred when trying to save the file. It will not be saved." And just left me hanging after that.
In a quick desperate attempt, i found QtADB, which i thought would allow me to edit the system files. It only allowed me access to a hand full of the root directories. I downloaded the newest android dev kit (obviously you need it to run QtADB) so i don't know what exactly the problem here is.
For my absolute last desperate attempt i decided to do it manually. I took the build.prop and edited it manually through wordpad. (NOTE: i backed up the original) I named it "copy.build.prop" and placed it back in an easy to find directory. I then opened up ES file explorer, located the file and tried to copy it to the original location but no matter what i name it or what i do in general it will not move. It keeps failing and just telling me the file cannot be moved.
I am at my last legs with this to the point where i may just give up.
I dont know what to do and was hoping someone on here would.
If there was another way to install the app? If i could install it manually? Something to get me around all these utterly frustrating and annoying errors. I've ran from error to error, fixing it then coming to another. And at this point i just dont know what to do.
The help and replies would be much appreciated! Thanks in advanced!
The build.prop file is located in the /system partition, which is by default mounted as read-only (and for good reason).
Here are some simple steps to modifying the build.prop file.
1) Fire up an ADB shell ("adb shell" from a command prompt without quotes)
2) Within the ADB shell, execute "mount -o rw,remount /system /system" without quotes. This will remount your /system partition in read-write mode
3) Open a new command prompt and CD to an easily accessible directory (e.g "cd ~/Desktop" if on a Linux box)
4) Execute "adb pull /system/build.prop" without quotes
5) Edit the build.prop file as needed with a good text editor (DO NOT use Wordpad or Notepad, I prefer Notepad++ on Windows and Geany on Linux)
6) Execute "adb push /path/to/your/edited/build.prop /system/build.prop" without quotes. This will copy your modified build.prop back into the /system partition
7) In the ADB shell prompt, execute "mount -o ro,remount /system /system" without quotes. This will remount your /system partition read-only (never leave it read-write that is bad)
8) Reboot your phone
9) Profit!
As far as the Smartglass app goes, there is likely a good reason it requires ICS and above, and simply modifying your build.prop may not be enough. Don't take my word for it though, try the above steps and see what happens.
Cheers!
drewwalton19216801 said:
The build.prop file is located in the /system partition, which is by default mounted as read-only (and for good reason).
Here are some simple steps to modifying the build.prop file.
1) Fire up an ADB shell ("adb shell" from a command prompt without quotes)
2) Within the ADB shell, execute "mount -o rw,remount /system /system" without quotes. This will remount your /system partition in read-write mode
3) Open a new command prompt and CD to an easily accessible directory (e.g "cd ~/Desktop" if on a Linux box)
4) Execute "adb pull /system/build.prop" without quotes
5) Edit the build.prop file as needed with a good text editor (DO NOT use Wordpad or Notepad, I prefer Notepad++ on Windows and Geany on Linux)
6) Execute "adb push /path/to/your/edited/build.prop /system/build.prop" without quotes. This will copy your modified build.prop back into the /system partition
7) In the ADB shell prompt, execute "mount -o ro,remount /system /system" without quotes. This will remount your /system partition read-only (never leave it read-write that is bad)
8) Reboot your phone
9) Profit!
As far as the Smartglass app goes, there is likely a good reason it requires ICS and above, and simply modifying your build.prop may not be enough. Don't take my word for it though, try the above steps and see what happens.
Cheers!
Click to expand...
Click to collapse
I'm having problems setting a custom directory now... im on a windows 7 pc. I'm using the Qtabd shell, and at first it stated to give the CD a home, i've tried a million combinations and i just cant get one to work!!!

Categories

Resources