Do not use kill -9 if not absolutely necessary, and most of the time it is not absolutely necessary. Always try kill (without -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 kill (without -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.
SIGKILL. – manatwork Mar 7 at 9:52SIGKILLcan't be handled by programs, so they can't perform any cleanup. In the case of Firefox this probably prevents it from getting rid of the profile lock. If you are just trying to terminate firefox normally, useSIGTERM. – njsg Mar 7 at 14:33-9) isSIGKILL, seeman 7 signal.) – njsg Mar 7 at 14:33