Consequences of using apt-get in ubuntu touch

I have just received my BQ Aquaris E4.5 Ubuntu edition. I have been playing around with it and find that it is just what I expected it to be.

One of the great things about it is a full ubuntu stack, including package management. I would like to start using apt-get to install stuff such as htop, python2, openvpn, among others.

However, I have reached the apt-get Unable to write to /var/cache/apt The Package lists or status file could not be parsed or opened error. I understand (Ubuntu Touch using apt-get) that this is due to the "/" partition being mounted as ro, and apt-get needs it to be rw in order to work.

Here (Install with sudo app-get install doesn't work, "Not using locking for read only file /var/lib/dpkg/lock") is how you can work around the problem, with the following command sudo mount -o remount,rw /. <--- May be a bad idea. See evergreen's answer for a more complete and safe way to enable rw mode.

What I would like to know is what are the consequences of mounting "/" as rw. I have read that it will for starters stop the OTA updates, with which I'm perfectly OK as long as I can keep my system up-to-date using apt-get. However, I ave also read (https://askubuntu.com/a/583439/264601) other kinds of horror stories.

So my 2 questions are:

  1. Will I be able to keep my system up-to-date using just apt-get?
  2. Other than disabling OTA updates, what other consequences should I expect?

Thank you very much for your answers!


Solution 1:

To be able to use "apt-get" in ubuntu-touch, for safety I suggest you use the function "Enabling/ Disabling read-write mode".

Once enabled the "read-write mode", this will disable Ubuntu system upgrades.

Howerver you can restore automatic over-the-air updates by disabling the "read-write mode".

"By default the system is read-only. You can switch to read-write mode, although this disables Ubuntu system upgrades.The main purpose for this is developing the Ubuntu system directly. This is not required for developing apps or using the system normally. Recovering from read-write mode is possible but requires reinstalling the system from scratch. Warning: Switching a device to read-write mode (and/or recovering from it) is an advanced feature and may result in complete data loss. Warning: Switching a device to read-write mode disables automatic over-the-air delta updates. Accepting a full over-the-air update after making a device writable may undo changes you have made. "

Firstly, Enabling developer mode on your Ubuntu device. To do this, go to Settings → About this device → Developer mode. (You have to apply the "Lock security" by alternatives: "4-digit passcode" or "Passphrase". Otherwise, with the "swipe" function, you can not enable the "developer mode")

Connect your device into a PC (Assume that's a Ubuntu platform environment).

To verify the connection, use adb to display currently connected devices:

$ adb devices

List of devices attached

025d138e2f521413 device

  1. Install phablet-tools package

Ensure the universe archive is enabled, then:

$ sudo apt-get install phablet-tools

  1. Enabling read-write mode:

$ phablet-config writable-image

The system reboots in read-write mode.

  1. Disabling read-write mode: You can disable read-write and restore automatic over-the-air updates:

$ adb shell rm /userdata/.writable_image

To restore the normally read-write protected system area to a pristine state that does not include any changes you made while in read-write mode by installing the Ubuntu system:

$ ubuntu-device-flash touch --channel=CHANNEL

Sources: https://developer.ubuntu.com/en/start/ubuntu-for-devices/installing-ubuntu-for-devices/#install-options

Advises: Up to now, it's not a good idea to use "apt-get" as they (Mr.Popey) said:

"We don't test apt-get installed scenarios on the phone and if you use apt-get upgrade, you may install packages which haven't yet been fully tested as part of image based updates"

Source: How to install a .deb file in Ubuntu-Touch?

Solution 2:

  1. No (but it will feel like yes for a while)

If you enable rw on / and start modifying it, nothing disables the delivery of OTA updates. So when they arrive, they will be offered to you for install, as before.

However, the OTA process does a very simple thing to the filesystem. It just untars a large set of files on top of the filesystem you have. Since it knows (because it should be ro) the previous filesystem, this is simply a set of the files that have changed.

So you are gambling. Do the changes you have made cause side effects when this happens? In general, yes. In general, you will have modified some file in the / filesystem, and added software that depends on that change. When an OTA is installed, that change will be removed, and potentially replaced with a conflicting change. At this point, what happens next is unknowable, and certainly untested.

So, in practice, some apt-get installs will largely add software in parallel to the existing files, so will not be much impacted by an OTA. However, one file set will certainly be impacted - apt's own record keeping (OTA's deliver the records used in construction of the ro filesystem). So your system will lose the knowledge of what is there, and what is not.

This is the core danger with apt-get upgrade. It will always be performed with an incorrect database of what is on the device, so it cannot be guaranteed to succeed. As your additions become more complex, and as the underlying system makes major transitions (such as when the phones moved from Utopic to Vivid), apt-get run by hand will do the wrong thing.

Every OTA then becomes a gamble, until you perform a wipe & reinstall.

  1. Your system will become slowly broken - see above.