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

In this post, I explain how to install Chromium on recent versions of Ubuntu using the apt package manager instead of snap. The post is based on the information at https://shevchuk.co/notes/2019/12/13/install-chromium-on-ubuntu-1910-fr…

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.

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

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:

user@host:~$ apt-cache policy chromium linux-base
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

Add new comment