17

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!

4
  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.
10

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?

  • 3
    This is a very complete answer for how to enable rw mode. But it still doesn't answer my questions, I'm afraid. – Stunts Mar 24 '15 at 14:02
  • @evergreen How do I supposed to run sudo apt-get install phablet-tools for the first time if apt is disabled (because of read-only image) on the phone? – Khurshid Alam May 23 '15 at 4:52
  • @KhurshidAlam That command is supposed to be typed on another machine - as stated in "Connect your device into a PC (Assume that's a Ubuntu platform environment).". It's just to make sure you have all the necessary tools in this environment. – Stunts Sep 22 '15 at 21:58
  • If you don't have Ubuntu installed on your PC, you can build phablet-tools from source: bazaar.launchpad.net/~phablet-team/phablet-tools/trunk/files. 1. Install bzr, using your package manager. For example, on CentOS it will be yum install bzr 2. Clone phablet-tools source: bzr branch lp:phablet-tools 3. Go to phablet-tools directory: cd phablet-tools 4. Install them: sudo python setup.py install Hope it helps all CentOS users, and others (Elementary OS, Linux Mint, Arch Linux, Tails, Debian, openSUSE, Manjaro, Fedora, Zorin, etc.) – Maxim Mazurok Apr 24 '18 at 16:36
0

Mounting read and write permanently only requires 3 lines. I originally tried to follow these instructions on UBPorts but to no avail. No phablet tools necessary.

adb shell
sudo touch /userdata/.writable_image
sudo reboot

change it to r/w just for session

adb shell
sudo mount -o remount,rw /

Change back to r/o permenantly

adb shell
sudo mount -o remount,rw /

Ubuntu touch is normally not intended for apt-get. Desktop apps are generally supposed be used in a libertine container although I haven't set it up. Depending on the model apt-get will clog up the root partition. It is also very possible it can interfere with updates, install conflicting package, or otherwise break your system. But where's the fun if you can't?

I originally used up root space almost immediately and had to use these commands to free up some space, although there should be a more proper symlink to userdata available

sudo mount -o rw,remount /                             
sudo rm -r /var/cache/apt
sudo tune2fs -m 0 /dev/loop0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.