I have different versions of Ubuntu VMs for testing purposes. As you may already know, Ubuntu has a feature named Unattended Upgrades, which installs the latest security (and others) updates automatically whenever they are available. It comes installed and enabled by default in the recent Ubuntu versions. While this feature helps to keep the Ubuntu system up-to-date, it also quite annoying some times. When I am about to install a new application as soon as I logged in to my Ubuntu VM, I always get this message:
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
This is because the unattended upgrades process is running in the background and it is downloading and installing the security updates. I can't perform apt operations until this process is complete. This is OK if the update size is small. But If I run the VM after one or two months, the size of the updates is big and it takes really a long time to complete.
It also doesn't let me to reboot or shutdown my system when I am in a hurry. This is what I get if I try to shutdown or restart my Ubuntu system:
A stop job is running for Unattended Upgrades Shutdown (10s / 30 min)
Even I forcibly reboot the system, I get the following error when try to install any applications.
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem errors.
I don't know about you, but it is quite annoying feature for me. This happened to me so many times. Every time, I had to wait several minutes before performing an apt operation. If you're like me and annoyed of this feature, you can disable this feature as described below.
Disable Unattended Upgrades On Ubuntu
To disable unattended upgrades on Ubuntu and its derivatives, run:
$ sudo dpkg-reconfigure unattended-upgrades
Choose No and hit ENTER to disable unattended upgrades.
You can also remove it altogether if you don't want it anymore.
$ sudo apt remove unattended-upgrades
It doesn't remove any other software on your Ubuntu system, so it is safe to remove unattended upgrades package.
From now on, your Ubuntu system doesn't automatically download and install important updates. You have to manually download and install updates once in a while by using commands:
$ sudo apt update
$ sudo apt upgrade
The Unattended Upgrades feature is enabled by default and ran without user's permission. This might be helpful for casual users who wants to keep their system up-to-date without user-intervention. But for testing systems, It is completely unnecessary, so I disabled it in all my Ubuntu VMs.
Related read:
- How To Fix Broken Ubuntu OS Without Reinstalling It
- How To Fix Busybox Initramfs Error On Ubuntu
- How To Fix “E: Could not get lock /var/lib/dpkg/lock” Error On Ubuntu
Thanks for stopping by!
Help us to help you:
- Subscribe to our Email Newsletter : Sign Up Now
- Support OSTechNix : Donate Via PayPal
- Download free E-Books and Videos : OSTechNix on TradePub
- Connect with us: Reddit | Facebook | Twitter | LinkedIn | RSS feeds
Have a Good day!!
5 comments
I removed unattended upgrades months ago out of frustration, with no problems. Now I can upgrade when I want.
Thank you for sharing this. Interestingly it is not an Ubuntu-only feature. Debian has it as well.
And it makes Linux to annoy users as Windows 10 does.
Great tips, thanks! The reason we choose Ubuntu is that we want to fully control our OS, not the opposite. I am not happy with Ubuntu doing this to me.
Thank you thank you thank you.
try installing ubuntu’s own provided raspberry pi (the so called preinstalled images). as soon as you boot pi, its going to believe it hasnt been updated in months. even tho its a fresh system. now with IO rate of a sd card and 1 ghz cortex whatever, good luck waiting 5 hrs before you are allowed to work w/ apt.