How to fix “Firefox is already running, but is not responding”

After I manually reboot my Ubuntu machine, when I try running Firefox, sometimes I get the following error:

Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system.

The solution is to delete a hidden mysterious file called .parentlock. This file is typically located under your home directory in the following location.

cd ~/.mozilla/firefox/

You should see a folder with some random name (yours will differ), followed by .default, for example: 06agjsjz.default

Go into that folder:

cd 06agjsjz.default

There should be a file called .parentlock (it’s hidden so type ls -a to see it). Delete it:

rm .parentlock

Start Firefox again and it should work!