Firefox in Ubuntu Touch (Libertine)

Ubuntu Touch is an interesting alternative to Android and iOS. But the most critical app (for me), the browser, is feeling a bit underwhelming. Luckily, it brings a compatibility layer called Libertine to run desktop applications, which means it is relatively straightforward to install a normal desktop firefox. Or so I thought.

Ubuntu famously replaced the regular browser .deb packages with snap ones, and snap isn’t really supported on Ubuntu Touch. So we need to do a few extra steps. Also, I’m going to borrow the firefox mobile config, which originally came from postmarketOS, and is also used in Mobian/Debian.

All of this is tested on a Oneplus 6 with UT 20.04 (‘focal’).

  1. Install a Libertine container from the system settings, this will take a while
  2. In the container settings, add the ppa to get the .deb for firefox: ppa:ubuntu-mozilla-security/ppa
  3. Open a libertine shell (lish, if you installed the Libtertine Tweak Tool), check if apt update && apt install --dry-run firefox wants to download the ppa version
  4. In the container settings, install firefox
  5. Now, opening FF from the app menu should successfully show a (very small) FF window. Close it for now.
  6. Manually download https://packages.debian.org/sid/firefox-esr-mobile-config
  7. Extract the archive (ar x "firefox*.deb"), then tar xf data.tar.xz
  8. Debian uses FF ESR, let’s fix that: mv usr/lib/firefox-esr usr/lib/firefox
  9. Copy to the right places: cp -r usr / && cp -r etc /
  10. touch /etc/mobile-config-firefox/*/*.css
  11. Let’s fix proper touch screen scrolling: echo "MOZ_USE_XINPUT2=1 /usr/bin/firefox $*" > /usr/local/bin/firefox && chmod +x /usr/local/bin/firefox
  12. The default postmarketOS/Mobian config puts the address bar at the bottom. If you don’t like that, here’s how to change it: open /etc/mobile-config-firefox/userChrome/browser.css and comment out the #browser {...} block (helpfully labeled in the comment)

Now, if you open firefox, it should be properly scaled, support touch scrolling, and thanks to the magic of Libertine, the on-screen keyboard works for me as well. Browsing performance is quite good, especially considering that there is no hardware acceleration yet.