How to enable unattended software updates on Linux Mint

Alexio
  11 years ago
  23

Installation of software updates are very important in every operating system. We can either configure the installation of package updates manually or automatically in Linux Mint. This tutorial explains you how to enable the installation of software package updates automatically in the Ubuntu-based editions of Linux Mint.

Open your terminal and run the update:

sudo apt-get update

Install the “unattended-upgrades” package:

sudo apt-get install unattended-upgrades

This is the package used to install the updated packages automatically.

The configuration files are located at /etc/apt/apt.conf.d

To configure the unattended-upgrades edit the /etc/apt/apt.conf.d/50unattended-upgrades file and make changes according to your need: 

// Automatically upgrade packages from these (origin, archive) pairs 

Unattended-Upgrade::Allowed-Origins { 

"${distro_id} ${distro_codename}-security"; 

// "${distro_id} ${distro_codename}-updates"; 

// "${distro_id} ${distro_codename}-proposed"; 

// "${distro_id} ${distro_codename}-backports"; 

}; 

Note : “ // “ is a comment line. So whatever follows by the comment line ( // ) cannot be evaluated.

To enable the updates simply remove the comment line ( // ).

If you dont want to install the software updates for certain packages, just add those package names in the Blacklist:

// List of packages to not update 

Unattended-Upgrade::Package-Blacklist { 

// "vim"; 

// "libc6"; 

// "libc6-dev"; 

// "libc6-i686"; 

}; 

The results of unattended-upgrades will be logged to /var/log/unattended-upgrades

To enable automatic updates, edit /etc/apt/apt.conf.d/10periodic and set the appropriate apt configuration options:

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

APT::Periodic::Download-Upgradeable-Packages "0"; 

APT::Periodic::AutocleanInterval "30"; 

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

The above configuration updates the package list, downloads, and installs available upgrades every day.

The local download archive is cleaned every thirty days.

Note : Here the number represents the days.

Comments
Enkitux 5 years ago

Since a while LM comes with mintupdate-tool command line utility, doing the same as the gui. (For a normal user, now there is no need anymore for such a complicated way of doing it, I'd say.)

On basis of this tool, I have written a small script for laptop/notenbook or similar users that performs an update 1-3x per day and discribed it in this tutorial:

http://enkidu.eu/LMmow

Maybe it is useful for some of you... Comments welcome.


undersound 8 years ago

For Mint 17.2 see https://forums.linuxmint.com/viewtopic.php?t=202715


UsesMintDaily24 8 years ago

Very useful tutorial.

If this installs all updates regardless of level (1 - 5), is there a way to control that so only specific levels are installed?

On the same note, I assume the "distro" security updates are from Mint and would only include certain levels, correct?


Enkidu 9 years ago

Ok, I solved my problem on my own! This kind of unattended-upgrades is not what I need. So I wrote my own script upgrading my system after resume:

unattended-upgrades-alternative: http://enkidu.eu/uaalternative

It is a simple bash script, checking for updates a couple of times a day, executed after each resume.

Feel free to use it at your own risk. :)


Enkidu 9 years ago

Can someone please explain to me, how to enable ALL level 1, 2, 3 updates disregarding names or ppa ecc? So the same that I do when I press update in update manager?

So that if I installed something new from a new ppa or any other archiv is automatically included!?

Tnx!


TheOnlyMo 9 years ago

nice tutorial
In 17.1 you also have to add the Rows:
"Ubuntu trusty-security"; and
"Ubuntu trusty-updates";
into /etc/apt/apt.conf.d/50unattended-upgrades to get the ubuntu-updates, otherwise you'll just update the Mint-Packages
Personally I also love one option Unattended-Upgrade::InstallOnShutdown "true";
Just remove the //, so it's not a comment anymore, and the updates will be done, when the PC is shut down.
And I don't have to explain my mother every next day, how to update :-D


pulsatorius 10 years ago

I didn't have any etc/apt/apt.conf.d/10periodic so I created it. Was this the right move? Should it be included in the instructions?


BenJetson 10 years ago

I got this working on my LM 17 system. Here's whats in my "/etc/apt/apt.conf.d/50unattended-upgrades" file:

http://paste.ubuntu.com/8218593/


drewkeller 10 years ago

I don't see a way to edit my comment. The format for allowed origins entry should be in the format "origin:suite" as shown in the _Release file (the way I posted it before got clobbered).


drewkeller 10 years ago

For newer versions of Mint, you may need to change the allowed origins section. You can do a dry run, like this...

> sudo unattended-upgrade --dry-run
- Check the log in /var/log/unattended-upgrades/

To determine what origins you need, , look in /var/lib/apt/lists/. Files that end in "_Release" are candidates for sources. Add desired update sources in the format ":" as shown in the release file (open the file to see).

So you might have a section like this (Linux Mint 16 Petra)....

// Automatically upgrade packages from these (origin:archive) pairs
Unattended-Upgrade::Allowed-Origins {
"${distro_id}:${distro_codename}-security";
"${distro_id}:${distro_codename}-updates";
"linuxmint:petra"
"Ubuntu:saucy-security";
"Ubuntu:saucy-updates";
// "${distro_id}:${distro_codename}-proposed";
// "${distro_id}:${distro_codename}-backports";
};

Note that this doesn't care what level the update is.


windyweather 11 years ago

This doesn't work. After a couple of days I find the shield has an "i" in it and the updates were not installed. Something is left out for LM 14.

No Joy for automatic updates.
ww


windyweather 11 years ago

Minor issue I think.
I'm trying this on LM 14 and I don't find the 10periodic file.
Do I need to create that file?
Guess I'll create it with the contents you suggest.
ww


AshBaby 11 years ago

Thanks, very concise and clear.


sujitnag 11 years ago

very impotent information


Hammer459 11 years ago

Nice and clear tutorial


telcnas 11 years ago

thanks for this nice info...... :)