Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updater.sh is not updating user.js #1587

Closed
Opening-Button-8988 opened this issue Nov 19, 2022 · 29 comments
Closed

Updater.sh is not updating user.js #1587

Opening-Button-8988 opened this issue Nov 19, 2022 · 29 comments
Assignees
Labels

Comments

@Opening-Button-8988
Copy link

I am using Arch Linux.

When I execute the updater.sh file, it does nothing. When I run it in the terminal, it shows

This script will update to the latest user.js file and append any custom configurations from user-overrides.js. Continue Y/N? 
y
Status: user.js has been backed up and replaced with the latest version!
Status: Override file appended: user-overrides.js

Updater.sh is in the same location as the user-overrides.js, user.js, updater.bat and everything else that was in the zip file.

I know the .sh file is doing nothing because changes I make in user-overrides.js do not reflect to user.js, which is the intended purpose, right? If there's something I'm missing, please let me know.

@icpantsparti2
Copy link
Contributor

icpantsparti2 commented Nov 19, 2022

Hope I am not stating the obvious, but my first thought is have you placed the updater.sh etc in your firefox profile directory (find that location by opening about:support page in firefox).

(EDIT: or you can specify options shown in the help: ./updater.sh -h, such as ./updater.sh -l -o "$(pwd)/user-overrides.js" to choose profile and use overrides file in current directory, or you can specify profile path with -p option)

also add an entry at the end of your user-overrides.js, something like:

user_pref("_user.js.parrot", "SUCCESS: user-overrides.js");

you can check about:config page in firefox for that pref name when you re-open firefox after the script has run.

When you run the updater script look out for any error messages

# change directory to your firefox profile (edit dir name as required)
cd /home/*/.mozilla/firefox/*.default-release
./updater.sh

Other commands that might help you see what's happening:

# list some files (with permissions/size/date shown) (edit as required):

find /home/*/.mozilla -iregex "^.*/\(prefs.js\|user.js\|user-overrides.js\|updater.sh\)$" -printf '%Y %M %u:%g %#6s %TY-%Tm-%Td %TH:%TM:%.2TS %p\n'

# see if overrides are showing on the end of user.js:

tail user.js

@TheNightRider12
Copy link

TheNightRider12 commented Nov 21, 2022

I too am having this issue. I emptied out my user-overrides to just have
user_pref("_user.js.parrot", "SUCCESS: user-overrides.js");

Ran prefsCleaner, then ran updater.sh. All with Firefox closed, all from the correct directory. When I open Firefox and go into about:config, there is nothing showing up for "_user.js.parrot".

I am on Fedora Linux 37.

Edit: Ran `tails user.js"
I got:

[xx@xx-laptop p1z6mp9m.default-release]$ sudo tail user.js
user_pref("network.cookie.lifetimePolicy", 2);
// 6012: disable SHA-1 certificates
   // [-] https://bugzilla.mozilla.org/1766687
   // user_pref("security.pki.sha1_enforcement_level", 1); // [DEFAULT: 1]
// ***/

/* END: internal custom pref to test for syntax errors ***/
user_pref("_user.js.parrot", "SUCCESS: No no he's not dead, he's, he's restin'!");

user_pref("_user.js.parrot", "SUCCESS: user-overrides.js");

And nothing is showing up when I go into about:config and search for: "_user.js.parrot".

@Thorin-Oakenpants
Copy link
Contributor

nothing is showing

well it should, because the user.js is riddled with them. You should at the very least get to SUCCESS: No no he's not dead, he's, he's restin'!

or do you mean it's not showing SUCCESS: user-overrides.js?

@TheNightRider12
Copy link

It's not showing anything when I search for "_user.js.parrot". It shows as the options when I search: "Boolean" then "Number" then "String". But no text like the other preferences I search for.

Here is what I see:
image

@icpantsparti2
Copy link
Contributor

In the Firefox profile directory, check file owner/permissions with your file manager, or in terminal with ls -ld . *.js *.sh

If you ran the updater with sudo then the user.js will be root/rw and then would not be loaded by the user you run Firefox under. If that then try running the updater again without sudo: ./updater.sh

@Onfroygmx
Copy link

Updater works fine, more a loading file issue:
screenarkenfox

Also backup file is in the backup folder:
image

To close 1589

Onf.

@rusty-snake
Copy link
Contributor

https://github.com/arkenfox/user.js/wiki/3.4-Apply-&-Update-&-Maintain

Put all the relevant files into the root folder of your profile

@TheNightRider12
Copy link

@rusty-snake Yes. I have used user.js before. Everything (updater.sh and prefsCleaner.sh) are in the root directory. I got to that directory by doing into about:profiles finding the currently in use profile, then going into the Root Directory from there. Everything is in there as it should be and has always been.

@earthlng
Copy link
Contributor

so that's 3 people on linux with FF107 having the same issue where FF doesn't load the user.js?

Can you guys test if it loads a very simple user.js and without using the updater/prefscleaner scripts?
something like this fe:

// comment on 1st line

user_pref("_user.js.parrot", "SUCCESS: test test test");

Anyone else have a Linux with FF107 where the user.js is loaded correctly?

I suspect mozilla changed something in their linux release and the user.js isn't loaded correctly or at all.

@2glops
Copy link

2glops commented Nov 22, 2022

Loading of user.js without issue here.
Using the updater/prefscleaner scripts, overrides parrot successfull.
FF 107 Linux Debian (and Nightly)

@earthlng
Copy link
Contributor

earthlng commented Nov 23, 2022

installed a Fedora 37 VM today and FF107 is not even in the repo yet?!?
Anyways, I used the updater to install the user.js and it worked with no problems. The parrot pref (and everything else) showed up in about:config.
I have no idea what the problem is. I think you guys will have to figure it out for yourselves, sorry

@debsidian
Copy link

FWIW, I just ran arkenfox-cleaner.js, updater and prefscleaner on two machines: one running Linux Mint and the other running Fedora. Multiple FF profiles on each. Actual machines, not VMs. I had no problems at all running anything.

@atomGit
Copy link

atomGit commented Nov 23, 2022

works4me - Manjaro

i changed a parrot pref in my user-overrides, ran updater.sh, and about:config reflected the change

@Opening-Button-8988
Copy link
Author

Opening-Button-8988 commented Nov 27, 2022

Apologies for abandoning this thread. It would work only if I ran the file in the terminal (without sudo). Executing the file in the file manager did not work. Yes, the file is definitely in the right place. It could be file/directory permissions, but if that's the case, why would it work in the terminal without sudo but not in the file manager? It could be something to do with the file manager. I'll revisit this when I have the time.

@icpantsparti2
Copy link
Contributor

@Opening-Button-8988, if you execute updater.sh from clicking in a file manager it would not progress past the "Continue Y/N?" confirmation part. However...

(click me) unofficial/unsupported example
You could make another script which calls updater.sh, but you would need to be careful to check that the updater was successful (as you do not see any output info when clicking on it in a file manager).

#!/usr/bin/env bash
# "updater-wrapper.sh" to run arkenfox user.js updater with optional arguments
# you will need to make this executable eg: sudo chmod +x updater-wrapper.sh
# note: for help message listing all "Optional Arguments" run: ./updater.sh -h
./updater.sh -sv

@Opening-Button-8988
Copy link
Author

@icpantsparti2 So the official method is via the terminal? If so, I'll use execute it in the terminal in the future.

I'm not familiar with bash scripting. Just not that skilled at linux yet. Since the official method is via the terminal, there's not much use for me to use the script, but thanks for letting me know there's a way it can be done in the file manager.

Should I close this thread?

@Thorin-Oakenpants
Copy link
Contributor

Should I close this thread?

No. I want to wait for #1595 to be evaluated, and depending on what you penguins say, the wiki could do with some better linux instructions

@Opening-Button-8988
Copy link
Author

Opening-Button-8988 commented Nov 30, 2022

Should I close this thread?

No. I want to wait for #1595 to be evaluated, and depending on what you penguins say, the wiki could do with some better linux instructions

After some testing, I have absolutely no idea what was working before, but it is no longer working anymore.

Previously, I would run the updater.sh in the terminal successfully, but it did not reflect any changes to the user.js. Yes, the user.js and user-overrides.js were in the same folder as updater.sh. I moved them to a separate folder in /Downloads/ just in case something weird was going on with Firefox. It was still not reflecting any changes. I played around with permissions, including running the updater.sh as sudo and as a regular user. Neither worked.

EDIT: I tested it on a separate machine running Linux Mint. I still couldn't get it to work. The updater.sh does update user.js with the latest version online, but does not reflect changes made in user-overrides.js. My best guess is that the overrides are actually working but they're being overwritten by the download script, resetting all changes back to the default.

@atomGit
Copy link

atomGit commented Nov 30, 2022

@Opening-Button-8988 - i might suggest starting over because this isn't making sense

first of all, never run anything using sudo unless it's necessary

  1. delete all the arkenfox stuff you downloaded - if you have a user-overrides.js, rename it temporarily
  2. go here and save the user.js to your FF profile where prefs.js is located (Ctr+S to save the file)
  3. go here and save the updater.sh file in the same directory
  4. open a terminal and cd to your FF profile directory:
    cd "$HOME/.mozilla/firefox/<PROFILE_FOLDER_NAME>"
  5. make updater.sh executable:
    chmod +x updater.sh
  6. run the updater:
    ./updater.sh -c
  7. start FF > about:config > search for '_user'

@Opening-Button-8988
Copy link
Author

Opening-Button-8988 commented Nov 30, 2022

@atomGit Hi, thanks for responding.

I did all that. I even went to a separate machine (Linux Mint). I downloaded the zip from github, extracted the contents, put the contents in a new profile (root directory). I created a user-overrides.js (as an empty document, thus it is definitely .js), and made changes to the user-overrides.js. I just put something like:

user_pref("browser.startup.page", 1);

Keep in mind, I did everything here. The user.js has 0 specified as default. I ran the updater.sh by right-clicking on it, clicking on "Run in Konsole" (I also tried other terminals). I typed "y" and enter following the prompt. It gave me the results:

Status: user.js has been backed up and replaced with the latest version!
Status: Override file appended: user-overrides.js

Yes, all the files are in the correct place. Yes, updater.sh is executable. I'm aware I only need to run files as sudo if it's necessary, but seeing as the file I wanted to work didn't work, I figured running it as sudo might work, cause that works sometimes. But I also ran it as regular user first, which did not work.

@Opening-Button-8988
Copy link
Author

Okay, I figured out what was going wrong. I sincerely apologize for my stupidity.

I was assuming that the changes made in user-overrides.js would change the default values in user.js. I didn't realize user-overrides.js was appended (a word I kept hearing, but it hadn't clicked) to user.js, at the end of the file. This, along with realizing that the appended changes correctly reflect to about:config settings.

Apologies again. I should have known this.

@atomGit
Copy link

atomGit commented Dec 1, 2022

glad you figured it out - this probably should have given us a clue for helping you but i, for one, missed it...

The updater.sh does update user.js with the latest version online, but does not reflect changes made in user-overrides.js.

@TheNightRider12
Copy link

@atomGit That step by step fix guide fixed the issue for me. User.js loaded for me now.

@Opening-Button-8988
Copy link
Author

Opening-Button-8988 commented Dec 1, 2022

Update: I'm having an issue changing a specific user pref which is stubborn to changing from the user.js.

The pref is browser.search.widget.inNavBar. I have it listed in user-overrides.js as;

user_pref("browser.search.widget.inNavBar", true);

It's been correctly reflected in user.js. However, no such preference exists in prefs.js. Yes, I had the profile offline when I made the changes, I ran updater.sh and prefscleaner.sh successfully. After doing so, I launched the profile, and the changes were not reflected in about:config nor prefs.js, even after relaunching several times. The pref just won't change for some reason, while other prefs do.

As an experiment, I used a minimal user.js with just the line above, but it still does not update prefs.js, nor about:config, nor does the change have the desired effect. I can confirm that other prefs do work (I tested one other pref and it worked).

Any advice?

Separate question: I have discovered that RFP is responsible for websites defaulting to light theme. Is there a workaround? I'd like to be able to use dark theme where possible, but I'm not about to disable RFP.

@atomGit
Copy link

atomGit commented Dec 1, 2022

@TheNightRider12 - when you originally downloaded the user.js, exactly how did you do it?

@TheNightRider12
Copy link

@atomGit When I originally did it, I downloaded updater.sh, put it into the root directory. Also downloaded prefsCleaner.sh, put it in the same directory (root folder in my profile). Then made a user-overrides.js and added my stuff. Then I ran ./updater.sh. I do not think I used sudo when I did it originally.

@atomGit
Copy link

atomGit commented Dec 1, 2022

right, but where, exactly, did you download it from - did you go here, right-click user.js and save as..?

or did you go here and copy it?

or did you go here and copy/save it?

or did you download the whole repo?

or...

@Thorin-Oakenpants
Copy link
Contributor

Thorin-Oakenpants commented Dec 2, 2022

Update: I'm having an issue changing a specific user pref which is stubborn to changing from the user.js.

Not all prefs are guaranteed to apply cleanly. Some are runtime (i.e they are set based on other values) and with quantum or just after they moved a lot of pref reading/setting to later in the process in their faster startup patches. Some cause issues when you try and use lock or other commands. Also check out #1582 and the related bugzilla - my best guess is it's something similar to this, where by the time the pref is read, the fast startup has already painted/drawn itself and it gets reset

user.js is not a high priority - they prefer policies for these sorts of things - and browser.search.widget.inNavBar is not an arkenfox pref. If you want it fixed, file a bugzilla

Edit: can't be bothered to find the issue, from well before dFPI - but we had the same kind of issue with setting cookie behavior via user.js (in some cases), and the solution was to also set ETP to "custom". When upstreamed the answer was a wontfix, especially since enterprise policies was already patched/covered

@TheNightRider12
Copy link

@atomGit So I did not download user.js myself. I downloaded updater.sh and prefsCleaner.sh. Then made my own user-overrides. Then let the updater.sh script download user.js and do everything else. That was originally when I first installed it to my firefox profile a few months back.

earthlng added a commit that referenced this issue Apr 22, 2023
* updater.sh/prefsCleaner.sh: Check for root and abort

Check if running as root and if any files have the owner/group as root|wheel.
Abort on both.

Should (hopefully) prevent stuff like: #1587
Discussion: #1595

---------

Co-authored-by: Mohammed Anas <triallax@tutanota.com>
Co-authored-by: earthlng <earthlng@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

10 participants