Ubuntu Touch, read-only mobile devices?
What does it mean that the Ubuntu installation is read-only on mobile devices and how is that possible? In this chapter, we'll discuss the Ubuntu Touch configuration environment using the original tutorial published by BQ company. 
This article aims to offer a wider vision on the modifications that can be made to your Ubuntu phone. With this knowledge, you may also gain an understanding of what is going on when your device is not working as expected.
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 writable “/userdata” file system.
These writable locations include “/var/log”, “/home”, and “/opt/click.ubuntu.com”, which is why those locations appear writable to you. The full list of locations that are bind mounted to “/userdata” can be found in the “/etc/system-image/writable-paths” (manual page) file.
When you create the file "/userdata/.writable_image", these locations are still bind mounted to “/userdata”, but the underlying root file system is also mounted “r/w”. This allows the entire system to be changed.
What risks are implied by making my system "rw"?
Being able to write to your system image (root filesystem) gives you the power to break it. If you don’t know what you’re doing, you might find yourself deleting or changing files required for your phone to work correctly. This could result in your phone failing to boot. If that happens, you will need to use UBports Installer to install a working image. You may or may not need to wipe all of your user data.
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. We are not aware of any cases where this has occurred in practice, but it is still possible. Keep in mind that Ubuntu Touch has been designed to manage app installations by means of click packages rather than by the more common apt/dpkg updates found in other Ubuntu systems.
Your changes to the root filesystem may be overwritten on an OTA update.
Ideally, the root filesystem 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 but caution: after proceeding further, it’s your own responsibility and the power to break your phone is in your hands. You can run the following commands from your computer, with your phone plugged in and in developer mode:
$ adb shell
$ sudo touch /userdata/.writable_image
$ sudo reboot
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 read-only way.
I changed my mind! How do I undo it?
You can disable “r/w” mode and restore automatic OTA updates. Issue these commands and reboot:
$ adb shell
$ sudo rm /userdata/.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.
We would like to thank the following people for their direct or indirect contributions 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.
First published: 2017/05/03
Last update: Version: 0.8, published 2017/08/25
What's new in the latest version:
Fixed bug that allowed to skip the authentication dialogue by pressing escape
Requiring login is now optional
Web address / Source Code: Terminal
Licence: GNU GPL v3
Permissions: Copyright © 2017
Original language: English
Translated to: -
What do you think of this app?
Please send your comments and suggestions through the box at the bottom of this blog.
Explore the full spectrum of Ubuntu Touch Apps at OpenStore - The official Ubuntu Touch app store.