Skip to main content

Unit 8 · System Settings and the Final Run · Lesson 24 of 25

Automatic Updates

Switching on security updates, and why a full upgrade mid-round is a bad trade.

Keeping the machine patched

The easy way

Software & Updates  →  Updates tab

Set Automatically check for updates to Daily, and under When there are security updates choose Download and install automatically. That is the whole fix, in a window.

Checking it from a terminal

The program behind that is called unattended-upgrades:

dpkg -l | grep unattended-upgrades      # is it installed?
sudo apt install -y unattended-upgrades  # install it if not

Installing it is not always enough, because it can be installed and switched off at the same time:

sudo nano /etc/apt/apt.conf.d/20auto-upgrades

Both lines in that file should end with "1":

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

If either says "0", change it to "1" and save.

Do not upgrade everything mid-round

CommandWhat it doesHow long
apt updaterefreshes the list of what is availableseconds
apt install NAMEinstalls one thingusually fast
apt upgradeupdates everything on the machineminutes to hours

💡 Install what a check needs, and leave the full upgrade alone. apt upgrade can run for a long time, restart services underneath you, and change files you were in the middle of editing. Time spent watching a progress bar is time not spent looking at scheduled jobs.

Try it yourself

dpkg -l | grep unattended-upgrades
sudo nano /etc/apt/apt.conf.d/20auto-upgrades    # both lines should be "1"

Do this lesson for real

With a free account you get the terminal, the challenges and the checks that go with every lesson in CyberPatriot Linux: Tokyo Jujutsu High, and your progress is saved as you go. CyberAcad is a 501(c)(3) nonprofit, so there is nothing to pay.