How to automatically install updates in linux mint 17.1

I have linux mint 17.1 xfce, and I am wondering how to automatically install updates. Every time a new update is available I have to click on the mintUpdate icon on the panel and enter my password and click install. I think it is supposed to be good to install manually so that you can judge whether or not you really want to install the update. But I have never in two years decided that I didn't want to install an update, so I think it would be easier to just have it done automatically in the background.

Now I found a webpage purporting to explain how to install updates automatically. But I don't think it does a good job of explaining which updates will get installed automatically if you follow their instructions. It gives a configuration file to use that looks like this

// 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"; 

}; 

but it doesn't explain how these origins map onto mintUpdate's "levels".

My goal is to install all updates classified as level 1, 2, or 3 by mintUpdate as well as all security updates. But I don't want to install non-security updates for level 4 or 5. How would I do this?


Solution 1:

The instructions you followed appear to install & use the program unattended-upgrades (from the sudo apt-get install unattended-upgrades line.

AFAIK Linux Mint's update program classifies updates from 1 to 5 through some other means, of which I don't know yet, and I'll bet unattended-upgrades doesn't know either. I don't see an easy way to export the list of 1-3 updates from mintupdate and feed it into unattended-upgrades.

The good news is that many of the Mint tools are written in Python, so you can browser around them yourself relatively easily. This is what's in the Mint 17 XFCE files, should be very similar to 17.1 but check yours to make sure:

/usr/bin/mintupdate contains:

#!/usr/bin/python

import os
import commands  

command = "/usr/lib/linuxmint/mintUpdate/mintUpdate.py show &"
os.system(command)

And looking through /usr/lib/linuxmint/mintUpdate/mintUpdate.py there are a few relevant looking lines about setting level:

if is_a_mint_package:
    level = 1
else:
    level = 3 # Level 3 by default        
    rulesFile = open("/usr/lib/linuxmint/mintUpdate/rules","r")
    rules = rulesFile.readlines()
    goOn = True
    foundPackageRule = False # whether we found a rule with the exact package name or not
    for rule in rules:

And the /usr/lib/linuxmint/mintUpdate/rules has this, it looks like any package that looks like these has the level in |n|'s:

banshee|*|2||
firefox|*|2||
thunderbird|*|2||
*language-pack|*|2||
*flashplugin|*|2||
*wine|*|2||
pidgin|*|2||
libreoffice|*|2||
chromium-browser|*|2||
dbus|*|4||
*xorg|*|4||
acpid|*|4||
mountall|*|4||
mesa|*|4||
systemd|*|4||
plymouth|*|4||
upstart|*|4||
*base-files|*|5||
*linux-|*|5||
linux|*|5||
grub|*|5||
grub2|*|5||

So maybe if you can set up unattended-upgrades to ignore packages that match the 4 & 5 words, that might be good enough...? I don't know how unattended-upgrades works enough to say so now.

The source code is always available too, for Mint tools & unattended-upgrades in case there's something else in them that could be easily changed. Modifying code is waaaaaay easier than writing it (or even really understanding it ;-P )

And the Linux Mint forums could help you figure out exactly what packages are level 4 & 5 to avoid, maybe with a more simple regex for the 12 or 13 lines? http://forums.linuxmint.com/