Changing Chromium from snap back to apt .deb package on Ubuntu

In this post, I explain two ways to install Chromium on recent versions of Ubuntu using the apt package manager instead of snap. The post is based on the official Ungoogled Chromium instructions for Ubuntu and a blog post by Andrei Shevchuk

In Ubuntu 19.10, the developers decided to switch Chromium away from the apt packaging system in favour of snapd. I’m not going to argue with their technical reasoning, but my experience as a user has been less than positive. Under snap, Chromium would take about 10 seconds to start. More importantly, it would periodically lose all of my settings: bookmarks, plugins, search engine choices, privacy settings, etc. After the third time this happened, I had had enough and decided to ditch the snap version.

The two possibilities for installing Chromium via deb package on Ubuntu are (a) to use a Ubuntu-specific version from ungoogled_chromium, or (b) to use a version from Debian. Each has its advantages and disadvantages. The ungoogled_chromium version is simpler to set up. It’s also less prone to crashing or otherwise interfering with your system as it’s built for Ubuntu. The downsides are first that you need to install software from a third-party repository, which is less trustworthy than the official Debian or Ubuntu repositories, and second that all of the Google services have been stripped out. Some may consider this second downside to actually be an upside – after all, if you’re using Chromium instead of Chrome, you probably want to avoid Google services.

First Method: Ungoogled Chromium

This method is fairly straightforward. You just need to add the ungoogled_chromium repositories to your apt sources, import the GPG key, and then install Chromium. See the Ungoogled Chromium instructions for Ubuntu. You can also see the Ungoogled Chromium GitHub homepage, and an introductory article on The Register.

Short summary:

sudo -E bash
echo 'deb http://download.opensuse.org/repositories/home:/ungoogled_chromium/Ubuntu_Focal/ /' > /etc/apt/sources.list.d/chromium.list
wget 'https://download.opensuse.org/repositories/home:/ungoogled_chromium/Ubuntu_Focal/Release.key' | apt-key add -
apt update
apt install ungoogled-chromium ungoogled-chromium-l10n

Skip ungoogled-chromium-l10n if you’re happy using the US English version of Chromium.

Second Method: Debian version of Chromium

Andrei Shevchuk put up some information on how to use the stable Debian packaged version of Chromium with Ubuntu 19.10. I adapted these instructions to use Debian unstable with Ubuntu 20.04, and also include some notes on how I adapted the instructions, because the details are package specific and subject to change with time.

Before I begin, a disclaimer: mixing Debian and Ubuntu packages isn’t recommended for stability reasons. Installing Chromium only brings in a few packages and I haven’t had any problems, but you should only follow this guide if you understand what you’re doing. If you break your install, you fix it, don’t blame me!

Set package preferences

Create the file /etc/apt/preferences.d/chromium.pref and put the following contents in it:

Package: *
Pin: origin "deb.debian.org"
Pin-Priority: -10

Package: chromium chromium-common chromium-l10n chromium-sandbox
Pin: origin "deb.debian.org"
Pin-Priority: 999

As with the first method, you can skip chromium-l10n if you’re using the US English version. The package chromium-sandbox is also optional, but apparently recommended.

This tells apt that all packages available in the repositories at deb.debian.org should not be used, except for chromium browser related packages, which should be used in preference to equivalently named packages in the Ubuntu repositories.

Add Debian package repository

Create the file /etc/apt/sources.list.d/debian.list and put the following contents in:

deb http://deb.debian.org/debian/ unstable main

If you prefer, you can use the stable release instead. If you do that, I recommend including the stable-updates and security sections too.

Update packages

Run apt update. If you get a warning about unsigned packages, install the Debian package signing keys with apt install debian-archive-keyring followed by apt-key add /usr/share/keyrings/debian-archive-keyring.gpg and then try updating the package list again.

Check for dependencies

This the slightly trickier part, and it’s where my instructions diverge from Andrei Shevchuk. Chromium depends on a number of libraries, some of which are available in the correct version on Ubuntu, and some of which aren’t. Find out which by running apt --dry-run install chromium chromium-sandbox. You should get an error message saying something along the lines of Error installing chromium: dependency on libre2-7 but it is not installable. For each package listed there, add it to the list of packages to install from Debian instead Ubuntu in /etc/apt/preferences.d/chromium.pref. For example, my version of the preferences file currently looks like this:

Package: *
Pin: origin "deb.debian.org"
Pin-Priority: -10

Package: chromium chromium-common chromium-l10n chromium-sandbox libre2-7 libicu67 libwebpmux3
Pin: origin "deb.debian.org"
Pin-Priority: 999

Check package preferences

Once you’ve identified which packages you need from Debian and set the preferences accordingly, you should run a test. As stated on Andrei’s article, run apt-cache policy chromium linux-base. You should get output something like the following:

chromium:
  Installed: 83.0.4103.116-1
  Candidate: 83.0.4103.116-1
  Version table:
 *** 83.0.4103.116-1 999
        -10 http://deb.debian.org/debian unstable/main amd64 Packages
        100 /var/lib/dpkg/status
linux-base:
  Installed: 4.5ubuntu3
  Candidate: 4.5ubuntu3
  Version table:
     4.6 -10
        -10 http://deb.debian.org/debian unstable/main amd64 Packages
        -10 http://deb.debian.org/debian unstable/main i386 Packages
 *** 4.5ubuntu3 500
        500 http://gb.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        500 http://gb.archive.ubuntu.com/ubuntu focal/main i386 Packages
        100 /var/lib/dpkg/status

Note that chromium comes from the Debian packages, whereas the linux-base package (which is available in both Debian and Ubuntu) is being installed from Ubuntu, as denoted by ***. Assuming that all looks well, you’re now ready to...

Install chromium

apt install chromium chromium-sandbox

After switching to a packaged version of Chromium, it only takes a fraction of a second to launch. I’ve been using it over a month now, and it hasn’t lost any of my bookmarks or settings either.

Add new comment