6 ms·
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
by JonathanBeuys 3y ago
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.".
- deleted 3y ago[deleted]
- gerwim 3y agoIf you create a new profile for the different user, you can start a second session: firefox -new-instance -P "Another Profile"
- JonathanBeuys 3y agoI don't have (nor want) multiple users. I just want to open a new window for my one user.
- TheCapeGreek 3y agoSo 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.
- JonathanBeuys 3y agohttps://news.ycombinator.com/item?id=38429815 https://news.ycombinator.com/item?id=38429815
- iinnPP 3y agoCan you do it in an alternate version such as the developers edition?
- JonathanBeuys 3y agoI 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".
- gkbrk 3y agoHe 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.
- k8svet 3y agoNo. 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.
- gkbrk 3y agoYes, 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?
- magicalhippo 3y agoAt 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.
- psychoslave 3y agoCan’t you use -P for that kind of case?
- teddyh 3y agoI 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.
- JonathanBeuys 3y agoYes, 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.
- teddyh 3y agoI 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.
- Helmut10001 3y agoUse 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/ https://keypirinha.com/
- nstart 3y agoCurious 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.
- JonathanBeuys 3y agoI 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.
- zero_shift 3y agoMac or Linux? I think on Mac "open" should Just Work, AFAIK
- JonathanBeuys 3y agoLinux
- 05 3y agoxdg-open <URL> Works for me..
- JonathanBeuys 3y agoThat 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.
- p4bl0 3y agoJust use `--new-window` and it will work just fine :).
- deleted 3y ago[deleted]
- albertzeyer 3y agoMaybe 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.
- JonathanBeuys 3y agoYou 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.
- albertzeyer 3y agoDid 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.)
- mariusor 3y agoI 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.
- JonathanBeuys 3y agoYou 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.
- mariusor 3y agoErm.... 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.
- crashbunny 3y agothis 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
- JonathanBeuys 3y agoI'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.
- pmontra 3y agoYou 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.
- JonathanBeuys 3y agoAssuming it is "unix:path=/run/user/1000/bus", what would be the command to start Firefox as the normaluser with that setting?
- pmontra 3y agoI 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.
- OfSanguineFire 3y agoWhy 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.
- GTP 3y agoHe'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.
- OfSanguineFire 3y agoHe 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.
- GTP 3y agoYou're right, I missed the root terminal part.
- JonathanBeuys 3y agoCorrect. 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.
- hackideiomat 3y agopass a URL! su desktopuser firefox about:blank
- _flux 3y agoI 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.
- jorams 3y agoTo 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
- JonathanBeuys 3y agoPlease try this for yourself. It does not work. Gives the same "Firefox is already running, but is not responding." dialog.
- jorams 3y agoI 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?
- JonathanBeuys 3y agoOh 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!
- jorams 3y agoNo problem! Glad it works now.