I am trying to install monitoring agent by running the command
curl -sSL https://agent.digitalocean.com/install.sh | sh
But I am getting the response
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?
I totally have no idea what this is,has anyone come across such issue or knows how to fix this?
Thank you.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
If you are doing this very early in the droplet creation process, eg. from a cloud-init script then the reason might be the fact that DigitalOcean’s local agent is also doing an
apt-get update
right after the droplet comes alive.The solution might be to wait a bit before doing the update or try again a few times until it succeeds.
This error indicates that another process is using the package system (apt). Since this controls the installation and update of software on your platform it’s limited to a single process at a time to prevent it being corrupted.
You can use
ps afx|grep dpkg
to check if there is still a process running at the same time.sudo killall dpkg
will stop all running dpkg processes.sudo rm /var/lib/dpkg/lock
can be used to manually remove the lock if there isn’t any other process using it. This can happen if another process crashed earlier without releasing the lock.As @Cronus89 said, you will have to either run these and your other commands as the “root” user or use
sudo
in front of your command.You either have to run that as root, or prefix the command with sudo