This is a quick solution to solve the error “Another instance of Certbot is already running”. This error is usually encountered when you attempt to create a new or to renew an SSL certificate on your Linux systems such as Ubuntu, CentOS, Debian, Fedora, or other common server distros.
This message can be posted when you try to run Let’s Encrypt Certbot. The cause could step from any situation that causes one to end up back on the terminal’s command prompt while there is an active instance of Certbot running.
Seeing that Let’s Encrypt Certbot can only have one instance running at a time, you would need to kill the current instance before trying to invoke another one.
How to Fix “Another Instance of Certbot is Already Running”
Kill the Let’s Encrypt Certbot process by doing either of the following:
a) Reboot Your Linux System
This solution may not be practical on a live server so here is a better option:
b) Kill the Certbot Process
Find the Certbot process using the following command:
$ ps -ef | grep certbot
Output
brightwhiz 368020 367989 0 09:27 pts/1 00:00:00 sudo certbot --apache certonly
brightwhiz 368023 368020 11 09:27 pts/1 00:00:03 /usr/bin/python3 /usr/bin/certbot --apache certonly
The process ID is the first number after the user. In the above example that would be (368020 and 368023)
Kill the process(es) using this:
$ sudo kill 368020
Replacing 368020 with your actual process ID.
Run the Certbot command again and you should be able to use it as expected.
What if the Above Fails
In cases where your server may have rebooted unexpectedly during the renewal process, it could be that Certbot is not running but it left some .certbot.lock files behind. Let’s see if they exist and if they do, we remove the lock files.
Check whether there are .certbot.lock files in your system using this command:
$ find / -type f -name ".certbot.lock"
If there are, you can remove them using this command:
$ sudo find / -type f -name ".certbot.lock" -exec rm {} \;
Conclusion
These are the sure methods you can use to fix the “Another instance of Certbot is already running” error message you get when you try to renew an SSL using Let’s Encrypt Certbot on your Linux systems such as Ubuntu or CentOS.
Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.