4

Recently, my /etc/firefox/syspref.js stopped being applied. Unlike on Windows, where configuration errors results in

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

on my Ubuntu machines, firefox just silently ignores my settings. Launching with the -jsconsole switch reveals

** Preference parsing error (line 1) = non-matching string **

I did not make any changes to my /etc/firefox/syspref.js file. It did work in Firefox 58 and stopped working with the first Firefox 59 version. My file contains

// first line is ignored
lockPref("browser.startup.homepage", "https://example.org/");

What can i do to

  1. temporarily mitigate the problem: Make firefox read my config again?
  2. permanently solve the problem: Prevent firefox from starting with invalid configuration when it encounters syntax errors in my system-wide config?
1

2 Answers 2

3

I found out that you now have to use pref("...","...",locked); instead of lockPref("...","...");.

Example syspref.js (working in Firefox 61 on Linux Mint):

pref("browser.startup.homepage", "http://...", locked);
pref("network.proxy.autoconfig_url", "http://...", locked);
pref("network.proxy.type", 2, locked);
1
  • Thank you this fixed my problems. There is a lot of outdated info out there on the web including it seems mozilla's own docs..?!? I needed to set the default language and preferably lock it. The usual user_pref() or lockPref() / lock_pref() commands weren't working anymore. I ended up using the following which worked : pref("intl.accept_languages", "en-au,en-gb,en", locked); pref("intl.locale.requested", "en-gb");
    – Bastion
    Jun 12, 2019 at 0:51
1

In recent versions, it seems that Mozilla changed the managed preferences again. My syspref.js is ignored in version 98. Now, you have to use the JSON policies

Create a file /etc/firefox/policies/policies.json with some named setting described in the linked GitHub repo, or the original setting name under the a Preferences key:

{
  "policies": {
    "Homepage": {
      "URL": "https://example.org/",
      "Locked": true,
      "StartPage": "homepage-locked"
    },
    "Preferences": {
      "browser.policies.loglevel": {
        "Value": "debug",
        "Status": "locked"
      },
      "browser.tabs.warnOnClose": {
        "Value": false,
        "Status": "default"
      }
    }
  }
}

The application of this way of configuring Firefox can be reviewed in the about:policies page.

2
  • 1
    It still works for me. Maybe yours is a separate issue, not related to the syntax of the file, but your method of installation? I heard Canonical gave up on compiling proper deb packages..
    – anx
    Apr 14, 2022 at 17:17
  • I'm using the deb package from the Linux Mint repository. I haven't modified my syspref.js; it just stopped working after the upgrade to the newest version.
    – Schorschii
    Apr 15, 2022 at 18:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .