How to install Gnome extensions in CentOS 8

Updated: October 14, 2019

Several days ago, I reviewed CentOS 8. Overall, the whole thing went well, but there were some snags along the way. Most notably, I had trouble getting the system configured so that I could use Gnome extensions and transform the vanilla, default look & feel of the Gnome 3 desktop, which I find extremely unproductive, into a more classic desktop formula.

There were problems getting Gnome extensions installed, and then the system didn't have the native host connector, and it took a bit of work sorting everything out. Not trivial. Before I give you a full perfect desktop tutorial that I promised, the kind we did with CentOS 7, I'd like to show you all the steps you need to get the Gnome extensions properly configured in the latest edition of this server-cum-desktop distro. After me.

Cannot install Gnome Shell extension - Firefox says corrupt

The first issue occurred when I tried to install the browser extension. If you go to extensions.gnome.org, this is the interface through which you can manage your Gnome Shell extensions. But it requires two components, the browser addon (available for Chrome and Firefox) and the native connector, a rather non-intuitive name for an equally badly named package (chrome-gnome-shell) that allows the browser to interact with the system in the post-Flash era, whatever the protocol change is.

Gnome extension needed

I tried to install the browser extension and got an error:

Gnome extension corrupt

The add-on downloaded from this site could not be installed because it appears to be corrupt.

I tried to do the same from the official Mozilla page, to no avail. Same error.

Official Mozilla site, same results

Solution

Well, the fix to this was rather annoyingly trivial. CentOS 8 had Firefox ESR 60.5.1, and if my memory servers me correctly, this is a version that was affected with the Firefox signing bug, so this explains why some add-ons could not be validated. A system update moved the application version needle up, and on next browser restart, the Gnome Shell extension was installed.

Firefox version

Native connector

The bigger issue was what happened after the second browser launch - and once I had the Gnome Shell extension running. The browser now complained that it could not detect the native host connector.

Native host connector

Although Gnome Shell integration extension is running, native host connector is not detected. Refer documentation for ...

We've seen this many times before. The solution is to install the chrome-gnome-shell package, and Bob's your uncle. Except he's not, because there's no such package available in the distro's repos, including the extended set with EPEL and RPM Fusion, which I've added to the system - note: relevant at the time of writing, might have been resolved in the meantime. Anyway, this leaves us in a lurch.

sudo dnf install chrome-gnome-shell
Last metadata expiration check: 0:00:40 ago on Mon 30 Sep 2019 03:29:48 PM.
No match for argument: chrome-gnome-shell
Error: Unable to find a match

Funnily enough, you can search for extensions using the dnf command-line interface, but even if you install them, they will not show as enabled - not does this subset include all the available entries that you'd normally see through the official Gnome extensions site.

Solution

The fix is to actually configure the chrome-gnome-shell for CentOS 7 on your CentOS 8. Now, this is a hack, and you need to know what you're doing, but it's perfectly doable - and quite safe. The actual fix will be to wait until the package is properly bundled for CentOS 8.

First download the RPM file - this is a direct link to the centos.org repositories. If you want to be 100% sure this is fine, you can extract the downloaded package to see what it contains. You can do this by running:

rpm2cpio downloaded-file.rpm | cpio -id

Next, you want to install the file, which you can do either with dnf or rpm, but you will see an error:

sudo rpm -i chrome-gnome-shell-10.1-4.el7.x86_64.rpm
warning: chrome-gnome-shell-10.1-4.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
error: Failed dependencies:
/usr/bin/python is needed by chrome-gnome-shell-10.1-4.el7.x86_64
gnome-icon-theme is needed by chrome-gnome-shell-10.1-4.el7.x86_64
python-gobject-base is needed by chrome-gnome-shell-10.1-4.el7.x86_64
python-requests is needed by chrome-gnome-shell-10.1-4.el7.x86_64

At this point, you have two options. You can force-install the RPM, or first try to fix the errors. I am going to do the former, and then re-examine the errors.

sudo rpm -i --nodeps chrome-gnome-shell-10.1-4.el7.x86_64.rpm

So once you install the CentOS 7 chrome-gnome-shell, try to run it manually (to verify it actually works), and most likely, you will see this error:

./chrome-gnome-shell
bash: ./chrome-gnome-shell: /usr/bin/python: bad interpreter: No such file or directory

This goes back to the first dependency error (/usr/bin/python). It is an odd one, because CentOS is supposed to include Python, like any distro out there, especially server ones. But if you actually check for the presence of this particular file, you won't find it:

which python
/usr/bin/which: no python in (/home/roger/.local/bin:/home/roger/bin:/home/roger/.local/bin:
/home/roger/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin)

The reason is, CentOS 8 does ship with Python but it does not ship with the /usr/bin/python link to either python2 or python3, so you can manually create the symbolic link. I decided to go with python3, but if that does not work for you, then you can always try the other one.

sudo ln -s /usr/bin/python3 /usr/bin/python

Gnome Shell extension works now

And that's it. The next time you launch the browser and navigate to the official Gnome extensions site, everything should be in order, allowing you to toggle extensions on and off, and change your CentOS Gnome desktop as you see fit.

Gnome extension works now

Conclusion

Here we go, problem solved. You now have the extension working correctly, which in turn allows you to install other extensions and transform the behavior of your Gnome desktop in CentOS 8 to your liking. I believe the niggles in getting this configured will be resolved in the future, but for now, you have the workarounds to install the Gnome Shell extension and then set up the native host connector. Mind, we're doing something a bit risky, as we're using the package from CentOS 7, but it's a relatively simple one. Not advisable for inexperienced users, though.

I hope you find this tutorial useful. We learned quite some, including the fact old bugs (like the Firefox one) can come to bite you a long time after the original issue has been resolved, as distros often ship software with some delay, so an early round of updates is quite prudent. Then, we did some command-line hackery, and we learned about the subtle tricks behind chrome-gnome-shell. That's all for this time. Next, we're gonna do a whole perfect desktop thing.

Cheers.

You may also like: