I just updated to Ubuntu 16.04 and have been facing outages that I've traced to running unattended upgrades (which incidentally shutdown the tomcat server).

I would like to disable all unattended upgrades so I can run them manually when the server is not in a mission-critical state.

I see this line in /var/log/syslog

Jun 1 06:27:23 www3 systemd[1]: Started Daily apt upgrade and clean activities. 

How do I prevent this process from running?

5 Answers

At first I tried:

sudo apt-get remove unattended-upgrades 

But it was insufficient. I also had to do this:

sudo systemctl stop apt-daily.timer sudo systemctl disable apt-daily.timer sudo systemctl disable apt-daily.service sudo systemctl daemon-reload 

Just a supplementary, first you can list the task:

sudo systemctl list-timers 

and find apt-daily-upgrade.timer, then disable it

sudo systemctl stop apt-daily-upgrade.timer sudo systemctl disable apt-daily-upgrade.timer sudo systemctl daemon-reload 

I simply removed package unattended-upgrades.

0

This question references Ubuntu 16.04 but this answer is also valid for all subsequent releases so far (18.04 and 20.04) and probably Debian as well.

In /etc/apt/apt.conf.d directory, find a file that contains line

APT::Periodic::Unattended-Upgrade "1"; 

(in my case it is /etc/apt/apt.conf.d/20auto-upgrades) and comment the line out or remove it completely.

If you want to disable automatic package list udpate as well then comment out/remove following line:

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

Like vaclav.blazek's answer, but instead of remove it, you can modify it.

Based on this documentation, you can change option that available in /etc/apt/apt.conf.d/20auto-upgrades.

// Do "apt-get update" automatically every n-days // (0=disable, 1=1 day, 7= 1 week) // Check new update. APT::Periodic::Update-Package-Lists "0"; // Do "apt-get upgrade --download-only" every n-days // (0=disable, 1=1 day, 7= 1 week) // Download new update. APT::Periodic::Download-Upgradeable-Packages "0" // Do "apt-get autoclean" every n-days // (0=disable, 1=1 day, 7= 1 week) // Clean old updates. APT::Periodic::AutocleanInterval "0"; // Run the "unattended-upgrade" security upgrade script // every n-days // (0=disable, 1=1 day, 7= 1 week) // Requires the package "unattended-upgrades" and will write // a log in /var/log/unattended-upgrades APT::Periodic::Unattended-Upgrade "0"; 

So, if the scenario you want is to notify-only on daily update, it will looks like:

APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Download-Upgradeable-Packages "0"; APT::Periodic::AutocleanInterval "0"; APT::Periodic::Unattended-Upgrade "0"; 

So, if the scenario you want is to download without upgrade on daily upgrade, it will looks like:

APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Download-Upgradeable-Packages "1"; APT::Periodic::AutocleanInterval "0"; APT::Periodic::Unattended-Upgrade "0"; 

Or, if you want to do it all manually a.k.a disable it, it will looks like:

APT::Periodic::Update-Package-Lists "0"; APT::Periodic::Download-Upgradeable-Packages "0"; APT::Periodic::AutocleanInterval "0"; APT::Periodic::Unattended-Upgrade "0"; 

Basically, just zero it all.

There are two files that contain the configuration, namely:

  • /etc/apt/apt.conf.d/10periodic; and
  • /etc/apt/apt.conf.d/20auto-upgrades

So, check both files to make sure the configurations is as you need.

I hope this will you you.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy