The latest Ubuntu Touch image comes with the possibility of creating a Libertine container in which to install and run 'legacy' X11 apps. This feature is not new, since the last image of the mobile OS released by Canonical also had this functionality. What is new however is that with the upgrade to 16.04 the containers that are created are also based on an Ubuntu 16.04 chroot.
In the
previous post I detailed how to install command-line utilities in such a container. In this post I will focus on installing a graphical application, namely Firefox.
Update:
@TartanSpartan on Telegram has brought to my attention a github repo that contains recent builds of Firefox (65 at the time of this writing) for armhf achitecture that have the mentioned bugs patched. The releases can be found at
https://github.com/jdonald/firefox-armhf/releases. Scroll
down for the installation instructions.
Update 2:
Since version 69 the bugs that caused Firefox to crash have been resolved. The package of the latest version available in the repos can be intsalled instead of following the steps in this post.
Installation
One of the first graphical applications many (including me) want to install in a container is the Firefox browser. I mean, imagine having the power of a fully featured browser, including any extensions or plugins that would run on ARM, on your mobile device. Do I hear echos of convergence?
Once the container is created, (for instructions on how to do that, see the
previous post) it should be trivial to install firefox:
$ libertine-container-manager install-package -i xenial -p firefox
Let it finish installing, head over to the Libertine scope and tap on the Firefox icon... And it crashes... 😞
It turns out that there is an unspecified bug that causes all versions of Firefox newer than at least 45 to crash on certain architectures. To date, crashes on i386 and armhf have been reborted. Luckily there is a version 45 of Firefox still available in de Ubuntu repositories for 16.04. So we can try that one. First we remove the current firefox:
$ libertine-container-manager remove-package -i xenial -p firefox
then we install the version we want:
$ libertine-container-manager install-package -i xenial \
-p firefox=45.0.2+build1-0ubuntu1
Once the installation finishes we can try again, and this time Firefox does launch. There are still a few issues to tackle to enhance the user experience though.
Configuration
Because the dpi of the devices is high and the screens are small, the text and icons are minuscule. This is an issue with most X11 applications running in a libertine container, and there are workarounds, for the text at least, but none of them are ideal, and I will not reproduce them here.
However, in the specific case of Firefox, there is an in app setting that will increase the rendering size of the UI. In the address bar enter:
about:config. You might get a warning page about voiding your warranty. Click on "I accept the risk!" and proceed. In the search bar at the top of the resulting page type:
devPix. You should now see the configuration setting:
layout.css.devPixelsPerPx. Edit the value to something between 1.5 and 2. I have it set to 1.75 on my tablet. This give a nice increase in size, without taking up too much extra space and causing items inside pages to overlap.
Now that the controls are big enough for us to be able to tap on them, we need to tackle the annoying behavior that causes every menu or popup screen to open in its own window. Actually, it is more than just annoying, it makes the applications unusable. Good thing this is Linux, so all that is needed is to tweak a config text file somewhere.
The information to do this came from this
post on the UBports forum. But I will recapitulate the instructions below.
First off, make the root filesystem writeable:
$ sudo mount -o remount,rw /
then edit the file at
/usr/bin/libertine-xmir
using
sudo
by changing the line
Xmir -rootless $@
to
Xmir -rootless -flatten $@
exit and save the file. Remember to remount the filesystem read-only returning things to the way we found them:
$ sudo mount -o remount,ro /
Lastly, since we installed an older version of the Firefox package, if and when we update all the packages from the container, Firefox will also be updated to the latest version. To stop this from happening we need to tell the package manager that we want to pin Firefox to the version we have installed. First we need to gain root access to our container. This is achieved with:
$ libertine-container-manager exec -i xenial -c /bin/bash
Some errors will be printed, but these can safely be ignored, and we will be landed in a root shell in the container. Once there type:
# apt-mark hold firefox
and our Firefox package will not be updated. It will not even be able to be removed!
If we should tire of Firefox, or we wnat to delete it to reclaim storage space on the device we can do:
# apt-mark unhold firefox
then exit the container shell. The package can now be removed.
Caveat emptor
Running Firefox on a touch device does not automagically convert it into a touch aware application. Especially scrolling provides a very poor user experience. It should also not be forgotten that we are running a very old version of Firefox in our Libertine container. This could be a security risk, but it is a risk I am willing to accept. I intend to use Firefox for the few websites that refuse to play well with the native browser on the device. Also if the container should be compromised in any way, I could easily delete it and start again with a fresh one, sans any loss of data on the device.
Installing newer versions of Firefox
@TartanSpartan on Telegram brought to my attention a repo containing recent builds of Firefox that do run on armhf. I have had inconsistent results with these builds, so YMMV.
To install any of these deb files do the following:
- Navigate to https://github.com/jdonald/firefox-armhf/releases on your UTouch device.
- Download the version of your choice. Just make sure it is compiled to run on 16.04. I clicked on firefox_65.0+build2-0ubuntu0.16.04.1_armhf.deb as that was the lastest build at the time of this writing.
- Navigate to the Downloads folder in the File Manager app and copy the name of the downloaded file to the clipboard. You really don't want to be typing it out in the next step.
- Next go to the Libertine Manager in the Systems Settings app.
Click on the container you would like to install Firefox in and then click on the + icon in the upper right corner.
Select Enter package name of Debian file. In the edit box type the complete path to the downloaded deb file. In my case that was /home/phablet/Downloads/firefox_65.0+build2-0ubuntu0.16.04.1_armhf.deb. Hit enter or click on OK and the package, including any dependencies, will be installed.