How to Disable Unattended Upgrades in Ubuntu (and Why You Should)
Ubuntu comes with unattended-upgrades enabled by default. This service automatically installs security updates in the background. While it sounds convenient, in practice it can cause unexpected downtime or service interruptions — especially on production servers.
In this article, we’ll explain why you may want to disable unattended upgrades and show multiple ways to do it safely.
Why Disable Ubuntu Unattended Upgrades?
Automatic background updates may sound like a good idea, but they often lead to issues in production environments. Some common problems include:
MySQL stops during upgrade
During an automatic update, the mysql-server package may be restarted, causing database downtime. This can break websites and applications that depend on MySQL/MariaDB.
👉 Many admins search for:
- “mysql stopped after unattended upgrade ubuntu”
- “unattended-upgrades mysql downtime”
Services freeze or fail to restart
Critical services such as nginx, Apache, or Redis can hang if they are updated in the background. The system may try to restart them automatically — sometimes it fails, leaving your application offline.
👉 People often google:
- “nginx down after unattended-upgrades”
- “ubuntu unattended upgrade broke apache”
System reboots at unexpected times
If kernel updates are applied automatically, Ubuntu may reboot to complete the installation. On production servers, this leads to unplanned outages.
👉 Common searches:
- “ubuntu auto reboot after unattended upgrades”
- “disable unattended upgrades reboot”
Locks and apt conflicts
Unattended-upgrades often hold the APT lock, preventing you from running apt update or apt upgrade manually. This is frustrating when you need to patch something quickly.
👉 Search terms:
- “Could not get lock /var/lib/dpkg/lock-frontend unattended upgrades”
Method 1: Remove the Package
The simplest way is to uninstall it completely:
sudo apt remove unattended-upgrades -y
This ensures no background package updates will run automatically.
Method 2: Disable the Systemd Service
If you want to keep the package but stop it from running:
sudo systemctl stop unattended-upgrades sudo systemctl disable unattended-upgrades
Also disable the related timers:
sudo systemctl disable apt-daily.service apt-daily-upgrade.service sudo systemctl disable apt-daily.timer apt-daily-upgrade.timer
Method 3: Change the Configuration
Edit the config file:
sudo nano /etc/apt/apt.conf.d/20auto-upgrades
Set both options to 0:
APT::Periodic::Update-Package-Lists "0"; APT::Periodic::Unattended-Upgrade "0";
Save and exit. This stops automatic updates while keeping manual updates possible.
Best Practice: Manual Updates on Your Schedule
For production servers, the best approach is to apply updates manually during a maintenance window. This way you control when services restart and can test your applications afterward.
Typical workflow:
sudo apt update sudo apt upgrade -y sudo reboot
This ensures you stay secure without risking unexpected downtime.
Conclusion
While unattended upgrades are convenient for desktops, they can be dangerous on production servers running databases, web services, or critical applications. By disabling them and switching to manual updates, you can avoid:
- MySQL downtime
- Nginx/Apache freezes
- Unexpected reboots
- Apt lock conflicts
👉 If you’ve ever googled “Ubuntu MySQL stopped after unattended upgrades” or “disable automatic updates Ubuntu server”, this article should give you a clear answer.
Similar Posts
Smarter Performance Insights for Your Cloud Servers
We’re excited to introduce a new section in the ServersCamp control panel –Performance Insights.
Hypervisor fleet upgraded to Proxmox VE 9
We are pleased to announce that our hypervisor infrastructure has been upgraded toProxmox VE 9.0, based onDebian 13 “Trixie”. The new release integrates theLinux kernel 6.14, providing improved performance, broader hardware support, and long-term stability for production workloads.
ServersCamp Terraform Provider is Now Available
We’re excited to announce that theofficial ServersCamp Terraform provideris now published and available on the Terraform Registry.