Unable to lock the administration directory (/var/lib/dpkg/)

My domain is:

I ran this command:
./certbot-auto certonly

It produced this output:
Reading package lists… Done
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

My web server is (include version):
Nginx via serverpilot.io

The operating system my web server runs on is (include version):
Ubuntu 16.04.3 x64

My hosting provider, if applicable, is:
Digital Ocean

I can login to a root shell on my machine (yes or no, or I don’t know):

I’m using a control panel to manage my site (no, or provide the name and version of the control panel):
Server Pilot

Thank you.

Unless you have set it up otherwise, certbot typically requires root to run. You could try prefixing sudo to the certbot command or running it as root.

You can find more information here: https://certbot.eff.org/faq/#does-certbot-require-root-administrator-privileges

1 Like

I ran it as root.

Thank you.

Hi @MikeThomasDev,

Seems another process is stuck trying to install some packages. You need to check what is the process using the lock file and why it is not finishing.

lsof /var/lib/dpkg/lock

Above command will show the program, pid and user using the lock file, then you should figure out whether that process is stuck or not, maybe you will need to kill it but you should do that carefully or it could corrupt the db used by apt-get (apt, aptitude... whatever).

Good luck,

Hey Sahsanu

Thanks, I’ll try that. It’s just a simple one page website, no db. I’ve installed certonly dozens of times on Ubuntu 16.04, not sure why it’s decided to give me a problem now.

Thank you.

When I said db I was not talking about your web site, I was talking about "db" used by your package manager (apt, apt-get, aptitude...) :wink:

Ah thanks, I ran that command you gave me but I have no idea what the output means lol, it’s probably going to be easier for me to just spin up another Digital Ocean server and try again. Thanks for trying.


@MikeThomasDev, if you are unsure, just reboot your server and try again, there is no need to recreate it.

Oh ok, cool, I’ll try that instead, thanks a million!!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.