Recently I have installed Ubuntu Server 20.04 LTS in one of my machines. After the installation, I tried to install some package using apt command and it gave me the following message.
Getting error “Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend”
I couldn’t install the application for around 20 minutes because of this issue. Some other installation is happening in the system and that is preventing my package installation. Since I was the only user in my machine, I am sure that no one else is going to access this machine. Then who is creating this problem ?
The automatic updates are enabled by default in Ubuntu and the system checks periodically for updates. The updates gets installed in the background. Installing updates without delay is good and recommended. But if it blocks our work, we will have to disable the auto updating mechanism and make it manual.
To disable the automatic updates from the command line, we just need to do a simple step.
Edit the following file and update the values from 1 to 0.
sudo nano /etc/apt/apt.conf.d/20auto-upgrades
The default value is 1, we need it update the values to zero to disable the unattended upgrades.
APT::Periodic::Update-Package-Lists "0";
APT::Periodic::Unattended-Upgrade "0";
After making this change, save the file and reboot the machine.
I hope this tip is useful. Feel free to comment if you have any questions.