I've built Firefox on CentOS and am having trouble setting default preferences. According to the official docs:

  1. Create a JavaScript file in defaults/pref (on Linux) called autoconfig.js

Here is my /tmp/ff-build/bin/defaults/pref/autoconfig.js:

// First line must be a comment
pref("general.config.filename", "mozconfig.cfg");
pref("general.config.obscure_value", 0);
  1. Create a .cfg file (by convention, mozilla.cfg — it can be any file name really; it just has to match what is specified in general.config.filename preference, above) in the program directory.

Here is my /tmp/ff-build/bin/mozconfig.cfg where the only firefox binary is:

// Disable updater
lockPref("app.update.enabled", false);
// make absolutely sure it is really off
lockPref("app.update.auto", false);
lockPref("app.update.mode", 0);
lockPref("app.update.service.enabled", false);

// Disable updater
lockPref("app.update.enabled¨, false);

Firefox will run fine without the autoconfig.js present, but with the configuration above Firefox fails to start with a popup displaying:

Failed to read the configuration file. Please contact your system administrator.

Error message

I've tried copying the mozconfig.cfg to several directories but with no change. How to make Firefox accept the mozconfig.cfg file? Am I misunderstanding the docs?

(Profiles are deleted and recreated so the solution won't involve adding anything to a ~/ based folder. The above is to get default preferences working. Thank you.)

  • You could try specifying an absolute filename as general.config.filename, just to see if it is reading the file. And surround the code with try{ ... }catch(e){ displayError("myerror", e); } – meuh Oct 20 '16 at 13:09
  • I tried as you suggested to set an absolute path to /tmp/ff-build/bin/mozconfig.cfg, and I wrapped it in a try/catch block as suggested. The absolute path didn't work either, and try/catch didn't catch the error. The same generic alert comes up. – Drakes Oct 20 '16 at 18:34
  • Perhaps there is some non-printing spurious character in the .cfg file. Try an empty file, then adding each line one by one till it breaks. strace -e open the binary program to see which files it is opening. – meuh Oct 20 '16 at 19:01
  • @meuh Found a strange ¨ that is supposed to be a ". Try/catch won't catch syntax errors, and there is no developer console. Was a tough one to spot. Thanks for the help. – Drakes Oct 20 '16 at 20:25

The "Failed to read the configuration file. Please contact your system administrator." is a generic failure message. The problem could be in autoconfig.js or in mozconfig.js.

Running strace -e ./firefox as suggested by @meuh showed that Firefox is loading the config file:

open("/tmp/ff-build/bin/mozconfig.cfg", O_RDONLY) = 5

Putting a try/catch in mozconfig.cfg like this doesn't catch any problems, however:

// Disable default browser check
try {
    lockPref("browser.defaultbrowser.notificationbar", false);
    lockPref("browser.shell.checkDefaultBrowser", false);
    lockPref("browser.shell.skipDefaultBrowserCheck¨, true);

    // Disable updater
    lockPref("app.update.enabled¨, false);
} catch(e) {
    displayError("Error", e);

An empty mozconfig.cfg works, however, so a line-by-line removal and test was performed and it was discovered a strange double-quote character: ¨. This is a syntax error, and rightfully the try/catch wasn't invoked.

Normally these kinds of errors would be caught in the developer panel, but that isn't available yet.

Running the script above through jslint reports

Unclosed string.

lockPref("app.update.enabled¨, false);

These are the steps I took to debug and solve that generic error message. I hope these steps help someone else too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.