Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox cannot open "libgtk-3.so.0". How to circumvent?

I have two CentOS VMs which use Jenkins to run automated tests through firefox. Both have firefox installed. Both versions of firefox are the same (firefox-56.0.1). I do not know if they are both x86_64 or some other type, but whichever they are, they are the same. (I am using the same .tar.bz2 file. I copied it from one instance to the other.)

In one instance, I am able to run firefox. "firefox --headless" returns "*** You are running in headless mode."

After copying the .tar.bz2 file to the other instance and installing firefox, I find that the new instance does not have the same performance. "firefox --headless" returns the following:

XPCOMGlueLoad error for file /usr/local/firefox/libmozgtk.so:
libgtk-3.so.0: cannot open shared object file: No such file or directory
Couldn't load XPCOM.

What might explain this difference? It appears that I did something right in the first instance, but I cannot tell what. Is there some setting that will prevent firefox from trying to use the "libgtk-3.so.0" file? This file does not exist on either instance.

I've seen this question elsewhere, but the answer seems to focus on versions (I know my version has worked in the first instance) and a particular bug that has been backlogged (this bug only bothers me for the new instance).

like image 740
somexp12 Avatar asked Jun 08 '18 20:06

somexp12


2 Answers

Problem solved minutes after asking the question.

Simply run:

yum info gtk3

Check if gtk3 is installed. If not:

yum install gtk3

My old instance had gtk3 version 3.22.10 installed. My new instance had the same available but not installed. I don't recall seeing this in any of the guides to running firefox headlessly, but a search result that I did not originally think worth checking was able to resolve this rather quickly. Credit to the folks at https://forums.fedoraforum.org/showthread.php?310652-Udating-Firefox-fedora-19

For Ubuntu or Debian distros use:

apt-get install packagekit-gtk3-module
like image 115
somexp12 Avatar answered Nov 06 '22 14:11

somexp12


You probably installed the wrong firefox version for 32bit on a 64bit system.

try downloading firefox with this portable installer download-mozilla-portable.sh which should work on a 64bit linux (tested in Ubuntu 19.10)

like image 33
rubo77 Avatar answered Nov 06 '22 14:11

rubo77