Mar 28, 2024 4 min read

How to Configure Unattended Upgrades on Ubuntu 22.04

Configure Unattended Upgrades on Ubuntu 22.04 with our step-by-step tutorial. Unattended Upgrades: automated updates without manual intervention.

Configure Unattended Upgrades on Ubuntu 22.04
Configure Unattended Upgrades on Ubuntu 22.04
Table of Contents

Introduction

Before we begin talking about how to configure Unattended Upgrades on Ubuntu 22.04, let's briefly understand – What is Unattended Upgrades?

Unattended upgrade refers to an automated process of updating software applications or operating systems without the need for manual intervention. This system ensures that all software components are kept up-to-date, including bug fixes, security patches, and new feature releases.

By implementing unattended upgrades, users can streamline their maintenance strategies and enhance the security and productivity of their systems effortlessly. Experience hassle-free updates and enjoy a more efficient and secure computing environment.

In this tutorial, you will configure Unattended Upgrades on Ubuntu 22.04. We will also address a few FAQs on how to configure Unattended Upgrades on Ubuntu 22.04.

How To Enable Unattended Upgrades

From the User Interface (Gnome Desktop)

Software & Updates, also known internally as update-manager, is an application that comes installed by default with Ubuntu Desktop installations. This application has the ability to change the necessary files on your device in order to guarantee that Unattended Upgrades are enabled correctly.

To use it, simply follow these steps.

  1. Open the Software & Updates application (update-manager can also be run from the terminal).
  2. After it opens, choose the Updates tab.
  3. Make sure that the option to download and install automatically is selected for when there are security updates. If any authentication prompts appear, respond to them.
  4. Press the Close button.

From the Terminal

  1. You can use sudo apt-get install unattended-upgrades -y to confirm that the package is installed.
  2. Execute the following interactive prompt after running sudo dpkg-reconfigure -plow unattended-upgrades:

3.  Choose "yes". When the program is finished, the proper settings will be created in the file /etc/apt/apt.conf.d/20auto-upgrades. There might be an installation screen that resembles the screenshot below, or one that is contradictory already. To restore the default behavior, just replace the file with the updated version if you see that screen.

How to Use Osquery to Check Whether Unattended Upgrades Are Enabled

Through an integration with the Augeas configuration parsing project, Osquery, an open-source utility for querying the state of the OS, can read the contents of particular configuration files, such as /etc/apt/apt.conf.d/20auto-upgrades.

Osquery queries the current state of the system using SQL. To find out if unattended upgrades are configured correctly, use Osquery SQL and the following query, assuming you have the correct lens installed.

SELECT
  MAX(CASE WHEN label='Update-Package-Lists' THEN value END) as update_package_list,
  MAX(CASE WHEN label='Unattended-Upgrade' THEN value END) as unattended_upgrade,
FROM augeas
WHERE path = '/etc/apt/apt.conf.d/20auto-upgrades'

How Does Kolide Remediate This Problem?

It is not possible to solve this issue with conventional automation using instruments like an MDM. Devices that fail this check must be prevented from authenticating to your SaaS apps, and you must be able to provide end users with detailed instructions on how to unblock their device.

That's precisely what Kolide's Okta Integration does. Once Kolide is integrated into your sign-in process, it will automatically link devices to the Okta identities of your users. After that, it can block any device displaying this issue and give the user detailed instructions on how to resolve it. Kolide instantly unblocks their device after it has been fixed.

FAQs to Configure Unattended Upgrades on Ubuntu 22.04

How do I enable unattended upgrades on Ubuntu 22.04?

To enable unattended upgrades on Ubuntu 22.04, you can configure the system settings through the software updater or the command line.

Can I select which packages are updated with unattended upgrades? 

Yes, you can customize the packages that are included in unattended upgrades. You have the flexibility to specify the repositories or package sources to be considered.

How frequently do unattended upgrades run on Ubuntu 22.04? 

By default, unattended upgrades run daily to ensure timely software updates on your system.

Can I set a specific time frame for unattended upgrades to download updates? 

Absolutely, you can configure a specific time window for the system to download updates, ensuring it aligns with your usage preferences and network availability.

Can I prevent specific packages from being automatically updated? 

Yes, you have the option to exclude specific packages, helping you maintain control over critical software components if needed.

How can I temporarily disable unattended upgrades? 

If you wish to temporarily disable unattended upgrades, you can adjust the system settings to pause the automated update process.

Is it recommended to enable unattended upgrades on Ubuntu 22.04?

Enabling unattended upgrades is generally recommended as it ensures your system remains secure with the latest updates. However, it's advisable to monitor the updates and system behavior to ensure compatibility.

Conclusion

We hope this tutorial helped you understand how to configure Unattended Upgrades on Ubuntu 22.04.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them for sure.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.