News for hackers. Stuff that matters.
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by JonathanBeuys on Monday November 27, 2023 @03:30AM (#38429645)
My problem with Firefox is that a new Firefox windows can only be launched from the same environment (or only from a child process?) from which the first window has been started. Even the same user who started FF cannot launch a new window from a new shell. That constantly interferes with my workflow.

Example: Say firefox has been started from the Destop already and now I want to start a new Firefox window from a root terminal:

    su desktopuser firefox
It does not work. It gives me "Firefox is already running, but is not responding.".
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by OfSanguineFire on Monday November 27, 2023 @04:09AM (#38429978)
Why are you using root terminals in the first place? This has always been considered poor security practice. Consequently, your workflow is a very peculiar one, and while you personally might feel inconvenience, I don’t think that this frustrates many other Firefox users out there.
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by GTP on Monday November 27, 2023 @04:49AM (#38430347)
He's using 'su' to switch to desktopuser, that's not necessarily, and quite likely not, an account with root privileges. 'su' stands for 'switch user', it's not just to become root.
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by JonathanBeuys on Monday November 27, 2023 @05:32AM (#38430678)
Correct.

I use a script in a root terminal to control a lot of my workflow. One thing is that I start browser windows from it when needed. I start them with

    sudo -u desktopuser chromium example.com
Because

    sudo -u desktopuser firefox example.com
does not work.

I thought that is relevant to the question "Why bother with Chrome".

desktopuser of course is the normal user which would also start Firefox if I did it via the Desktop gui.

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by OfSanguineFire on Monday November 27, 2023 @05:05AM (#38430470)
He uses the term “root terminal”, he writes “Start a root terminal (or a normal one and then ‘sudo su’)”, and he says he only has a single user. One will naturally assume the worst, and in spite of repeatedly posting here he hasn’t exactly made much sense about his workflow and needs beyond launching the browser.
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by GTP on Monday November 27, 2023 @07:13AM (#38431380)
You're right, I missed the root terminal part.
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by gerwim on Monday November 27, 2023 @03:34AM (#38429673)
If you create a new profile for the different user, you can start a second session:

firefox -new-instance -P "Another Profile"

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by JonathanBeuys on Monday November 27, 2023 @03:35AM (#38429686)
I don't have (nor want) multiple users.

I just want to open a new window for my one user.

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by TheCapeGreek on Monday November 27, 2023 @03:53AM (#38429854)
So what's wrong with Super+N? I'm struggling to see the need for a completely new browser instance when you only want another window.
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by magicalhippo on Monday November 27, 2023 @04:20AM (#38430094)
At least on Windows, other processes launching web pages involves launching a browser process with the URL as a parameter.

I used to get the "firefox not responding" all the time on Windows as well, though it has gotten a lot better not long ago.

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by gkbrk on Monday November 27, 2023 @04:08AM (#38429974)
He doesn't want a completely new browser instance, he wants Firefox to open another window but depending on its mood Firefox refuses to do this.

Chrome can do this just fine btw.

Running Firefox from the command line isn't an obscure thing either, clicking a link on other apps like Signal or Telegram also use this method to spawn new tabs/windows. And depending on how you executed the first instance, you run into problems with clicking links on other apps as well.

I pretty much need to open Firefox first before clicking links on other apps, because otherwise I can't run Firefox normally later without killing the process.

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by JonathanBeuys on Monday November 27, 2023 @04:31AM (#38430201)
Exactly.

It seems to be some magic Firefox puts somewhere (In the environment?) that prevents it to launch a new window from a fresh terminal that is not inherited from the same parent that launched the first window.

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by k8svet on Monday November 27, 2023 @04:18AM (#38430073)
No. Sorry. I have a list of complaints with Firefox but this is clearly user error. I do this literally every day for a decade or more. It works fine. It particularly helps to not unnecessarily use things that can affect the env like launching a browser with su. In fact I can I think it a list of things that could go wrong with that.
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by gkbrk on Monday November 27, 2023 @01:57PM (#38436583)
Yes, sorry. This is a Firefox bug and not user error.

On my Linux system, this works with any other browser I try. It only fails with Firefox. If this is user error, it seems every other browser handles user errors much better.

- Firefox: First window is open, running `firefox URL` from the other terminal hangs for 15-20 seconds and then shows the popup "Firefox is already running, but is not responding. To use Firefox, you must first close the existing Firefox process, restart your device, or use a different profile.". No new tabs or windows are spawned.

- Chromium: First window is open, running a `chromium URL` command from the other terminal opens a new tab on the existing window.

- Microsoft Edge: First window is open, running a `microsoft-edge-stable URL` command from the other terminal opens a new tab on the existing window.

- Ladybird: First window is open, running `ladybird` in the other terminal opens a new ladybird window.

- Emacs/eww: First window is open, running `emacs --eval '(eww "example.com")'` on another terminal opens a new browser window.

- Netsurf: First window is open, running `netsurf URL` from the other terminal opens a new netsurf window.

- Dillo: First window is open, running `dillo URL` from the other terminal opens a new dillo window.

- Links/XLinks: First window is open, running `xlinks -G URL` from the other terminal opens a new links window.

You can see a clear pattern. Got any other browsers that refuse to run with a message like that? Or is this not a fault of Firefox, and something super extra that everything from other mainstream browsers to more obscure ones somehow handle for the user?

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by TheCapeGreek on Monday November 27, 2023 @04:34AM (#38430224)
I have never had Firefox do this. I've used all 3 major OS types in the last 5 years and Firefox on all of them. New windows open, no muss no fuss.

>I pretty much need to open Firefox first before clicking links on other apps, because otherwise I can't run Firefox normally later without killing the process.

The only way I imagine this happening is if one doesn't save the browser session between launches, maybe? I've had "cold start" link opens and it just adds another tab to my existing pinned tabs/open tabs/etc.

Everyone has different workflows I suppose.

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by JonathanBeuys on Monday November 27, 2023 @03:54AM (#38429861)
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by iinnPP on Monday November 27, 2023 @04:17AM (#38430056)
Can you do it in an alternate version such as the developers edition?
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by JonathanBeuys on Monday November 27, 2023 @04:36AM (#38430237)
I don't want to install multiple browser versions.

I just want to launch a new browser window.

This does not work:

    sudo -u normaluser firefox example.com
So I do:

    sudo -u normaluser chromium example.com
I thought that was relevant to the question "Why bother with Chrome".
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by Helmut10001 on Monday November 27, 2023 @03:39AM (#38429721)
Use keypirinha [1]. You can type "fir.." hit enter, a firefox window opens. Do it again, and a new firefox window opens.

[1]: https://keypirinha.com/

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by nstart on Monday November 27, 2023 @03:40AM (#38429729)
Curious what use case you are looking at for over here? I don't want to make any assumptions. I'm wondering if what you are looking for might be covered by the functionality of tab containers.
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by JonathanBeuys on Monday November 27, 2023 @03:50AM (#38429815)
I wrote a command line tool which tells me "Now look at the following page" and opens it a browser window with the url.

Works with Chrome, but not with Firefox.

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by p4bl0 on Monday November 27, 2023 @04:40AM (#38430277)
Just use `--new-window` and it will work just fine :).
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by jbreckmckye on Monday November 27, 2023 @04:14AM (#38430037)
Mac or Linux? I think on Mac "open" should Just Work, AFAIK
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by JonathanBeuys on Monday November 27, 2023 @04:24AM (#38430138)
Linux
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by 05 on Monday November 27, 2023 @04:58AM (#38430412)
xdg-open <URL>

Works for me..

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by JonathanBeuys on Monday November 27, 2023 @05:41AM (#38430733)
That would open the url in the default browser (Chromium for me) with the current user (root for me).

The task at hand is to open it in firefox with the desktop user.

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by mariusor on Monday November 27, 2023 @03:51AM (#38429829)
I am probably not understand your use-case correctly but there's a `--new-window` flag on the firefox binary. You can use that to open new windows under the same profile.
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by JonathanBeuys on Monday November 27, 2023 @03:52AM (#38429845)
You can easily try jourself. 1) Have Firefox open 2) Start a root terminal (or a normal one and then "sudo su" 3) sudo -u normaluser firefox --new-window example.com

It will refuse to start.

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by mariusor on Tuesday November 28, 2023 @03:48AM (#38443714)
Erm.... that is a completely different problem.

Do the following: sudo -EHs su, then as root sudo -EH -u {username} firefox --new-window

I'll leave to you the exercise of learning what the flags do, and implicitly why it fails in your case.

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by psychoslave on Monday November 27, 2023 @03:34AM (#38429674)
Can’t you use -P for that kind of case?
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by teddyh on Monday November 27, 2023 @03:35AM (#38429685)
I have very recently begun to see this bug; A workaround is that if you start a new Firefox from a shell on your desktop, then running “firefox” from a shell, even a different shell window, will work fine. I haven’t been able to find out why.
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by JonathanBeuys on Monday November 27, 2023 @03:53AM (#38429857)
Yes, that is exactly what I am experiencing.

You cannot start FF from the Desktop and then start new windows from a shell.

Unless that shell was directly started from the desktop.

So it must have something to do with the environment or process tree.

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by teddyh on Wednesday November 29, 2023 @02:09AM (#38456453)
I found what I think was the problem for me: From the desktop, I was starting Firefox with the “--no-remote” option. If I remove that option, then it works. I did not use that option when starting in a terminal, but if I do, then the same problem appears.
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by albertzeyer on Monday November 27, 2023 @03:46AM (#38429779)
Maybe you need to set the DISPLAY env var? Maybe it tries to contact the app via dbus and fails for some reason?

I'm quite sure this should work, and you just need to set some env var or so.

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by JonathanBeuys on Monday November 27, 2023 @03:48AM (#38429804)
You can easily try jourself. 1) Have Firefox open 2) Start a root terminal (or a normal one and then "sudo su" 3) su normaluser firefox

It will refuse to start.

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by albertzeyer on Monday November 27, 2023 @06:52AM (#38431219)
Did you try what I said? I'm pretty sure you just need to set some env vars right. (Not exactly sure which though. But some Googling should help, e.g. maybe how to setup dbus this way.)
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by crashbunny on Monday November 27, 2023 @03:56AM (#38429882)
this works for me

env -i DISPLAY=$DISPLAY DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS firefox

this doesn't, it gives me the "Firefox is already running, but is not responding." message

env -i DISPLAY=$DISPLAY firefox

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by JonathanBeuys on Monday November 27, 2023 @03:58AM (#38429899)
I'm not sure what you mean. What I try to achieve is start a new firefox window (for the normal user) from a root terminal. So part of the command has to be "sudo -u normaluser" or "su -l normaluser" or something.
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by pmontra on Monday November 27, 2023 @04:07AM (#38429964)
You have to pass those environment variables to Firefox through sudo.

sudo has a --preserve-env=list option but you must know the value for DBUS_SESSION_BUS_ADDRESS. That's usually

  unix:path=/run/user/1000/bus
where 1000 is the id of the user Firefox is running for. Your root console could have no DBUS_SESSION_BUS_ADDRESS or have a different value for it.

To be 100% sure of the value, as you are root you could look into the environment of one of the running Firefox processes. Or wrap Firefox in a script that echoes that variable to a file before starting the browser.

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by JonathanBeuys on Monday November 27, 2023 @04:29AM (#38430181)
Assuming it is "unix:path=/run/user/1000/bus", what would be the command to start Firefox as the normaluser with that setting?
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by pmontra on Monday November 27, 2023 @04:59AM (#38430423)
I didn't test it but probably

  DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus \
  DISPLAY=:1 \
  sudo -H -u normaluser \
    --preserve-env=DBUS_SESSION_BUS_ADDRESS,DISPLAY \
  firefox
I'd add -H to the options of sudo to make it set the home to normaluser's one.

I assumed that your DISPLAY is :1, which is what my Debian has set for me. That's another variable that you could read from the environment of Firefox.

You might have to pass/preserve other environment variables to make Firefox work.

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by JonathanBeuys on Monday November 27, 2023 @05:38AM (#38430711)
Whe don't you test it? It takes less time than to guess and have a back and forth via HN comments.
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by albertzeyer on Monday November 27, 2023 @06:57AM (#38431255)
The parent gave all information which should help you in figuring it out by yourself now. The message it, it should work with the right env vars, and you have multiple example env vars to check for (DBUS related, DISPLAY, etc) and Google for. This is your work now.

(You could also test the extreme case: Just copy all the env vars.)

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by pmontra on Monday November 27, 2023 @06:38AM (#38431118)
Because this is not a support forum or a stack exchange. I give the idea, then all the test and debugging is for who has to actually make the code work.
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by hackideiomat on Monday November 27, 2023 @04:51AM (#38430359)
pass a URL!

su desktopuser

firefox about:blank

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by _flux on Monday November 27, 2023 @04:52AM (#38430370)
I believe --no-remote should get around that if using a separate profile doesn't. Of course, you should ensure the distinct processes are not using the same config/cache files.
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by jorams on Monday November 27, 2023 @05:08AM (#38430499)
To make this work you need to set the XDG_RUNTIME_DIR environment variable to the same value it has in the environment Firefox is running in. For example:

    sudo -u desktopuser XDG_RUNTIME_DIR=/run/user/1000 firefox --new-window
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by JonathanBeuys on Monday November 27, 2023 @05:36AM (#38430704)
Please try this for yourself. It does not work. Gives the same "Firefox is already running, but is not responding." dialog.
Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by jorams on Monday November 27, 2023 @05:49AM (#38430771)
I did try it. It even works from a different VT directly logged in as root if I also specify DISPLAY:

    sudo -u desktopuser XDG_RUNTIME_DIR=/run/user/1000 DISPLAY=:0.0 firefox --new-window
If I now switch back to the VT running my desktop, a new Firefox window has opened.

Maybe your root terminal has other environment variables set that break it? A different DBUS session maybe?

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by JonathanBeuys on Monday November 27, 2023 @06:09AM (#38430904)
Oh wow, you were right! This solves it:

    sudo -u desktopuser XDG_RUNTIME_DIR=/run/user/1000 firefox
Sorry for messing it up the first time I tried!

Man, you solved it!!

Thanks a 1000 times!

Re:Why Bother with uBlock Being Blocked in Chrome? Time to S... by jorams on Monday November 27, 2023 @06:40AM (#38431127)
No problem! Glad it works now.