Your Linux Data Center Experts

Enabling automatic upgrades on Ubuntu Hardy is fairly cryptic. There's a nice “unattended-upgrades” package, but installing it is (far less than) half the battle… I've created a helper script, and ended up getting fairly fancy with it, but if you want to make use of it the short form is:

wget ftp://ftp.tummy.com/pub/tummy/ubuntuenableautoupdate/ubuntuenableautoupdate
sh ubuntuenableautoupdate

It will prompt you for a couple of options you can tune (though command-line arguments are available, for example “ubuntuenableautoupdate -yu updatemaster@example.com”. Read on for details on what exactly this does.

The end result of the script is to write the file “/etc/apt/apt.conf.d/60ubuntuenableautoupdate” which contains information similar to:

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

Unattended-Upgrade::Allowed-Origins {
        "Ubuntu hardy-security";
        "Ubuntu hardy-updates";
}

Unattended-Upgrade::Mail "";

Though a few of the items, such as the “hardy-updates” line and the “Mail” line depend on the options or answers you give to the script. The above file has e-mail messages disabled, and non-security updates enabled.

Another benefit of the script is that it can run an upgrade right away, and show you the logs so you can verify that the updates are running correctly. It disables the random sleep (up to 30 minutes normally), so that the upgrade will happen immediately.

So, this script allows you to forget the obtuse syntax or modifying the base configuration, and also allows you to verify that the configuration is correct.

The script is safe to run multiple times in succession, and will even override the normal “wait at least a day before re-running” stamp that the apt daily cron job implements.

“unattended-upgrades” is not quite “yum-updatesd” like you would have on Fedora, largely because of the obtuse configuration requirements. By comparison, “yum-updatesd” has a sample configuration file where you simply uncomment the line reading “#do_update = yes”. But hopefully this script makes life a bit easier for people.

Enjoy.

comments powered by Disqus

Join our other satisfied clients. Contact us today.