Unable to modify file permissions.xml, get error Read-only file system
I have a rooted Galaxy S5 SM-G900V, lineage_klte, ARMv7 Processor rev 1 (v71), Kernel: 3.4.113-lineageos #1 SMP, Oreo 8.1 that a friend asked me to modify. I need to modify the platform.xml file to allow the system to write data to the external sd card. I need the ability to modify this file. The current permissions are: rw-r—r— 1 root root, however I am unable to save any modifications. I am unable to modify the file permissions and would like to know how to do so. Note, I am looking how to change the file permissions and not how to or what syntax to use in the xml file, or if it will allow me to have the system recognize the external sd card for saving data. I am perplexed on why I am unable to modify this file.
> adb devices adb shell su drwxr-xr-x 2 root root 560 2013-12-31 21:23 permissions # cd permissions # ls -l -rw-r--r-- 1 root root 9116 2008-12-31 18:00 platform.xml # chmod 755 platform.xml >> chmod: chmod 'platform.xml' to 100755: Read-only file system
So, how do I change the file attributes for platform.xml allowing it to be modified? I thought that there was a hidden immutable attribute on the file but there is not(at least that I can determine). Related question, is there any other website to post this question? Any help is most appreciated.
asked Mar 24, 2019 at 15:08
1 1 1 silver badge 2 2 bronze badges
Try remounting /system with mount -o rw,remount /system
Mar 24, 2019 at 15:12
I get: mount: ‘/dev/block/platform/msm_sdcc.1/by-name/system’ not user mountable in fstab
Mar 24, 2019 at 15:49
Try installing a file manager that can get root access (MiXplorer, Root Explorer, ES File manager, etc), then check if the file manager can access read/write /system
Mar 24, 2019 at 16:02
@Nora you must be trying without root. mount works only with root access. And don’t chmod any system files, you can brick your device. With root, you can edit files without chmod ing or chown ing too.
Mar 24, 2019 at 21:21
I’ve tried that route before, I use Root Explorer and after being granted root access I try to change the permissions and I get a error «Changing permissions was not successful. Please note. » I definitely have root, I can verify using Root Checker Pro.
why is my file system suddenly read only?
Some background: My HTC Desire HD has several issues. The first issue being that I can not connect to it using a USB cable. So I found that I can tell ADB to work over wifi and I was using this method for some time. I am using VISIONary to temproot the device, then I run a terminal on the device and execute:
$ su #setprop service.adb.tcp.port 5555 #stop adbd #start adbd
I then use netcfg to find my device’s IP and finally on my pc I use
adb connect :5555
I am then able to run on my pc
adb shell
and use this shell to do the following:
cd /etc echo 127.0.0.1 localhost >hosts echo some.dnsname.com >>hosts
This is when the second issue comes into play: once in a while (seems related to killing and clearing cache of an app that uses some.dnsname.com — but not always) the hosts file just reverts to an empty file 🙁 Not having the deep knowledge to handle those problems (yet) I just «learned to live with them». A few moments ago, when I went through this process for for maybe the 30th time or so, A new issue decided to make my day more interesting. I tried to modify (overwrite) the hosts file and I get the following message:
cannot create hosts: read-only file system
I tried to read some about it and it seems I need to remount the system in read/write mode. running
mount | grep system
/dev/block/mmcblk0p25 /system ext3 ro,relatime,errors=continue,data=ordered 0 0 none /system/xbin tmpfs rw,relatime,gid=10132 0 0
I need help with:
1) Making my system read write again (what mount/remount command do I need to run?)
2) Understanding what could have caused this new issue.
3) Any ideas on how I can handle the two background issues is also most welcome. thank you for reading.
Android open failed: EROFS (Read-only file system) error
Im having an issue extracting the contents of a zip file to a directory on my SD card. When I debug the app, I can see the error listed as java.io.FileNotFoundException:/ testFile.zip: open failed: EROFS (Read-only file system) error I have already made sure that I the manifest file includes
user2238415
asked Apr 3, 2015 at 18:39
user2238415 user2238415
67 4 4 silver badges 11 11 bronze badges
Please post you post your FileManagement class.
Apr 3, 2015 at 18:52
And post the values of selectedFile and droppedItem, make sure they’re in a place you can legally write.
Apr 3, 2015 at 19:00
selectedItem is an item that I am dragging from a list. It is set by item.getText().toString(); where item is ClipData.Item item = event.getClipData().getItemAt(0); I have not included the fileManagement class because its very, very long.
Apr 3, 2015 at 19:16
You were asked to tell what the value was of selectedItem. Not how you came to it as we have no idea what the path would become. What is the path in selectedItem? And where are you going to store the unzipped files? Exact path please.
Apr 3, 2015 at 19:29
error listed as java.io.FileNotFoundException:/ testFile.zip: . Dont believe you. If you really wanted to save to sdcard then you would see an absolute path there. Not a short file name. And why that leading space?
Apr 3, 2015 at 19:31
1 Answer 1
Log the folder paths and make sure they are pointing to the location that you expect.
Since we don’t have all the relevant code it’s hard to determine exactly what the problem is, or even if there is a problem in the code at all.
I just got a simple example working and tested, using code from Here. Maybe this will help to see a working example to use as a reference in order to make sure that your code is correct.
I used a simple zip file containing two nested folders and a text file hello/secondFolder/hello.txt .
As you can see in the logs, it’s using the virtual sdcard on my device: /storage/emulated/0/ .
Decompress.java (taken directly from the link above):
import android.util.Log; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; /** * * @author jon */ public class Decompress < private String _zipFile; private String _location; public Decompress(String zipFile, String location) < _zipFile = zipFile; _location = location; _dirChecker(""); >public void unzip() < try < FileInputStream fin = new FileInputStream(_zipFile); ZipInputStream zin = new ZipInputStream(fin); ZipEntry ze = null; while ((ze = zin.getNextEntry()) != null) < Log.v("Unzip", "Unzipping " + ze.getName()); if(ze.isDirectory()) < _dirChecker(ze.getName()); >else < FileOutputStream fout = new FileOutputStream(_location + ze.getName()); for (int c = zin.read(); c != -1; c = zin.read()) < fout.write(c); >zin.closeEntry(); fout.close(); > > zin.close(); > catch(Exception e) < Log.e("Unzip", "unzip exception", e); >> private void _dirChecker(String dir) < File f = new File(_location + dir); if(!f.isDirectory()) < f.mkdirs(); >> >
public class MainActivity extends ActionBarActivity < @Override protected void onCreate(Bundle savedInstanceState) < super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String zipFile = Environment.getExternalStorageDirectory() + "/helloWithFolder.zip"; String unzipLocation = Environment.getExternalStorageDirectory() + "/unzipped/"; Log.d("Unzip", "Zipfile: " + zipFile); Log.d("Unzip", "location: " + unzipLocation); Decompress d = new Decompress(zipFile, unzipLocation); d.unzip(); >
04-03 12:11:06.472 19427-19427/com.zipfile.daniel.zipfileextract D/Unzip﹕ Zipfile: /storage/emulated/0/helloWithFolder.zip 04-03 12:11:06.472 19427-19427/com.zipfile.daniel.zipfileextract D/Unzip﹕ location: /storage/emulated/0/unzipped/ 04-03 12:11:06.472 19427-19427/com.zipfile.daniel.zipfileextract V/Unzip﹕ Unzipping hello/ 04-03 12:11:06.472 19427-19427/com.zipfile.daniel.zipfileextract V/Unzip﹕ Unzipping hello/secondFolder/ 04-03 12:11:06.472 19427-19427/com.zipfile.daniel.zipfileextract V/Unzip﹕ Unzipping hello/secondFolder/hello.txt
Verification that it unzipped successfully:
shell@jfltetmo:/sdcard $ cd unzipped shell@jfltetmo:/sdcard/unzipped $ ls hello shell@jfltetmo:/sdcard/unzipped $ cd hello shell@jfltetmo:/sdcard/unzipped/hello $ ls secondFolder shell@jfltetmo:/sdcard/unzipped/hello $ cd secondFolder shell@jfltetmo:/sdcard/unzipped/hello/secondFolder $ ls hello.txt shell@jfltetmo:/sdcard/unzipped/hello/secondFolder $ cat hello.txt hello
Edit: I just tested with a bad zip name and got this error:
java.io.FileNotFoundException: /storage/emulated/0/helloBad.zip: open failed: ENOENT (No such file or directory)
Android Emulator sdcard push error: Read-only file system
I am developing under Android 1.6 (Android SDK 2.1). I create a avd by using avd manager in Eclipse. When I launch this avd, I found that the /sdcard directory’s permisson is «d———«. So I can’t push file to the sdcard. Does anyone know how to solve this problem?
54.3k 26 26 gold badges 112 112 silver badges 144 144 bronze badges
asked Jan 18, 2010 at 3:16
911 2 2 gold badges 8 8 silver badges 8 8 bronze badges
Nov 6, 2016 at 12:41
21 Answers 21
I found this works
$./adb shell $su mount -o rw,remount rootfs / chmod 777 /mnt/sdcard exit
12.7k 11 11 gold badges 55 55 silver badges 78 78 bronze badges
answered Oct 7, 2013 at 9:48
user2002993 user2002993
1,491 1 1 gold badge 9 9 silver badges 9 9 bronze badges
mount: ‘rootfs’ not user mountable in fstab
Jul 31, 2018 at 13:37
su not available for non-rooted device
Sep 20, 2019 at 6:53
Once you started the Emulator from one shell, login to another shell & type
adb shell
You should see # prompt displayed, this is your device(emulator) shell. Now , type following command at adb shell.
mount -o remount rw /sdcard
This will now remount /sdcard with rw(read-write) permission & now you can push your files into /sdcard by using following command from your host shell.
`adb push filename.mp3 /sdcard,`
where filename.mp3 could be any file that you want to push into Android Emulator.
Hope this helps 🙂
61.2k 60 60 gold badges 278 278 silver badges 442 442 bronze badges
answered Jul 21, 2010 at 6:04
471 4 4 silver badges 3 3 bronze badges
Even if remount does not work, see if the link is proper. That is /sdcard -> /mnt/sdcard . If that is properly linked, check the permissions of the directory /mnt/sdcard . If necessary permissions are not there, issue the chmod command to do it. For example # chmod 0777 /mnt/sdcard should work. PS : You don’t need the execution permission normally.
Nov 28, 2012 at 11:07
I had the same problem as @Hissain. I was able to make it work with these commands in stead: mount -o rw,remount rootfs / and chmod 777 /mnt/sdcard . Hope this helps.
Jun 17, 2014 at 21:21
su: not found . mount: Permission denied
Aug 18, 2017 at 12:30
Ensure two things in the AVD manager utility for the emulator:
- SD Card size is mentioned e.g. 512.
- From the Hardware tag, press New and select «SD Card Support» from the drop down menu.
Now, start the emulator. SD Card shall now support writing as well.
answered Oct 9, 2012 at 9:59
291 2 2 silver badges 2 2 bronze badges
Where is hardware tag? i dont see that in Edit Android Virtual device (AVD)
Apr 26, 2013 at 5:12
I see hardware tag for avds which created on command line only.
Apr 26, 2013 at 5:44
Android studio version 0.8.9 and above has a bug creating AVDs.
Workaround
- go to your ADV folder in .android folder and find your AVD config.ini
- open it with a text editor that can handle unix newlines. (Notepad will run the lines together since they don’t have CR-LFs.)
- change hw.sdCard=no to hw.sdCard=yes
this should work for everyone in new builds
12.6k 5 5 gold badges 46 46 silver badges 63 63 bronze badges
answered Oct 31, 2014 at 14:07
afra mehrparvar afra mehrparvar
259 2 2 silver badges 5 5 bronze badges
Thanks for the link, this helped me out. The recommended solution now is to find your AVD config.ini and change hw.sdCard=no to hw.sdCard=yes. This worked for me.
Nov 3, 2014 at 22:37
yes that’s new solution . u welcome 🙂 really happy it helped u . yeah this is vry good solution . because no way one can put even with all this linux codes as long as this issue persist 🙂
Nov 4, 2014 at 14:42
Amazing how much time I just lost because of this. Thanks a lot!
Nov 10, 2014 at 0:33
Maybe it sounds stupid but it worked for me when I had the same problem: delete the created avd and create one again through AVD Manager with a sd card of, for example, 512MB.
Check that both have the correct permissions and if not, try to change them with chmod.
And if everything still fails, repeat the process but creating both avd and sd card manually via terminal:
android create avd -n my_avd -t 7 mksdcard -l e 512M mysdcard.img emulator -avd my_avd -sdcard mysdcard.img
Hope that helps!
answered Mar 14, 2010 at 10:02
Edu Zamora Edu Zamora
1,492 1 1 gold badge 19 19 silver badges 30 30 bronze badges
@AnkitSrivastava You should execute this commands in your terminal (bash, in my case).
Aug 29, 2013 at 12:08
Didn’t need to recreate the AVD, just reboot it.
Feb 12, 2014 at 18:57
Yes. Creating an other type AVD works. Thank you. This fixed an other problem as well. Now I can use the camera.
Oct 2, 2018 at 20:11
I think the problem here is that you forgot to set SD card size
Follow these steps to make it work:
- step1: close running emulator
- step2: open Android Virtual Device Manager(eclipse menu bar)
- step3: choose your emulator -> Edit -> then set SD card size
This works well in my emulator!
7,624 4 4 gold badges 34 34 silver badges 45 45 bronze badges
answered Jul 28, 2013 at 19:03
71 1 1 silver badge 1 1 bronze badge
Make sure that you had given a value which is greater than zero for SD Card size in the Create AVD Window for that particular emulator.
answered Jul 10, 2011 at 12:56
Dipin Narayanan Dipin Narayanan
1,095 6 6 silver badges 19 19 bronze badges
I tried @user2002993 great help but it one place it need to be a little edit so I edited and here what worked for me on Android Studio, emulator android 5.
Go to your adb folder right click on blank area and select «open command window here» or if you installed adb by adb-installer open cmd and type these commands:
adb devices
It should show your emulator number and detail. Then followed command here:
adb shell
Now it should show you prompt #
su mount -o rw,remount rootfs chmod 777 /mnt/sdcard exit exit
Yeah double exit needed, now your prompt of adb shell is gone. Put a file in to your adb folder and give this command and see if it got fixed.
adb push "your file name like : 1.jpg" /sdcard/
adb push "your file name like : 1.jpg" /storage/sdcard/
Now in cmd it shoudl show you transfer time instead of creepy read-only thing
295 1 1 gold badge 3 3 silver badges 13 13 bronze badges
answered Oct 29, 2014 at 11:04
afra mehrparvar afra mehrparvar
259 2 2 silver badges 5 5 bronze badges
and as i see unfortunately .. android studio version 8.10 and above that change a little bit studio structure give this error . i tested with studio 8.09 and there was no such an read-only error google should fix this
Oct 30, 2014 at 11:12
mount -o remount, rw /sdcard
this is the correct way to remount your sdcard using your emulator.
answered Oct 20, 2011 at 23:19
31 1 1 bronze badge
I increased the virtual memory of sdcard up to 512 MB for the emulator and that was enough
answered Jul 21, 2013 at 20:25
user2604908 user2604908
21 1 1 bronze badge

I guess, you didn’t insert memory size at the time of creating avd. you can do that by editing the avd.
answered Jan 30, 2014 at 9:36
Suresh Sharma Suresh Sharma
1,846 22 22 silver badges 41 41 bronze badges
Windows uses backward slashes, linux uses forward slashes.
answered May 18, 2013 at 14:50
1 2 2 bronze badges
sometimes this can cause of a very simple reason, go to your list in eclipse and check whether you have set SDCard size
answered Dec 4, 2013 at 21:44
user1347778 user1347778
I had this problem on Android L developer preview, and, at least for this version, I solved it by creating an sdcard with a size that had square 2 size (e.g 128M, 256M etc)
answered Oct 24, 2014 at 12:34
742 8 8 silver badges 16 16 bronze badges
In adb version 1.0.32 and Eclipse Luna (v 4.4.1).
I found a directory in the avd /mnt/media_rw/sdcard that you can write to using the adb command. adb push /mnt/media_rw/sdcard
There appears to be rw access to this directory.
Hope this helps 🙂
answered Dec 20, 2014 at 5:09
gregrobinz gregrobinz
23 5 5 bronze badges
Alternate way: Dismount the drive (from settings/storage) and re-mount the sdcard also fixes the problem. (verify by moving a file from internal storage to sdcard) In any case, this simple method saved my butt this time 🙂
answered Mar 29, 2015 at 11:00
Raymond Fraikin Raymond Fraikin
- Give any size to Sdcard in Emulator
- unchecked the read only option from c:\user. android\avd -> properties
- push a file through file explorer
- restart the Emulator
It will definitely works
answered Apr 6, 2015 at 12:41
Kamleshwer Purohit Kamleshwer Purohit
357 2 2 silver badges 16 16 bronze badges
With me in the end helped In the emulator to run applications manager and setting permissions for storage.
answered Mar 3, 2016 at 22:01
17 3 3 bronze badges
Try this in a Terminal Emulator as root:
restorecon -v -R /data/media
answered Nov 6, 2016 at 12:26
intrepidis intrepidis
2,890 1 1 gold badge 34 34 silver badges 36 36 bronze badges
In Latest AVD just remove the sd card, it will work as charm. I also faced the same when it has studio managed sd card=512mb, When i selected continue with NO SD Card then its working fine. I am attaching the config.ini file of emulator
AvdId=Pixel_6_Pro_API_28 PlayStore.enabled=false abi.type=x86 avd.ini.displayname=Pixel 6 Pro API 28 avd.ini.encoding=UTF-8 disk.dataPartition.size=4G fastboot.chosenSnapshotFile= fastboot.forceChosenSnapshotBoot=no fastboot.forceColdBoot=no fastboot.forceFastBoot=yes hw.accelerometer=yes hw.arc=false hw.audioInput=yes hw.battery=yes hw.camera.back=virtualscene hw.camera.front=emulated hw.cpu.arch=x86 hw.cpu.ncore=4 hw.dPad=no hw.device.hash2=MD5:a8abfd3536f3d35e4ba2041a7b99f40e hw.device.manufacturer=Google hw.device.name=pixel_6_pro hw.gps=yes hw.gpu.enabled=yes hw.gpu.mode=auto hw.initialOrientation=Portrait hw.keyboard=yes hw.lcd.density=560 hw.lcd.height=3120 hw.lcd.width=1440 hw.mainKeys=no hw.ramSize=1536 hw.sdCard=no hw.sensors.orientation=yes hw.sensors.proximity=yes hw.trackBall=no image.sysdir.1=system-images\android-28\google_apis\x86\ runtime.network.latency=none runtime.network.speed=full sdcard.size=512 MB showDeviceFrame=yes skin.dynamic=yes skin.name=pixel_6_pro skin.path=C:\Users\User\AppData\Local\Android\Sdk\skins\pixel_6_pro tag.display=Google APIs tag.id=google_apis vm.heapSize=384