Do not use
kill -9 if not absolutely necessary, and most of the time it is not absolutely necessary. Always try
-9) first. See here for more explanation.
I think that your "trouble" killing firefox is a direct result of your
kill -9 (or
pkill -9). Firefox maintains lockfiles in the profile directory. The lockfiles are there to prevent two instances of firefox accessing the same profile at the same time. Normally firefox removes the lockfiles before it terminates. If you
kill -9 firefox then firefox is killed instantly and cannot remove the lockfiles. If you
-9) then firefox can still remove the lockfiles before terminating.
I think this is what happened in your case:
- Firefox is running. Lockfiles in your profile dir.
- You did
pkill -9 -f firefox. Firefox is terminated instanly. Lockfiles still in your profile dir.
- You try to start a new firefox process. The new firefox process sees the lockfiles in the profile directory and thinks that another firefox process is still running and refuses to start. The error message it gives you is really misleading.
- You think firefox was not killed previously and you are confused.
That is why you should not use
kill -9 if not absolutely necessary, and most of the time it is not absolutely necessary.
If you are sure that firefox is killed (check with
pgrep -fl firefox) you can manually remove the lockfiles from your profile. See here for more information.