42

I am trying to open Firefox in CentOS, but I'm getting the following message:

Firefox is already running but is not responding

and Firefox doesn't open. I tried this in command line:

kill Firefox

but it didn't work. Also, I don't know in which directory I must execute the right commands.

How can I fix this?

countermode
  • 7,533
  • 5
  • 31
  • 58
Dchris
  • 833

8 Answers8

55

From http://kb.mozillazine.org/Profile_in_use - Check for:

1) A file called .parentlock
-AND-
2) A symlink called lock
...in ~/.mozilla/firefox/random string of alphanumeric characters.default/

The former is present while Firefox is running to prevent more than one different instance from trying to simultaneously write to the same set of profile files, and if Firefox is not closed cleanly, neither may be removed.

Error message received in this case should be:

From anywhere in the filesystem (or removing this if pwd reports ~/.mozilla/firefox/random string of alphanumeric characters.default), replacing random string of alphanumeric characters with the FF profile folder on your computer, do rm ~/.mozilla/firefox/random string of alphanumeric characters.default/.parentlock ~/.mozilla/firefox/random string of alphanumeric characters.default/lock` (assuming the first sentence pans out) to remove them, if there isn't a Firefox process running.

More less-authoritative information here.

user66001
  • 2,395
  • 5
    This solution is still valid after almost 4 years (just tested with Firefox 53 on Ubuntu 17.04). Thanks! – Vanni Apr 26 '17 at 14:26
  • Should be the answer. I had the problem when another user had logged into firefox, so I couldnt kill the PID.. I had to remove these files.. – dermen Aug 07 '17 at 03:00
  • 2
    Blind one-liner: rm ~/.mozilla/firefox/*.default/{.parentlock,lock} – Neapolitan Jan 09 '20 at 22:04
  • 1
    for me the directory was named *-default rather than *.default – axolotl Feb 28 '20 at 16:45
  • 1
    Or even more nuclear (but potentially necessary if you've created a non-default profile): rm ~/.mozilla/firefox/*/{.parentlock,lock} – hm8 Aug 04 '21 at 17:35
  • Another simple command to run, using GNU find: find ~/.mozilla/ -name '.*lock' -delete – user30747 Jul 26 '23 at 02:20
  • @user30747 This seems rather broad in it's approach. Not sure if any other Mozilla programs (Thunderbird comes to mind) uses the lock file method, and regardless deleting lock files in potentially many profiles may not be what someone reading that comment desires, especially if there was a situation where this was possible while Mozilla programs are running... – user66001 Jul 27 '23 at 08:13
  • With Debian 12 and Thunderbird 115.6.0 finding and removing rm /home/xx/.mozilla/firefox/3thxofg1.default-esr/.parentlock now allows links in emails to work. – cpu Jan 23 '24 at 16:42
25
  1. First find the process id of firefox using the following command in any directory:

    pidof firefox
    
  2. Kill firefox process using the following command in any directory:

    kill [firefox pid]
    

Then start firefox again.

Or you can do the same thing in just one command.As don_crissti said:

kill $(pidof firefox)
Anthon
  • 79,293
Dchris
  • 833
  • 1
    @don_crissti much better! – Dchris Jun 08 '13 at 10:44
  • 11
    Or better still is pkill firefox. – slm Jun 09 '13 at 00:57
  • If doesn't work, try kill -9 $(pidof firefox) or pkill -9 firefox – mavillan Sep 04 '13 at 14:38
  • From experience, -9 is almost always recommended. – schaiba Feb 25 '16 at 10:18
  • 1
    NOTE: The above will not allow Firefox to perform closing operations (like the other pkill/kill options discussed elsewhere on this question, will, as they currently are) and will lead to (amongst other things) the lock symlink not being deleted, which will cause the message in this question to remain. See my answer for more details. – user66001 Apr 26 '17 at 18:17
  • 1
    NOTE: Do not try the above answer on a multi-user system since pidof will list pids belonging to other users' browser sessions. – Jolta Oct 02 '20 at 13:40
4

Usually, many users say this command helps:

killall -SIGTERM firefox

The killall command will killall processes that are named "firefox". SIGTERM is the kill-signal type. This command works well for me and other Linux users. Also, it may help to wait thirty seconds after closing Firefox before it is turned back on.

Devyn Collier Johnson
  • 986
  • 2
  • 10
  • 28
  • 5
    Not really. killall matches the pattern exactly. What you said is valid for pkill: it kills all processes containing that pattern (unless you pass -x in the arguments). For instance, "pkill refox" will kill firefox, but "killall refox" won't do anything (unless you have a "refox" process running). – Rafael Cavalcanti Jun 09 '13 at 16:14
  • NOTE: The above will not allow Firefox to perform closing operations (like the other pkill/kill options discussed elsewhere on this question, will, as they currently are) and will lead to (amongst other things) the lock symlink not being deleted, which will cause the message in this question to remain. See my answer for more details. – user66001 Jun 11 '13 at 19:55
3

open a terminal and enter:

firefox -P

Or using a shell scipt:

#!/bin/bash
files=`find ~/.mozilla -name "*lock"`
for file in `echo $files`
do
  echo "removing $file..."
  rm "$file"
done
  • -1 firefox -P prompts for profile to load, which isn't the issue here. The shell script will remove the files at issue here (hopefully not others in any past/future version of Firefox also). Remove the first suggestion. – user66001 Apr 26 '17 at 18:13
0

If you don't find any firefox instances running when you search with pgrep or htop, and want to force restart your firefox, just delete the profiles.ini file and restart firefox.

Caution: Do this if you do not care about profiles. The file can be found in ~/.mozilla/firefox/ (if this profiles.ini does not make any sense to you, you can go ahead and delete).

terdon
  • 242,166
chinna
  • 17
0

A really easy way is to just open a terminal, run firefox -P, and either delete the user profile that won't run or to just create another profile and set that as your default one.

Michael Mrozek
  • 93,103
  • 40
  • 240
  • 233
  • 1
    -1 If one doesn't care about browsing history, cookies, bookmarks, or anything that happened in previous browsing sessions, this would be a solution. But for the rest of the world this is akin to replacing your new car when it needs a new tire. – user66001 Apr 26 '17 at 18:16
  • This is the only answer that worked, lol – lolololol ol Nov 02 '22 at 18:39
0

If none of the above works, make sure your Firefox profile is owned by your user and not, say, by root. I got this exact error after I copied my profile over from somewhere else, forgetting that I was running in a root shell at the time.

cynthb
  • 9
-1

It can be caused by multiple reasons. Lack of detailed error message, make the problem confusing.

For my case, it is because dbus.

So also try to check if dbus-uuidgen and dbus-launch firefox works on your PC.

neoedmund
  • 147
  • -1 Error message was supplied "Firefox is already running but is not responding". Also, what do those commands do (should explain in the answer so someone can make an informed choice about running them)? – user66001 Jul 27 '23 at 08:09
  • @user66001 What's wrong with you? – neoedmund Jul 28 '23 at 11:03
  • Seriously? Let's keep this to the facts, and not report to personal attacks. I have no idea what these commands do, so per the Stackoverflow guidance on what a good answer is, need to make sure even the most novice person can follow your guidance. – user66001 Jul 29 '23 at 13:02