View: 7891|Reply: 18

How do I make Android system on SD card read only?

[Copy link]

4

threads

11

posts

46

credits

Novice

Rank: 1

credits
46
Published in 2015-7-22 18:01:36 | Show all floors |Read mode
Edited by VinzC at 2015-7-24 19:29

Hi.

I've noticed Android (4.4) was installed on my Orange Pi Mini in read-write mode. However the board is meant to be powered off one way or another so I'd like to make the system partitions truly read-only, leaving only the user storage SD card (EDIT: or the filesystem on the data partition) in read/write mode. I've read many tutorials to turn a read-only system into read/write but I'd like the other way around. How can I do that?

Thanks in advance for any hint/information.

1

threads

39

posts

151

credits

Registered member

Rank: 2

credits
151
Published in 2015-7-23 09:22:09 | Show all floors
Change the permissions on the folders to read only?

4

threads

11

posts

46

credits

Novice

Rank: 1

credits
46
 Author| Published in 2015-7-23 20:17:26 | Show all floors
Edited by VinzC at 2015-7-23 20:50

No, it won't suffice. The real issue is that partitions are mounted read/write, which allows the system to write data on the SD card. It has destructive consequences if the power is removed while the system is writing something to the SD card. Linux allows strict read-only mounts, i.e. data on partitions will only be read. So when the power is removed, there's no risk to interrupt write operations because the card is logically never accessed in write mode.

Even if you set all files to read-only, there are still write operations to the SD card that are made by the system. For instance, the mount date, the mount state and various access date/time attribute updates when reading files. So it's not enough to set a read-only status to files.

There's a little more explanations on Stackexchange for the Raspberry PI and Linux.

10

threads

448

posts

5042

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
5042
Published in 2015-7-23 22:01:38 | Show all floors
VinzC replied at 2015-7-23 13:17
No, it won't suffice. The real issue is that partitions are mounted read/write, which allows the  ...

Android system partition is never mounted rw, unless you remout it as rw.
Data partition has to be mounted rw, otherwise your system wont work, it is unclear what exactly you are trying to achieve.
You can easily try to remount data partition ro, go to terminal and run
  1. su
  2. mount -o remount,ro /data
Copy code



1

threads

39

posts

151

credits

Registered member

Rank: 2

credits
151
Published in 2015-7-23 22:03:37 | Show all floors
Yeah, read that - so can't you mount the partitions in Android as read only, like you can in Linux with fstab?  Android is Linux at the end of the day...

4

threads

11

posts

46

credits

Novice

Rank: 1

credits
46
 Author| Published in 2015-7-24 19:16:38 | Show all floors
shwan replied at 2015-7-23 22:03
Yeah, read that - so can't you mount the partitions in Android as read only, like you can in Linux w ...

There's no fstab in Android so it's not as straightforward to "triturate" partitions...

4

threads

11

posts

46

credits

Novice

Rank: 1

credits
46
 Author| Published in 2015-7-24 19:28:18 | Show all floors
loboris replied at 2015-7-23 22:01
Android system partition is never mounted rw, unless you remout it as rw.
Data partition has to be ...

Nope. The system partition that comes with Android 4.4 for Orange Pi (mini) is mounted read/write, I've just checked:
  1. # touch /system/test
  2. # ls -l /system/test
  3. -rw------- root    root     0 2015-07-24 13:21 test
  4. # reboot
Copy code

...
  1. # ls -l /system/test
  2. -rw------- root    root     0 2015-07-24 13:21 test
Copy code
And it survived a reboot. So looks like this android version is properly rooted . I guess there's something to do to prevent that.

10

threads

448

posts

5042

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
5042
Published in 2015-7-24 22:07:17 | Show all floors
VinzC replied at 2015-7-24 12:28
Nope. The system partition that comes with Android 4.4 for Orange Pi (mini) is mounted read/write, ...

There is definitely something very wrong with your Android installation...

4

threads

11

posts

46

credits

Novice

Rank: 1

credits
46
 Author| Published in 2015-7-24 22:56:29 | Show all floors
Edited by VinzC at 2015-7-24 23:03
loboris replied at 2015-7-24 22:07
There is definitely something very wrong with your Android installation...

Eeeerm... this is the stock installation from the procedure I followed that must be wrong then. I followed it to the letter: burnt the SD card with the android image, plugged the card in the Pi and powered the latter up then installed and launched the Terminal emulator for Android . If you can point to something I did wrong in there, please tell me.

Published in 2024-3-17 00:18:20 | Show all floors
Howdy! Do you know if they make any plugins to safeguard against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any recommendations?        exterior cleaning grimsby
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list