[Q]/proc/mounts reverses in Java Shell Process - C++ or Other Android Development Languages

So I am working on a Root Framework Tool used to create Android Root Applications. During this I found one strange issue. Whenever I attempt to output /proc/mounts from ProcessBuilder, I get it returned in reversed order. In the ADB shell there is no problem. Also 'df' bases it's output on a reversed /proc/mounts output when executed from within Java.
My question is if anyone has any idea why? This is the only file I have this problems with, other files in /proc like filesystems, devices, swaps etc get's returned in the same order as when using an ADB shell.
The issue is easy to fix as I can rearrange the output again, but only if can be sure that this is a constant thing which affects all devices, otherwise I will just create the issue on other devices. So far I have only been able to test this on two Android 4.2 devices, so I am not sure if this is a side affect of Android's new multi-user feature (Which uses some new mount features not used in older versions).
The problem with this is that the order of /proc/mounts decides which folder is attached to devices and which are bind mounted to other folders. A reversed list will give incorrect feedback about mount locations.

After checking further I saw that it is not a reversed list, it's more like an ordered list.
Original:
* /dev/block/mmcblk0p12 = /data
* /dev/block/mmcblk1p2 = /sd-ext
* /dev/block/mmcblk1p2 = /data/app
From Java:
* /dev/block/mmcblk0p12 = /data
* /dev/block/mmcblk1p2 = /data/app
* /dev/block/mmcblk1p2 = /sd-ext
It's like it has been ordered based on locations, which makes it even harder to create a fix for.

/proc/mounts is accessible without root, so can you just read it with a FileInputStream, can't you?

ramdroid77 said:
/proc/mounts is accessible without root, so can you just read it with a FileInputStream, can't you?
Click to expand...
Click to collapse
That gives the same result. It seams that each app process in general gets another version of the file.
Sent from my GT-I9300 using xda premium

dk_zero-cool said:
That gives the same result. It seams that each app process in general gets another version of the file.
Sent from my GT-I9300 using xda premium
Click to expand...
Click to collapse
oh well, that's really strange... Doesn't make any sense at all....

Related

Using all of the NTs storage

I posted this in the nook touch forum by mistake. Please read below and let me know what you think.
One of the biggest issues I had with my nook was the 16/1GB division between content I can load and content from B&N/etc. Not being able to use that 16GB how I wanted was something I set forth to fix. Here is my solution to make this usable to non-rooted apps.
1) Root if not already rooted.
2) Make a directory inside of /data. I chose /data/usrdata.
3) remount / as RW with the command mount -o remount,rw -t rootfs rootfs / (credit to Indirect for this, as I could't find the command to do so)
4) mkdir /mnt/internal . We need somewhere to mount /data/usrdata/ and /mnt is public enough.
5) busybox mount -o bind /data/usrdata /mnt/internal. Mounts /data/usrdata to /mnt/internal.
6) For good measure, chmod 777 /mnt/internal and chmod 777 /data/usrdata.
Now, /mnt/internal should have whatever free space /data has, and should be read/write accessible from any program. A quick test with touch+terminal emulator shows new files as being created with RW permissions for all.
Alternatives: When I was initially thinking about ways to do this, my first reaction was to just open up /data to be read only to all, then have my usrdata folder be read/write all. However, I know part of android's app security model depends on some of these permissions. While I can't think of anything breaking or sensitive data being leaked, I decided against it. If anyone has any thoughts as to that scenario, I am very interested in hearing about it.
USB support: This will *not* be mountable under USB. Unfortunately you are still limited to transfering the data from a computer to the B&N internal storage or SDcard first, then moving the data internally. The problem that I see with this is similar to my understanding of the galaxy nexus situation, where the system can't unmount its /data partition and let the USB host take over. Another alternative to this could be to write an image file and mount that over usb (I've done this on my Evo, it worked so-so). Problem with that is that it really wouldn't grow/shrink with the storage. I suppose you could do some shell trickery and pipe it through gzip somehow, but that wouldn't help very much.
Let me know what you think and if you have any ways to improve this.
UPDATE: Persistance:
To make this persistant across reboots, run these commands as root:
1) mount -o rw,remount -t ext4 /dev/block/platform/mmci-omap-hs.1/by-name/system /system
2) echo mount -o remount,rw -t rootfs rootfs / >> /system/bin/clrbootcount.sh
3) echo mkdir /mnt/internal >> /system/bin/clrbootcount.sh
4) echo busybox mount -o bind /data/usrdata /mnt/internal >> /system/bin/clrbootcount.sh
5) echo mount -o remount,ro -t rootfs rootfs / >> /system/bin/clrbootcount.sh
All this does is put the following at the end of clrbootcount.sh
mount -o remount,rw -t rootfs rootfs / #Remounts root as RW. Root is regenerated at each reboot, so /mnt/internal is never going exist on a fresh startup
mkdir /mnt/internal #make /mnt/internal, see above
busybox mount -o bind /data/usrdata /mnt/internal #Binds the directory
mount -o remount,ro -t rootfs rootfs / #remounts root as RO. Unsure if this is necessary, but since it runs as RO, its probably better safe than sorry.
Thanks to eded333 for mentioning a good place for the script.
Click to expand...
Click to collapse
I was the one who wrote the script gameman. >.>'
Very nicely done.
Does Android possess a fstab? If so, could these changes (also) be made there and still be persistent?
this is a good work around
Am I understanding this correctly in that if I follow these guidelines I can move my data over to the Barnes and noble alotted storage that we were complaining about not having available?
Sent from my Nook Tablet using Tapatalk
downsay said:
Am I understanding this correctly in that if I follow these guidelines I can move my data over to the Barnes and noble alotted storage that we were complaining about not having available?
Sent from my Nook Tablet using Tapatalk
Click to expand...
Click to collapse
That is correct, from what I understand as well.
Sent from my BNTV250 using Tapatalk
liquidzoo said:
Very nicely done.
Does Android possess a fstab? If so, could these changes (also) be made there and still be persistent?
Click to expand...
Click to collapse
From what I could tell, it does, but its not the normal /etc/fstab. It looks like they have a daemon or something that mounts the sdcard and the media (1gb) drive. When I first looked at its version of the fstab, it looked like it only took a block device, which doesn't quite work for the directory binding.
downsay said:
Am I understanding this correctly in that if I follow these guidelines I can move my data over to the Barnes and noble alotted storage that we were complaining about not having available?
Click to expand...
Click to collapse
Yes that is correct. You still cannot mount it under USB, however. If you have some other way of getting the files there, however, its open as an option. I've been using swiFTP (in the market) to do that. Could also copy and move from the media/sd cards that do mount to the PC, but thats a two step process. I've thought about getting MTP setup so that you can see that folder via USB, but haven't really had a chance to look into how that would work.
*Note, when using swiFTP and other programs more than likely, you may get some file permissions errors or other odd errors about corrupt files. These are just the file permissions that the program defaulted to, and can be fixed by doing a 'chmod -R 777 /mnt/internal/'. Don't have this problem on sdcard or media because they are just FAT32 formatted, which don't support permissions.
Trying to understand ...
gameman733 said:
I posted this in the nook touch forum by mistake. Please read below and let me know what you think.
Click to expand...
Click to collapse
I don't understand the purpose of the mounts. Why not just create /data/usrdata and put your stuff in there?
I know /data has "access-only/no-read" access for non-system apps, but anything in /data/usrdata/ should be visible (and no need to modify clrbootcount.sh).
If you need "/mnt/internal" (I don't see the need for that either), why not just use a soft link (which is permanent)???
The primary reason for using the mounts was that I was originally planning on trying to mount it in a way that would ignore file permissions, but didn't know at the time that you can't do that with a bind mount. Using a simple link would be just as effective in this case.
However.. / is Read only. Even when remounted read-write, this filesystem is actually regenerated every boot. So nothing in /mnt would stay past the next restart.
The purpose for having it in /mnt (could have been anywhere, I suppose, but it seemed a little more appropriate) was for apps that can't browse /data. For example, gameboid and related programs would get to /data and show nothing, because you can't browse it as a non-rooted app. Having a symlink or bind mount elsewhere in the filesystem where they can browse helps with that. The alternative was to remove the no-browsing permissions from /data. I didn't feel comfortable with doing this, however, as I'm sure there are some security risks to doing this. It probably isn't a big deal, but since we have the tools to do it while maintaining those existing permissions, why not go ahead and do that?
Is there a solution that does not require being rooted?
[I was gonna start a thread about this 1.0 GB vs 16GB issue. Glad someone
beat me to it. ]
A day or two ago, I side-loaded a couple of movies, each about 400-MB in size,
and was surprised to notice that I had only 20% of my 1.0GB remaining.
I haven't 'bitten the bullet', and got brave enough to 'root' my Nook yet.
(Still not sure yet whether my wife will keep it, and it's an XMAS-gift for her.)
But, I'm quite fluent in Linux, so if we DO keep it, I'll definitely get around
to doing the 'root'.
Meanwhile, if anyone does find a way, without rooting, to re-allocate these
built-in assigned storage quotas, please post it in this thread.
Cheers...
gameman733 said:
The primary reason for using the mounts was that I was originally planning on trying to mount it in a way that would ignore file permissions, but didn't know at the time that you can't do that with a bind mount.
Click to expand...
Click to collapse
To solve this issue I've compiled fuse kernel module and bindfs userspace utility. Bindfs is similar to "mount -o bind" but can override permissions and ownerships. I can share how-to instruction and compiled binaries if you want

[Q] Unable to change permissions or delete a specific file WITH root

Hello Gentlemen. Sorry to disturb you with a noob question but I cannot solve it for the life of me and I have tried everything I could find on the forums. I have an Aluratek Cinepad AT107F. I have successfully rooted it. I have full super user permissions and I have no problems deleting any files or folders EXCEPT one directory. Let me explain the situation.
I recently did a firmware update and it included brand new APKs for Youtube, also added Google Play Support, and added Angry Birds.
I am unable to update Youtube to the latest version. It gives a "Package file was not signed correctly. Uninstall the previous copy of the app and try again.".
So I attempted to do just what it had asked. I rooted just to do this. I tried removing it with Titanium Backup, I tried Root Uninstaller, I tried Root Explorer, I tried deleting using the "adb shell rm" command. I still get a "Read-only file system".
Even though I have root and granted root access to Root Explorer, I am unable to change the permissions for this /oem/apps/ directory. It's on the top level of the internal memory. I have no external SD card.
I've spent 10+ hours trying to figure this out and I'm sure someone knows something that I don't and can fix this super easy. I'm asking for your help, you're my only hope!
Your issue is that the update gave you modded files that the OEM doesn't want deleted. Most likely do to them not have permission from Google to do so. You will be hard pressed to find help here as we mainly deal with official releases and apks.
Wayne Tech S-III
zelendel said:
Your issue is that the update gave you modded files that the OEM doesn't want deleted. Most likely do to them not have permission from Google to do so. You will be hard pressed to find help here as we mainly deal with official releases and apks.
Wayne Tech S-III
Click to expand...
Click to collapse
Am I in the wrong sub forum? Is there another forum at XDA-Developers that could help?
Vindicoth said:
Am I in the wrong sub forum? Is there another forum at XDA-Developers that could help?
Click to expand...
Click to collapse
No nowhere on the site really deals with unofficial android versions and knock of devices. Your best bet will be the OEM
Read the error message again. The file is on a read-only filesystem. That is why you cannot delete it. In other words, you lack permission to write to the partition.
System partitions get mounted readonly to prevent modification. To remount /system as read-write,
Adb shell mount -o remount,rw /system
If you get "not permitted" error, your ROM's ro.secure means you cannot execute mount operations passed with adb command. So instead you must first open the shell,
> AdB shell
# mount -o remount,rw /system
Now you can delete:
Adb shell rm /system/file
If it is a directory
Adb shell rm -rf /system/dir
If you accidentally mistype that last command with a space beyween that first forward-slash and "s" you will have a very unworkable device....and that's why it is mounted read-only.
If the file is on a different read only filesystem, identify the partition the file is on and
Adb shell mount -o remount,rw /dev/block/id /LocToMountTo
You may have to specify the type
-t fstype
Adb shell mount
will tell you this
Don't forget to remount it as read-only (ro) when you are done
anotherguy19 said:
Read the error message again. The file is on a read-only filesystem. That is why you cannot delete it. In other words, you lack permission to write to the partition.
System partitions get mounted readonly to prevent modification. To remount /system as read-write,
Adb shell mount -o remount,rw /system
Now you can delete:
Adb shell rm /system/file
If it is a dir
Adb shell rm -rf /system/file
If you accidentally mistype that last command with a space beyween that first forward-slash and "s" you will have a very unworkable device....and that's why it is mounted read-only.
If the file is on a different read only filesystem, identify the partition the file is on and
Adb shell mount -o remount,rw /partition/id /folder
You may have to specify the type
-t fstype
Adb shell mount
will tell you this
Don't forget to remount it as read-only (ro) when you are done
Click to expand...
Click to collapse
Well I can access /system just fine. The problem is the /oem/apps folder is not in the /system folder. It's in the top level folder.
/system and /oem/apps are in the root directory. I can change the permissions on /system just fine using Root Explorer, but when trying to change the permissions using any method possible, /oem wont change.
This happens alot on Devices out of China and other places that sell knock offs. They make it so you cant delete their apps and if you do then it bootloops which only a reflash will fix.
Vindicoth said:
Well I can access /system just fine. The problem is the /oem/apps folder is not in the /system folder. It's in the top level folder.
/system and /oem/apps are in the root directory. I can change the permissions on /system just fine using Root Explorer, but when trying to change the permissions using any method possible, /oem wont change.
Click to expand...
Click to collapse
/system and /oem are different partitions then
mount | grep oem
or
adb shell mount | grep oem
Will tell you what /dev/block/xxxx the /oem is on and if it is mounted as read-only (ro)
> adb shell
# mount -o rw,remount /oem
zelendel said:
This happens alot on Devices out of China and other places that sell knock offs. They make it so you cant delete their apps and if you do then it bootloops which only a reflash will fix.
Click to expand...
Click to collapse
Ever get the feeling that you're writing in invisible ink lol?.. Eventually he will listen! You have great patience!
zelendel said:
This happens alot on Devices out of China and other places that sell knock offs. They make it so you cant delete their apps and if you do then it bootloops which only a reflash will fix.
Click to expand...
Click to collapse
Referencing zelendel's post, the device could fail to boot because it is looking for the removed app in /oem
So you could try to remove it from being referenced by the startup scripts.
Try doing a search for files that could be referencing the apk you want to remove.
> adb shell
# grep -r AppName.apk /system/etc
CtrlAltDelIrl said:
Ever get the feeling that you're writing in invisible ink lol?.. Eventually he will listen! You have great patience!
Click to expand...
Click to collapse
If it bootloops then I'll just flash it again, but its worth a try isn't it? Thanks anyways.
anotherguy19 said:
Referencing zelendel's post, the device could fail to boot because it is looking for the removed app in /oem
So you could try to remove it from being referenced by the startup scripts.
Try doing a search for files that could be referencing the apk you want to remove.
> adb shell
# grep -r AppName.apk /system/etc
Click to expand...
Click to collapse
Thank you for your very helpful posts and willingness to help me possibly bootloop my device
when I type the grep command it says it is not found, so I will download busybox onto my tablet and try those commands.
Vindicoth said:
Thank you for your very helpful posts and willingness to help me possibly bootloop my device
when I type the grep command it says it is not found, so I will download busybox onto my tablet and try those commands.
Click to expand...
Click to collapse
So after running mount | grep oem it shows this
[email protected]:/ # mount | grep oem
/dev/block/nandi /oem cramfs ro,relatime 0 0
So is it possible to change this directory to rw? I tried the mount -o rw,remount oem but it doesnt show anything after i input the command
[EDIT]
So it seems that the cramfs file system is read-only.
Vindicoth said:
Thank you for your very helpful posts and willingness to help me possibly bootloop my device
when I type the grep command it says it is not found, so I will download busybox onto my tablet and try those commands.
Click to expand...
Click to collapse
I love breaking things. It's only then we can figure out how it works.
Busybox is exactly what you need.
grep will search for strings within all files and subdirs of /system/etc; matching whatever you type for "AppName.apk"
It is a case-sensitive search unless you add
-i
So
grep -ri ....
or
grep -r -i....
Both would work.
But you don't even know if you need to be searching for a file to modify.
You may want to go ahead and delete the file and reboot.
If it fails, note the file(s) you deleted and know the system is looking for them and then proceed with seeing if you can identify a file in /system/etc that is looking for it's presence.
---------- Post added at 11:59 PM ---------- Previous post was at 11:53 PM ----------
Vindicoth said:
So after running mount | grep oem it shows this
[email protected]:/ # mount | grep oem
/dev/block/nandi /oem cramfs ro,relatime 0 0
So is it possible to change this directory to rw? I tried the mount -o rw,remount oem but it doesnt show anything after i input the command
[EDIT]
So it seems that the cramfs file system is read-only.
Click to expand...
Click to collapse
Commands that complete "quietly" mean they were successful.
If you type
# mount | grep oem
After
# mount -o rw,remount /oem
/dev/block/nandi /oem cramfs ro,relatime 0 0
Should have changed to
/dev/block/nandi /oem cramfs rw,relatime 0 0
anotherguy19 said:
I love breaking things. It's only then we can figure out how it works.
Busybox is exactly what you need.
grep will search for strings within all files and subdirs of /system/etc; matching whatever you type for "AppName.apk"
It is a case-sensitive search unless you add
-i
So
grep -ri ....
or
grep -r -i....
Both would work.
But you don't even know if you need to be searching for a file to modify.
You may want to go ahead and delete the file and reboot.
If it fails, note the file(s) you deleted and know the system is looking for them and then proceed with seeing if you can identify a file in /system/etc that is looking for it's presence.
---------- Post added at 11:59 PM ---------- Previous post was at 11:53 PM ----------
Commands that complete "quietly" mean they were successful.
If you type
# mount | grep oem
After
# mount -o rw,remount /oem
/dev/block/nandi /oem cramfs ro,relatime 0 0
Should have changed to
/dev/block/nandi /oem cramfs rw,relatime 0 0
Click to expand...
Click to collapse
Followed those steps and its still
/dev/block/nandi /oem cramfs ro,relatime 0 0
Apparently the cramfs is a read only filesystem by design.
Vindicoth said:
Followed those steps and its still
/dev/block/nandi /oem cramfs ro,relatime 0 0
Apparently the cramfs is a read only filesystem by design.
Click to expand...
Click to collapse
You need to create an image of the partition, mount the partition on a system with tools to edit it, extract the contents, and re-create the cramfs.
You would need a linux box or linux virtual machine like Virtualbox, or maybe cygwin has the tools. I would just download and burn a Linux LiveISO and run it from VirtualBox, creating a shared folder to get access to the image file (oem partition).
With debian system, you would do
# apt-get install cramfsprogs fusecram
fusecram allow you to mount the cramfs partition on Linux PC via
# mount -t loop cramfsOEM.partition /mnt/workingdir
However since we cannot simply mount the filesystem on the device by plugging into the usb port of the linux machine and mounting from there, we must first create an image (file) of /dev/block/nandi.
> adb shell
# dd if=/dev/block/nandi of=/nandi.img bs=4k
And then copy it to our pc so we can work with the file.
# exit
> adb pull /nandi.orig.img .
Now we can transfer this file to a machine with the requisite cramfs tools to modify the file.
If you look back, I wrote
# mount -t loop cramfsOEM.partition /mnt/workingdir
replace cramfsOEM.partition for nandi.orig.img, or whatever you named it.
Workingdir needs to exist, so
# mkdir /mnt/workingdir
Now you will have to look up cramfsprogs which will allow you to extract the contents to modify. On the Debian or Ubuntu linux machine "/mnt/workingdir" would be the equivalent of "/oem" on your Android device.
However, all this is could very well be for naught, as it is likely the firmware has marked this partition as "signed" so if we try to write back our modified image, the system will fail to boot since the size will be different. On the other hand, the firmware may very well just check to see the partition size is correct. And since you are decreasing the size, the new cramfs image created with a linux box will (should) fit in the old partition.
Fyi, an image file is like a zip file without the compression.
After you modify the cramfs, you can write it back with something like
> adb push cramfs.mod.img /
> adb shell
Then write over the old partition. However, you shouldn't write over a mounted file system so
# umount /dev/block/nandi
Then write over it.
# dd if=/cramfs.mod.img of=/dev/block/nandi bs=4k
Then reboot
# shutdown -r now
And see what happens.
anotherguy19 said:
You need to create an image of the partition, mount the partition on a system with tools to edit it, extract the contents, and re-create the cramfs.
You would need a linux box or linux virtual machine like Virtualbox, or maybe cygwin has the tools. I would just download and burn a Linux LiveISO and run it from VirtualBox, creating a shared folder to get access to the image file (oem partition).
With debian system, you would do
# apt-get install cramfsprogs fusecram
fusecram allow you to mount the cramfs partition on Linux PC via
# mount -t loop cramfsOEM.partition /mnt/workingdir
However since we cannot simply mount the filesystem on the device by plugging into the usb port of the linux machine and mounting from there, we must first create an image (file) of /dev/block/nandi.
> adb shell
# dd if=/dev/block/nandi of=/nandi.img bs=4k
And then copy it to our pc so we can work with the file.
# exit
> adb pull /nandi.orig.img .
Now we can transfer this file to a machine with the requisite cramfs tools to modify the file.
If you look back, I wrote
# mount -t loop cramfsOEM.partition /mnt/workingdir
replace cramfsOEM.partition for nandi.orig.img, or whatever you named it.
Workingdir needs to exist, so
# mkdir /mnt/workingdir
Now you will have to look up cramfsprogs which will allow you to extract the contents to modify. On the Debian or Ubuntu linux machine "/mnt/workingdir" would be the equivalent of "/oem" on your Android device.
However, all this is could very well be for naught, as it is likely the firmware has marked this partition as "signed" so if we try to write back our modified image, the system will fail to boot since the size will be different. On the other hand, the firmware may very well just check to see the partition size is correct. And since you are decreasing the size, the new cramfs image created with a linux box will (should) fit in the old partition.
Fyi, an image file is like a zip file without the compression.
After you modify the cramfs, you can write it back with something like
> adb push cramfs.mod.img /
> adb shell
Then write over the old partition. However, you shouldn't write over a mounted file system so
# umount /dev/block/nandi
Then write over it.
# dd if=/cramfs.mod.img of=/dev/block/nandi bs=4k
Then reboot
# shutdown -r now
And see what happens.
Click to expand...
Click to collapse
Wow that was very detailed. I thought I might have to do something like that. Thanks so much again. I'll try this in the morning since it's getting very late here. I'll go ahead and download a linux livecd tonight.

[Q] [Webtop] Move /osh/usr/share to /preinstall?

Hello everyone!
Is it possible to enlarge free space on /osh by moving the biggest directory (/osh/usr/share) to /preinstall directory to symlink/mount it to previous location?
Thanks!
It should be possible, if you do it right.
Well, something is not right. I moved /usr/lib to /preinstall and symlinked it. Everything is fine!.. until a reboot
I changed /osh/ubuntu.sh, added remount lines from Gentop
/bin/mount -o remount,rw /
/bin/mount -o remount,rw /preinstall
Click to expand...
Click to collapse
but after reboot /preinstall is always "Device is busy".
Can someone help me? This is just a great possibility to get more space for webtop without SD - and it works much faster! If I could free some more space via uninstalling unused apps - I could even install OpenOffice =)
I am told that android partitions are somewhat special/different than what you see on standard linux hard drives.
Maybe an expert can step forward and point us to some good information on how android does things, until then I think trial & error is the only option.
You could try: /bin/mount -o rw,remount /dev/block/mmcblk0p17 /usr/lib
One other thought, it may be possible to create a fstab entry instead of putting a mount command in /osh/ubuntu.sh
tamuin said:
I am told that android partitions are somewhat special/different than what you see on standard linux hard drives.
Maybe an expert can step forward and point us to some good information on how android does things, until then I think trial & error is the only option.
You could try: /bin/mount -o rw,remount /dev/block/mmcblk0p17 /usr/lib
One other thought, it may be possible to create a fstab entry instead of putting a mount command in /osh/ubuntu.sh
Click to expand...
Click to collapse
That's a good idea. Will write back in minutes!
Hi. If you really need more space, best way is to use WebtopToSD apk. I have 14GB for osh with a linuxdisk chroot and it works great.
Send from my Atrix 4G
tamuin said:
I am told that android partitions are somewhat special/different than what you see on standard linux hard drives.
Click to expand...
Click to collapse
Kinda. Yes, the partition layout and partition handling is unusual and unconventional (at least compared to the PC world), but the partition contents (ie. the filesystem) is perfectly normal, exactly what you'd expect to find.
As far as this idea goes, I'd recommend not using the preinstall directly but instead creating a folder on preinstall dedicated to osh. So probably something like this:
Code:
#-- just the first time
mkdir -p /preinstall/osh-lib
cp -a /osh/usr/lib/* /preinstall/osh-lib
rm -rf /osh/usr/lib/*
#-- every time
mount --bind /preinstall/osh-lib /osh/usr/lib
This is just an idea, though it is completely untested.
jisse44 said:
Hi. If you really need more space, best way is to use WebtopToSD apk. I have 14GB for osh with a linuxdisk chroot and it works great.
Send from my Atrix 4G
Click to expand...
Click to collapse
Of course I know that techique =) My goal is to build small and usable Webtop without any SD cards
ravilov said:
Kinda. Yes, the partition layout and partition handling is unusual and unconventional (at least compared to the PC world), but the partition contents (ie. the filesystem) is perfectly normal, exactly what you'd expect to find.
As far as this idea goes, I'd recommend not using the preinstall directly but instead creating a folder on preinstall dedicated to osh. So probably something like this:
Code:
#-- just the first time
mkdir -p /preinstall/osh-lib
cp -a /osh/usr/lib/* /preinstall/osh-lib
rm -rf /osh/usr/lib/*
#-- every time
mount --bind /preinstall/osh-lib /osh/usr/lib
This is just an idea, though it is completely untested.
Click to expand...
Click to collapse
Thank you for your ideas.
So, I must make a conclusion:
1. I forgot to disable load_pia.sh in /system via ADB/Terminal
Code:
$ su
# cd /
# mount -o remount,rw /dev/block/mmcblk0p12 /system
# mv /system/bin/load_pia.sh /system/bin/load_pia.sh.disabled
This prevents mmcblk0p17 mounting to /preinstall
2. I used webtop2sd's mount and mount.orig - and added /preinstall mounting there just befor last mounting attemps of ubuntu.disk
After all everything works like a charm
Uninstalled most of apps, used gnome-appearance-properties to change metacity and gtk2 themes, saved that theme as my own, uninstalled every other theme... The only cons of this techique - still no enough of free space to install OpenOffice, and I decided:
1. to stop with this experiment - as everithing works as I expected;
2. not to symlink folders to /data for OpenOffice - because I will lose everything after first wipe.
If I could resize /osh or /preinstall partition via shrinking /data
I like your idea...
NemeZZiZZ said:
If I could resize /osh or /preinstall partition via shrinking /data
Click to expand...
Click to collapse
Changing the partition sizes has been other devices, see this post:
http://forum.xda-developers.com/showpost.php?p=22157605&postcount=25
I asked if anyone had tried it with the Atrix 4G in this post:
http://forum.xda-developers.com/showthread.php?t=2207918
...but I was strongly cautioned against it, I still might try it someday when I have the time.
Thanks for the info on what you did.
Hello! I already read that before, and I tried to "parted" mmcblk0 - but no success: as I remember, I can't get partition list because of error, and after googling that error I concluded, that partitions are made with error or overlapped.

[Q] HTC One refuses to mount /system as rw

Hi,
I've been Google'ing all over and now am really stuck
I have an HTC One with Android 4.2.2 installed on it and the phone is ROOTED
I want to do something really simple however, due to a puzzling Busybox install I keep getting caught out!
So here's the issue; I want to install Archlinux on the phone in a chroot... documentation is here:
<can't post link>
no probs
Though the issue I'm facing is wget can't resolve host, I try nslookup and get the internal loopback address of the phone "127.0.0.1/localhost".
This seems to be due to no resolv.conf file existing in /system/etc... using information described here:
<can't post link>
I attampted:
Code:
mount -o remount,rw -t yaffs2 /dev/block/<output from mount cmd> /system
mount -o remount,rw /system
mount -o rw,remount /proc /system
these seem to work for a while as "mount" shows /system being rw..... only after a while this seems to revert back to ro?
Additionally if I try installing anything like Busybox from Stephen Stericson the phone just crashes and reboots itself?? - using both "normal" and "smart" install methods.
Busybox X seems to work well for the current runtime, however, after reboot it's gone?
I have absolutely no idea how to solve this as I've been reading and reading and reading and the closest thing I came up with is a watchdog timer mentioned on a Sony handset but then if there is such a thing on my HTC how to find the pid to kill it?
Unfortunately standard *NIX commands don't really seem to work well, ie.
Code:
ps aux | grep watch
so I have no idea how to even begin finding it.
I have tried using various GUI apps additionally which also just reboot the phone when checking the "remount /system rw" option.
Has anyone got any advise or suggestions that could help me win the battle??
Many thanks.
.....well I hope this helps someone now but found an app called: HTC One RW which did the trick!
Busybox installed properly, nslookup worked and now running shell script to install Archlinux

Lilipop (CM12) mounting a filesystem as root (not accessable to any other user)

I have liliopop CM12 installed on my Note3, I have a encrypted partition, which I mount using luks, I have the mount working now with out issues so the encrypted part can be ignored, if any one is interested I can explain how I did what I did and post the actual scripts used.
The problem is that if I su - from juicessh and then mount the partition the partition is mounted, but only the juice su'ed user can see it. I can log this user out and back in and still see it, but only this users sees it.
For instance
$whoami
10211
#su -
0
#exit
$whoami
10211
now if I run:
$su -l --shell /system/bin/sh -c 'mkdir /storage/sdcard2 ; chmod 777 /storage/sdcard2 ; mount -t ext4 /dev/sda1 /storage/sdcard2 ; df ; exit' ; df
Now this will show that /storage/sdcard2 is mounted when I'm root
when I'm non-root (AKA not ID 0) then I do not see the mount.
Now I login as root using sshdroid:
#whoami
root
#df
does not show sdcard2
Lastly via "Root explorer":
does not see anything mount in /storage/sdcard2 either.
So the issue I'm facing is that I can mount a partition as root and access it, but only as the user I mounted it as, in fact what even makes less sense is that root via sshdroid and root via juicessh can not see what the other user did (mount wise), though if I create a root accessible file that is fine. I used to do this is CM11 using the same commands (different mount points do to the OS change) without any issue. It is as if each root user is unique which is fine on the surface, but since I need access to this encrypted partition, only when accessing documents for work, which normally it is not mounted, but once mounted I need it to be accessible as any other sdcard. Any suggestions?
Thanks,
ERIC
Partly working
I got it partly working if I disable "Mount namespace separation", however I still have an issue that /storage/emulated/0 does not exist, until I use a program like Root Explorer, I mean it exists, but the shell script can not change to it (mount point not found exception), I'm assuming this is also something to do with Lilipop, but I'm not sure what or how to resolve it.
ERIC
Hi,
I state that they are not very knowledgeable about linux commands.
I have installed on my SM-G900F ROM cm12 and it works!
I created a second user, but it does not have root privileges.
I would like, however, to know how you can create a secono user with root privileges?
Thanks for the reply

Categories

Resources