The Easiest Way to Enable Automatic Updates on Ubuntu


Here’s how to enable automatic updates on Ubuntu:

  1. Check your Ubuntu version with lsb_release -a.
  2. Run sudo apt update to refresh package lists, then sudo apt upgrade to upgrade all packages.
  3. Execute sudo apt install unattended-upgrades and confirm the installation.
  4. Edit /etc/apt/apt.conf.d/50unattended-upgrades with sudo nano to select which updates to automate.
  5. Use sudo dpkg-reconfigure --priority=low unattended-upgrades to set updates to apply automatically.
  6. Adjust /etc/apt/apt.conf.d/20auto-upgrades to manage old packages and run sudo unattended-upgrade --dry-run --debug to test settings.

Keeping your Ubuntu system updated might seem like a hassle, but it’s really important for keeping it secure and running smoothly. If you’re tired of manually checking for updates and want a simpler way, I’ve got great news for you! You can set your system to update automatically. In this post, I’ll show you how to easily enable automatic updates on Ubuntu, so you don’t have to worry about it anymore. I’ll also share some tips on troubleshooting and maintaining your system.

How to Enable Automatic Updates on Ubuntu?

Enabling automatic updates on your Ubuntu system is a crucial step to ensure that your system remains secure and efficient by receiving the latest security patches and feature updates without manual intervention. Here’s a step-by-step guide to setting up automatic updates on Ubuntu:

  1. Open your terminal by pressing Ctrl+Alt+T.
open terminal
  1. Enter the following command:
lsb_release -a

Note down the release number displayed.

viewing release number of linux system
  1. To ensure that your system is up-to-date to avoid any conflicts, in the terminal, run:
sudo apt update

The command will update the package list.

updating system package list
  1. Then, execute the command:
sudo apt upgrade

It will upgrade all your installed packages to their latest versions.

upgrading packages to the latest version
  1. Now install the unattended-upgrades package by running the command:
sudo apt install unattended-upgrades
  1. Confirm the installation when prompted. This package is used to manage automatic updates.
installing unattended upgrades package
  1. To configure what types of updates should be applied automatically, edit the configuration file by entering:
sudo nano /etc/apt/apt.conf.d/50unattended-upgrades

This command opens the configuration file in the nano editor, where you can specify which updates to automate.

opening configuration file in nano editor
  1. Inside the file, you will find several lines commented out (marked by //). Uncomment (remove the //) the lines under "${distro_id}:${distro_codename}-updates", for regular system updates.
  2. Ensure that lines for security updates are uncommented to allow automatic security updates:
Unattended-Upgrade::Allowed-Origins {
// Extended list if necessary
editing configuration file
  1. Save the changes by pressing Ctrl+O, hit Enter to confirm, and Ctrl+X to exit.
saving and exiting configuration file
  1. Now, you need to enable the automatic update feature. Back in the terminal, type:
sudo dpkg-reconfigure --priority=low unattended-upgrades

This command will open a dialog that allows you to select whether updates should be automatically applied.

enabling automatic updates using dpkg
  1. Choose Yes and press Enter.
confirming automatic updates
  1. You can also set up automatic clean-up to manage disk space by removing old packages. Open the auto-cleanup configuration file by typing: 
sudo nano /etc/apt/apt.conf.d/20auto-upgrades

This command opens another configuration file where you can set how often the system cleans up old packages.

opening auto cleanup configuration file in nano editor
  1. Add the following lines to ensure that the system cleans up old packages automatically:
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1";
  1. The numbers represent days. Adjust them according to your preference.
editing auto cleanup configuration file
  1. To ensure that everything is set up correctly, run:
sudo unattended-upgrade --dry-run --debug

This command simulates an update without installing anything, allowing you to verify that everything works as expected.

verifying that the configuration is done correctly

Troubleshooting Issues With Automatic Updates on Ubuntu

Experiencing issues with automatic updates on your Ubuntu system can disrupt your workflow. Here are four common problems you might encounter, along with more detailed solutions to ensure your system’s updates run smoothly:

  • 🔍 Updates Not Running Automatically: Check if unattended-upgrades is installed by running sudo apt install unattended-upgrades. Verify that automatic updates are enabled in both /etc/apt/apt.conf.d/20auto-upgrades and /etc/apt/apt.conf.d/50unattended-upgrades. Ensure these files have the correct settings to authorize updates, such as the correct origin lines under Unattended-Upgrade::Allowed-Origins.
  • 🔄 Updates Partially Applied: Instability during updates can be due to intermittent internet or power issues. Inspect the log files in /var/log/unattended-upgrades/unattended-upgrades.log for errors that might indicate interrupted downloads or installation issues. Freeing up disk space or checking disk health might also resolve problems where updates fail to complete.
  • ⚠️ System Stability Issues After Updates: If updates lead to system instability or application issues, you can use APT’s pinning feature to hold a package at a current version, preventing problematic updates. Edit or create a file in /etc/apt/preferences.d/ to specify package versions to be held back.
  • 🚫 Notification Emails Not Being Sent: If you’re not receiving email notifications after updates, ensure that the mailx or postfix package is correctly installed and configured. Use sudo apt install mailx or sudo apt install postfix to set up. Check the email configuration settings in /etc/apt/apt.conf.d/50unattended-upgrades and confirm that the email address is correctly formatted and the sending options are properly configured.

Best Practices for System Maintenance with Automatic Updates

Maintaining your Ubuntu system is essential, especially when you’ve enabled automatic updates. Here are four best practices that can help ensure your system runs smoothly and remains reliable:

  • 🔄 Regular System Backups: Make sure to back up your data consistently. Use tools like rsync for manual backups or Deja Dup for automated, scheduled backups. These tools can back up your files to external drives or cloud storage, providing a safety net in case of data loss or system failure.
  • 🧹 Clean Up Disk Space: It is crucial to keep your system free of unnecessary files. Use sudo apt autoremove to remove outdated packages and dependencies no longer needed and sudo apt clean to clear out the downloaded package files that are no longer needed. This helps optimize system performance and ensure there’s enough space for important updates and applications.
  • 🔍 Monitor System Logs: Stay informed about what’s happening on your system by regularly checking the logs. Use journalctl to review system logs or browse specific log files in /var/log/ for any signs of issues or errors. This proactive monitoring can help you catch and resolve problems before they affect system performance.
  • 🛠️ Hardware Checks: Conduct regular checks on your physical hardware to avoid unexpected failures. Use smartctl from the smartmontools package to monitor the health of your HDD or SSD. For memory testing, run memtest from the GRUB menu on boot to check for errors in your RAM. These tools help identify potential hardware issues that could lead to more serious problems if left unchecked.

Final Thoughts

I hope this comprehensive guide on enabling automatic updates on Ubuntu, troubleshooting common issues, and implementing best practices for system maintenance helps you keep your Ubuntu system secure and efficient. Remember, consistent updates, regular backups, and vigilant monitoring are key to maintaining optimal performance and security.

If you’re interested to learn more, consider exploring topics related to fixing update-related errors, clearing the apt-cache, and managing package versions using apt. These areas will enhance your understanding and your ability to effectively manage your Ubuntu system, providing you with valuable insights and skills to tailor your computing environment to your needs.

Frequently Asked Questions

  1. Can automatic updates be scheduled for specific times to minimize the impact on system performance?

    Yes, you can schedule automatic updates for specific times by modifying the /etc/apt/apt.conf.d/50unattended-upgrades file. You can specify the times when the system should check for and apply updates, thus minimizing impact during peak usage hours.

  2. What are the implications of disabling automatic updates on long-term system security?

    Disabling automatic updates can significantly compromise your system’s security by leaving it vulnerable to known bugs and exploits that are patched in updates. Over time, this increases the risk of malicious attacks and software instability.

  3. How can I check which updates were installed automatically in the last week?

    To see which updates were installed automatically in the last week, you can check the log files located in /var/log/unattended-upgrades. These logs provide detailed records of all updates that have been applied automatically.

  4. Is there a way to automatically roll back an update if it causes system issues?

    Automatically rolling back an update is not supported by default in Ubuntu. However, you can manually downgrade or revert packages to a previous version using the apt-get command if an update causes system issues, although this process requires careful handling to avoid further issues.



Ojash is a skilled Linux expert and tech writer with over a decade of experience. He has extensive knowledge of Linux's file system, command-line interface, and software installations. Ojash is also an expert in shell scripting and automation, with experience in Bash, Python, and Perl. He has published numerous articles on Linux in various online publications, making him a valuable resource for both seasoned Linux users and beginners. Ojash is also an active member of the Linux community and participates in Linux forums.



Akshat is a software engineer, product designer and the co-founder of Scrutify. He's an experienced Linux professional and the senior editor of this blog. He is also an open-source contributor to many projects on Github and has written several technical guides on Linux. Apart from that, he’s also actively sharing his ideas and tutorials on Medium and Attirer. As the editor of this blog, Akshat brings his wealth of knowledge and experience to provide readers with valuable insights and advice on a wide range of Linux-related topics.

Share this article
Shareable URL
Prev Post

Redis-CLI Get/Set Key Value Pairs: How to Do It? [10 Easy Steps]

Next Post

How to Run Linux Commands in Background [8 Effective Methods]

Read next