40

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?

8

7 Answers 7

48

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.

5
  • 5
    This solution is still valid after almost 4 years (just tested with Firefox 53 on Ubuntu 17.04). Thanks!
    – Vanni
    Apr 26, 2017 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 7, 2017 at 3:00
  • 2
    Blind one-liner: rm ~/.mozilla/firefox/*.default/{.parentlock,lock}
    – Neapolitan
    Jan 9, 2020 at 22:04
  • 1
    for me the directory was named *-default rather than *.default
    – axolotl
    Feb 28, 2020 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 4, 2021 at 17:35
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)
6
  • 1
    @don_crissti much better!
    – Dchris
    Jun 8, 2013 at 10:44
  • 11
    Or better still is pkill firefox.
    – slm
    Jun 9, 2013 at 0:57
  • If doesn't work, try kill -9 $(pidof firefox) or pkill -9 firefox
    – mavillan
    Sep 4, 2013 at 14:38
  • 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, 2017 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 2, 2020 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.

2
  • 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). Jun 9, 2013 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, 2013 at 19:55
4

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
  • -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, 2017 at 18:13
1

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

2
  • Or you can change profiles.ini file permission to 777
    – kavi temre
    Aug 8, 2016 at 10:05
  • -1 Where is the documentation that profiles.ini prevents Firefox from starting with the OP's stated error message?
    – user66001
    Apr 26, 2017 at 18:11
1

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.

1
  • How do I check this? Dec 17, 2020 at 19:43
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.

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, 2017 at 18:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.