7

Firefox is broken on a fresh install of Ubuntu 22.04 LTS (Xubuntu) with Firefox 113.0.2, installed by the now default method, from Snap.

When I try to launch Firefox with a profile that is already running, I get an error:

"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."

This problem did not exist with Ubuntu 20.04 (where the default install was managed via apt).

Using Firefox on 20.04, my everyday workflow as a knowledge worker involved starting new instances of Firefox with profiles that were already running on other workspaces.

Now when I run Firefox from the terminal I get the following error:

._. firefox -P default "https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1951491"
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.

Numerous other reports on the matter suggest that the problem can sometimes be that the environment variable $DBUS_SESSION_BUS_ADDRESS is not set, and that the fix can involve simply setting this envar to unix:path=/run/user/$DBUS_SESSION_BUS_ADDRESS/bus. For example, see here, here and here.

My $DBUS_SESSION_BUS_ADDRESS does appear to be set.

._. echo $DBUS_SESSION_BUS_ADDRESS
unix:path=/run/user/1000/bus

._. echo $XDG_RUNTIME_DIR
/run/user/1000

But systemd thinks it is not.

._. sudo systemd --user
Trying to run as user instance, but $XDG_RUNTIME_DIR is not set.

Reports on this problem suggest systemd might be responsible.

But syslog seems to report no problems when Firefox is called. It runs with uid 1000.

When I run SNAPD_DEBUG=1 snap run firefox --profile-manager, Snap also reports that it is using a uid of 1000 but does appear to be have an error:

ATTENTION: default value of option mesa_glthread overridden by environment.

What can I do to get Firefox working properly from its default Snap install on Ubuntu 22.04 LTS, and launch new windows/instances with profiles that are already running?

I cannot simply close the other running window/instance of Firefox, since that would destroy my workflow. Indeed, I usually have multiple windows open with the same profile on multiple workspaces.

To close the other instance would defeat the object of my attempt to launch Firefox with a profile that is already open.(Thanks to @raffa for the suggestion).

Whether my prior habit of launching Firefox multiple times with profiles that were already running did so in a new window in the same running instance or a new window and new instance makes no difference to me: it worked before; now it does not.

1
  • 1
    the mesa_glthread message does not prevent Firefox from working; I have a whole bunch of those each time I run Firefox and it works fine. Also notice it's not an error, just a message ("Attention")
    – Esther
    Jun 1 at 13:37

1 Answer 1

4
sudo systemd --user

Is invoked as the user root(not your current user invoking sudo) without actual root login and therefore, invoked as such, doesn't have an existing user-runtime environment including a runtime-directory ... Therefore, the error you see i.e.:

Trying to run as user instance, but $XDG_RUNTIME_DIR is not set.

Is totally normal and doesn't reflect on your current running invoking user ... What reflects the current state of your current running invoking user, although IMO a strange and a bad idea for just testing the availability of a user runtime-directory (Be prepared to reboot your system or don't try this as your system will become unstable), is:

systemd --user

Which should initiate fine in your case ruling out your concern about the availability of a user runtime-directory or runtime-environment.

Please, see this related answer for more info.

That said, the message you see i.e.:

"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."

Is actually what it means and should be solved as it suggests ... Not limited to Firefox, system and user services take time to exit if they respond and quickly/immediately trying to start another instance might result in such error ... With SNAP installed applications, it's even more complicated in that sense.

What you can do otherwise is to forcefully kill all running Firefox process with e.g.:

pkill -9 firefox

If your SNAP firefox installation is okay, then that should allow you to start a new Firefox instance instantly or otherwise look into fixing your SNAP Firefox installation.

What can I do to get Firefox working properly from its default Snap install on Ubuntu 22.04 LTS, and launch new instances with profiles that are already running?

AFAIK, unfortunately, nothing ... A Firefox profile is locked(Two files lock(symlink) and .parentlock will be placed in the profile's directory for this purpose) when in use by a Firefox process in favor of this process so no other Firefox process can use it to avoid inevitable profile data corruption ... There is no easy(or otherwise) way around that ... Mozilla rules ... Those lock files as can be seen on Mozilla support are a culprit and will prevent a new Firefox instance from running with a profile that has them in its main directory even if they were just left there after a Firefox ungraceful shutdown incident and even if that profile is moved to another machine ... Please, see for example:

There is, however, a slight chance that I misunderstood your requirements and the fact that SNAP applications are indeed different from DEB packages installed through APT in that they run in an isolated(sandboxed) environment which actually alters permissions and changes scopes for their processes ... Depending on whether or not this might be the culprit, there are a couple try-worthy instance and profile related flags ... In particular, the -new-instance and -no-remote flags ... Please, see if they(or others) can help and refer to:

9
  • I neglected to state that closing any existing running instances is not an option. I'll update my answer. The info you provide here is most instructive. Thank you.
    – markling
    Jun 1 at 10:21
  • @markling I updated the answer for that ... I wish it were good news, but ... :-) ... Your best bet, as I see it, is using a different profile for each new instance you wish to run.
    – Raffa
    Jun 1 at 10:52
  • What you say about it not being possible, @Raffa, seems odd, because doing that has been an essential part of my daily workflow as a knowledge user for the last couple of years, using the apt version of Firefox.
    – markling
    Jun 1 at 14:55
  • @markling I believe you but don't know how ... There, might be a way that I don't know of or you might mean opening new tabs in the same main window running under one main process per profile which if you mean this, then yes, Firefox will do this automatically regardless of source installed from SNAP or APT and your command should actually open in a new tab by default unless you changed something or you are running mixed Firefox versions or you are running Firefox in the background or the with --headless option as any of the latter cases will be considered as a separate process.
    – Raffa
    Jun 1 at 15:12
  • @markling Or of course if there is an unresponsive Firefox process in the background that is using a certain profile ... Kindly see what Mozilla support pages say about profile locking ... e.g. support.mozilla.org/en-US/kb/… and support.mozilla.org/en-US/questions/….
    – Raffa
    Jun 1 at 15:14

You must log in to answer this question.

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