Ubuntu Touch system rw

The purpose of this FAQ is to explain some procedures that can be performed on the phone, why you shouldn’t do them unless you understand them, and how to do things the right way.

Please do read the whole document before proceeding.

What does making a system “r/w” mean? What is it useful for?

The Ubuntu Touch images use multiple partitions. In the standard read-only configuration, the root file system is mounted as read-only, while a number of locations under “/” are bind mounted to locations on the writeable “/userdata” file system.
These writeable locations include “/var/log”, “/home”, and “/opt/click.ubuntu.com”, which is why those locations appeared writeable to you.
The full list of locations that are bind mounted to “/userdata” can be found in the “/etc/fstab” file. The list is fairly large, since a number of much of the traditional Linux software included in the images don’t expect quite as much of the file system to be read-only.

“/etc/fstab” file

“/etc/fstab” file

When you switch set the “/userdata/.writable_image” flag, these locations are still bind mounted to “/userdata”, but the underlying root file system is also mounted “r/w” allowing the entire system to be changed.
You can click here for further information on this subject.

What risks are implied by making my system “r/w”?

To begin with, it lets you modify your system in ways that could render it unusable. If you don’t know what you’re doing, you might find yourself deleting or changing essential files for your phone to work correctly. This could result in your phone not working anymore, and you’ll probably need to flash it back with a working image.
Secondly, it allows you to install software that hasn’t been tested. Again, you could potentially install things that might somehow break your system.
Last, but not least, it could happen that you won’t be able to install OTA (over the air) updates, which provide new features as well as bug fixes for your phone.
The Ubuntu Touch OS has been designed to manage apps installation and updates through click packages (no apt/dpkg).

"apt-get" command denied by lack of permissions

“apt-get” command denied by lack of permissions

Root files should only be modified by OTA updates and not by installing any other type of package.
If you modify the root partition, then you could cause any subsequent OTA to fail and your phone to fail to boot. Please note that there is no other way to receive updates than through the OTAs provided.

Ok, I understand the risks. How do I do it?

It’s actually quite simple.
Remember: from now on, it’s your own responsibility.
You can run from your computer, with your phone plugged:
$adb shell
$sudo touch /userdata/.writable_image
$sudo reboot

When you execute the commands you'll see a screen similar to this one

When you execute the commands you’ll see a screen similar to this one

You can also change this only for the current session:
$adb shell
$sudo mount -o remount,rw /
After rebooting this change will be lost, and the system will mount partitions the usual (ro) way.

I changed my mind now. How do I undo it?

You can disable “r/w” mode and restore automatic OTA updates:
$ adb shell
$ sudo rm /userdata/.writable_image

Command writable_image deleted

Command to remove writable_image

To restore the normally “r/w” protected system area to a previous state that does not include any changes you made while in “r/w” mode, you will need to install the Ubuntu touch image. Please follow the steps described in this article.

How do I keep my system updated?

The only way to continue receiving the OTA updates is by not making changes on your installation partition (that is, not mounting it in “r/w”).

This article aims to offer a wider vision on the modifications that can be made to your Ubuntu phone, and how they can affect its functioning. This way you will have a deeper understanding of what may be happening when the device does not behave as expected if you played with permissions. We hope that you enjoyed this article and found it useful.

We would like to thank the following people for their contribution to this article:

  • AskUbuntu and Ubuntu Phone project collaborators, for their invaluable help.
  • The Canonical team, especially Julia Palandri, for their support and the information provided.
  • Víctor González, BQ Ubuntu Support’s team leader.

BQ and Canonical started working together on Ubuntu products in 2014, as a response to the increasing demand for an Open Source system device by Ubuntu Desktop and smartphone users. We keep working together to improve Ubuntu Touch OS and include new interesting features for our users.