i/o error when trying to write to etc on rooted Xperia Premium - Android Q&A, Help & Troubleshooting

Hi, I'm completly lost. I'm trying to get Daydream running on a Sony Xperia XZ Premium (XZP). I read that 2 files must be modified for this. I already edited the build.prop file in /system. But the second one, the handheld_core_hardware.xml is for some reason not where it should be. I backed up the TA-partion and flashed the firmware "G8141_MobilTel EAD BG_1309-2357_47.2.A.10.62_R2C" with the kernel "boot-G8141-47.2.A.10.62-hideunlock-magisk-19.3.img" following the instructions here on XDA. Using ADB I open a root shell (ADB shell, su) and try to copy a modified version of the XML file from data/local/tmp to system/etc/permissions after re-mounting /system in rw-mode. I got the file by extracting the ext4-image in the system.sin of the firmware pack and pushed it to tmp using ADB. When I try to copy the file, I either get "I/O error" or no error. In the latter case the file is nevertheless not copied and I get the I/O error when mounting to ro-mode again. It's also strange that in this case I can cat the contents and list it via ls -l but only if I use the exact name no wildcards. On next boot or when ro-mounting succeeds its completely gone.
This is how it looks on the shell:
Code:
127|G8141:/system/etc/permissions # ls -l handheld_core_hardware.xml
ls: handheld_core_hardware.xml: No such file or directory
1|G8141:/system/etc/permissions # cp /data/local/tmp/handheld_core_hardware.xml /system/etc/permissions
cp: /system/etc/permissions/handheld_core_hardware.xml: I/O error
1|G8141:/system/etc/permissions # ls -l /data/local/tmp
total 12
-rw-rw-rw- 1 shell shell 4877 2019-09-06 10:03 handheld_core_hardware.xml
drwxr-xr-x 2 root root 4096 2019-09-06 11:47 test
G8141:/system/etc/permissions # mount | grep system
/dev/block/dm-0 on /system type ext4 (rw,seclabel,relatime,block_validity,discard,delalloc,barrier,user_xattr)
/dev/block/sde33 on /system/vendor/firmware_mnt type vfat (ro,context=u:object_r:firmware_file:s0,relatime,gid=1000,fmas
k=0337,dmask=0227,codepage=437,iocharset=iso8859-1,shortname=lower,errors=remount-ro)
/dev/block/sde37 on /system/vendor/bt_firmware type vfat (ro,context=u:object_r:bt_firmware_file:s0,relatime,uid=1002,gi
d=3002,fmask=0337,dmask=0227,codepage=437,iocharset=iso8859-1,shortname=lower,errors=remount-ro)
/dev/block/sde34 on /system/vendor/dsp type ext4 (ro,seclabel,nosuid,nodev,relatime,data=ordered)
/sbin/.magisk/block/system on /sbin/.magisk/mirror/system type ext4 (ro,seclabel,relatime,block_validity,discard,delallo
c,barrier,user_xattr)
G8141:/system/etc/permissions #
What am I doing wrong?
Is there maybe a better way meanwhile to enable Daydream on unsupported devices?
I mean, it's a bad joke, Sony makes this great 4k display but doesn't support VR properly. Daydream even starts and is working just to block the view a second later with a big PopUp telling that the device is not compatible.

Related

[FIXED] Urgent help, how to restore \efs to get lost IMEI ? "Input/output error"

[FIXED] Urgent help, how to restore \efs to get lost IMEI ? "Input/output error"
Greeting,
Tonight I flashed a custom kernel to my phone, just\ lost the Singal and my phone show no sim card inserted!.
anyway, i figure it out that... the IMEI lost.
in \efs there's no nv_data.bin file!!
So i went to restore the \efs.
but something not right here!
Hope someone can help here.
i tried these commands but no chance tel now!.
here to restore nv_data.bin
Code:
su
# cp /sdcard/nv_data.bin /efs/nv_data.bin
cp /sdcard/nv_data.bin /efs/nv_data.bin
[COLOR="red"]cp: can't stat '/efs/nv_data.bin': Input/output error[/COLOR]
and here to restore \efs
Code:
# busybox tar zxvf /sdcard/efs/efs-backup.tar.gz -C /
busybox tar zxvf /sdcard/efs/efs-backup.tar.gz -C /
efs/
efs/cryptprop_rebootMode
[COLOR="Red"]tar: can't remove old file efs/cryptprop_rebootMode: Read-only file system[/COLOR]
#
tried to flash back to many FW but no chance,
now i'm in KF1 rooted.
tried root explorer to copy the files but \efs is read only can can't not be changed!.
Hi.
Sounds like your /efs is mounted read-only, try re-mounting for rw access:
Code:
su
mount -o rw,remount /dev/block/mmcblk0p1 /efs
(either via adb or terminal app running on the phone itself)
and then try to copy the files back again.
If it doesn't want to work from a running system, you can also try it in recovery mode (given you have a recovery that allows you a root shell) - you have to use adb in that case ("adb shell", get a root shell ("rootsh" when you're using CF-Root) and then the above).
Maybe the actual FS on the EFS partition is corrupted, so as a very last resort maybe formatting it and then restoring the full backup might work.
here's what i got
Code:
su
# mount -o rw,remount /dev/block/mmcblk0p1 /efs
mount -o rw,remount /dev/block/mmcblk0p1 /efs
# cp /sdcard/nv_data.bin /efs/nv_data.bin
cp /sdcard/nv_data.bin /efs/nv_data.bin
cp: can't stat '/efs/nv_data.bin': Input/output error
will trey via recovery,
but,, how to format it ?
It's one of the mkfs commands, but at first glance I could only find the ext2 version of it - /efs is (like everything else of the internal partitions on the SGS2) ext4....
Maybe someone else can shed some light if either mkfs.ext2 can be used, or how else to format it ext4.
Also, you should use tar to write back your backup, to keep the proper permissions.
Now i see no nv_data.bin in the /efs
and I couldn't copy the file, it's read only, even with the mount!
I think this is the only solution for me.
Some have restored efs/IMEI by flashing a stock firmware .
jje
Ah, also found this command:
Code:
make_ext4fs
but I have no idea about its parameters....
Yeah, try flashing a stock FW, maybe one of the "_user_low" ones, AFAIK they clean out a bit more stuff....
I got this
Code:
su
# ls
ls
acct fota.rc res
app-cache init sbin
cache init.goldfish.rc sdcard
config init.rc sys
d init.smdkc210.rc system
data init_kernel_only.rc tmp
dbdata lib ueventd.goldfish.rc
default.prop lpm.rc ueventd.rc
dev mnt ueventd.smdkc210.rc
efs proc vendor
etc recovery.rc
# cd efs
cd efs
# ls
ls
[COLOR="Red"]ls: ./nv_data.bin: I/O error
ls: ./nv.log: I/O error
ls: ./nv_data.bin.md5: I/O error
ls: ./dmp: I/O error[/COLOR]
cryptprop_applied_result cryptprop_securewipedata
cryptprop_onetimeboot edk_p
cryptprop_persist.sys.language imei
cryptprop_persist.sys.timezone redata.bin
cryptprop_rebootMode
#
hope this help ?
FIXED...
here's the full Solution http://forum.xda-developers.com/showthread.php?p=15666725#post15666725

[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] swap sd cards in galaxy grand quattro win dual i8552

hi.I read several threads about swap internal sdcard and external card but i couldn't find a solution for galaxy grand quattro win dual i8552.can anyone help me with this issue.is there a way to do swap or not? i try same way of i9082 but no luck
thx from germany berlin
No result...?
I managed to achieve this by the following steps (i hope you know some Unix/Linux)
1) rooting via framaroot - http://forum.xda-developers.com/showthread.php?t=2130276
2) busybox installation via https://play.google.com/store/apps/details?id=stericson.busybox
- normal install should result in links created in /system/bin (take note)
3) enabling init.d via install-recovery.sh - search for it several guides exist, be mindful of the busybox generated alias and adapt to those by the script
- My /system/bin/sysinit
Code:
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
/system/bin/logwrapper /system/bin/run-parts /system/etc/init.d
with permissions :
Code:
-rwxr-xr-x root root 137 2013-07-05 15:52 sysinit
Note the path to run-parts, may differ from some other guide, must be where your busybox install resides
My /system/etc/install-recovery.sh (new file, wasn't there originally)
Code:
#!/system/bin/sh
/system/bin/sysinit
With permissions :
Code:
-rwxr-xr-x root root 37 2013-07-05 15:52 install-recovery.sh
4) generate a init.d script for this via https://play.google.com/store/apps/details?id=eu.codlab.int2ext
- but first follow the app's instructions to at least get it working temporarily before making it permanent via init.d
5) modify the generated init.d script from step 4, by adding a she-bang to the busybox generated alias to sh (important!)
- Mine looks like this in the end, the first line is what i added to the one generated by step 4)
Code:
#! /system/bin/sh
sleep 2
mount -o remount,rw /
mkdir -p /data/internal_sd
mount -o bind /storage/sdcard0 /data/internal_sd
mount -t vfat -o umask=0000 /dev/block/vold/179:33 /storage/sdcard0
mount -o bind /data/internal_sd /storage/[email protected]:/system/etc/init.d
With permissions:
Code:
-rwxr-xr-x root root 242 2013-07-05 15:57 11extsd2internalsd
6) Reboot and remove unused apps install
work?
satanduck said:
I managed to achieve this by the following steps (i hope you know some Unix/Linux)
1) rooting via framaroot - http://forum.xda-developers.com/showthread.php?t=2130276
2) busybox installation via https://play.google.com/store/apps/details?id=stericson.busybox
- normal install should result in links created in /system/bin (take note)
3) enabling init.d via install-recovery.sh - search for it several guides exist, be mindful of the busybox generated alias and adapt to those by the script
- My /system/bin/sysinit
Code:
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
/system/bin/logwrapper /system/bin/run-parts /system/etc/init.d
with permissions :
Code:
-rwxr-xr-x root root 137 2013-07-05 15:52 sysinit
Note the path to run-parts, may differ from some other guide, must be where your busybox install resides
My /system/etc/install-recovery.sh (new file, wasn't there originally)
Code:
#!/system/bin/sh
/system/bin/sysinit
With permissions :
Code:
-rwxr-xr-x root root 37 2013-07-05 15:52 install-recovery.sh
4) generate a init.d script for this via https://play.google.com/store/apps/details?id=eu.codlab.int2ext
- but first follow the app's instructions to at least get it working temporarily before making it permanent via init.d
5) modify the generated init.d script from step 4, by adding a she-bang to the busybox generated alias to sh (important!)
- Mine looks like this in the end, the first line is what i added to the one generated by step 4)
Code:
#! /system/bin/sh
sleep 2
mount -o remount,rw /
mkdir -p /data/internal_sd
mount -o bind /storage/sdcard0 /data/internal_sd
mount -t vfat -o umask=0000 /dev/block/vold/179:33 /storage/sdcard0
mount -o bind /data/internal_sd /storage/[email protected]:/system/etc/init.d
With permissions:
Code:
-rwxr-xr-x root root 242 2013-07-05 15:57 11extsd2internalsd
6) Reboot and remove unused apps install
Click to expand...
Click to collapse
has any1 tried this method yet?
i have the same problem since 1st day bought this phone..
can somebody verify this?
Hey see this thered. http://forum.xda-developers.com/grand-quattro/general/storage-swap-t3302825/post65018893

[Q] Hosts file ressetting on reboot

Does anybody know why my hosts file gets reset after a reboot no matter whether I change with adaway or adblock or if I manually replace the hosts file myself and set to read only. Have searched about and only solution I read about was get a custom kernel. Although I am already on a custom kitkat ROM and using dorimanx kernel for galaxy s2. Also never had problems with hosts resetting on jb or ICS. Even creating a symlink to data/data/hosts doesn't work. On reboot the symlink just gets replaced with the original useless hosts file.
Sorry to bump but it is irritating and can't find a solution.
just some hints,
hosts file is located on /system partition which should be read only mounted during runtime.
check:
Code:
# mount | grep /system
/dev/block/mmcblk0p9 /system ext4 ro,seclabel,relatime,user_xattr,barrier=1,data=ordered 0 0
ro is ok. If so, the file can be changed only during boot (some init script) or later by app with root permission.
check if some init script is not involved:
Code:
# grep hosts /init*
Code:
#grep hosts /system/etc/init.d/*
Is there any output of the commands? I'm on i9100/CM10.2 and there is no output.
Then would be good to revoke root permissions to all apps (not unroot) and see if the issue is still there.
and also check the time of last change of the file:
Code:
ls -l /system/etc/hosts
is it realy during boot?
After spending entirely too much time on this I finally have a working solution. Save the contents of this script to your internal SD card. Ensure the last line is a blank carriage return.
Code:
#!/system/bin/sh
sleep 10
mount -o rw,remount /system
cp /storage/emulated/0/Download/working/hosts /system/etc
Install Script Manager (SManager), and set this script as: on boot, executable, as root. This will then copy your custom "hosts" file under your SDcard to /system/etc after 10 seconds.
Using this script through init.d didn't work for me, which I guess means whatever was over-writing my "hosts" file was doing after the init.d process.
Definitely remount system partition to read only again. Append following line to your script:
Code:
mount -o ro,remount /system
d0gd3v said:
Definitely remount system partition to read only again. Append following line to your script:
Code:
mount -o ro,remount /system
Click to expand...
Click to collapse
good call, thanks

How to auto mount cleanly a partiton on boot

I have a second partition on my SDCARD at /dev/block/mmcblk1p2, all I want to do is ensure that it is always mounted as /storage/sdcard0/mount seems simple I can do it in 5 second on Linux, on Android, it seems impossible I can try to add a hack, but that is lost every-time I update the ROM. There has to be some simple way to do it, that I'm missing. The best I have is to load up a terminal emulated su to root and run: mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard0/mount
Now in theory, the following would work but for 2 things:
mkdir /storage/sdcard0/mount
su - root -c 'mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard0/mount'
But for the fact the Android's su does not understand -c so that is out. as well as the fact that non-root users (u0_a216 in my case) can not access /storage/sdcard0.
All I want is a simple way to ensure that this is always mounted where I want it when I need it, yet this simple task is nearly impossible it appears on Android, so why is that?
The issue here is that the fat32 partition does not support large files so I need a separate partition that does such as ext4, in reality if the external sdcard could just be ext4 there would be no issues, and it would be faster, but that is Android for you.
Any suggestions?
Thanks,
ERIC
Insert mount script to init.d folder...
via XDA Premium
Ok, I have this mostly working with juicessh and tasker now for now
I have 2 shell scripts:
mountDev.sh:
Code:
mkdir /storage/sdcard2
chmod 777 /storage/sdcard2
mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard2
umountDev.sh
Code:
umount /storage/sdcard2
rmdir /storage/sdcard2
In Tasker I have 2 tasks defined:
I'm using the JuiceSSH plugin to open a terminal to localhost I then execute:
To Mount:
Code:
su -l --shell=/system/bin/sh --command='cd /storage/sdcard0 ; sh ./mountDSev.sh ; exit' ; exit
To umount:
Code:
su -l --shell=/system/bin/sh --command='cd /storage/sdcard0 ; sh ./mountDSev.sh ; exit' ; exit
I then created 2 icons, 1 for each operation on the home screen. I also created a Device Boot event to automatically execute and mount the task.
This works, mostly, however even though it is root, sometimes I get errors such as /storage/ is readonly, which makes no sense since it could create the directory at boot, but can not remove the directory later on, since it is readonly. Its a minor thing currently, but annoying.
The benefit of this is it is easy to transfer between ROM images and devices without worrying about it being wiped out every-time I update. In theory it also works without init.d support being enabled. Down side is it you need Tasker and the JuiceSSH plug-in so it costs money.
Hope this helps others.
ERIC

Categories

Resources