How to get automatic upgrades to work on Ubuntu Server?
Solution 1:
Have you check /etc/apt/apt.conf.d/10periodic ?
it should have the last line
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "1";
APT::Periodic::Unattended-Upgrade "1";
Solution 2:
Check the actual documentation for your Ubuntu version here:
/usr/share/doc/unattended-upgrades/README.gz
For Ubuntu 11.10, to enable it, you do:
sudo dpkg-reconfigure -plow unattended-upgrades
(it's an interactive dialog) which will create /etc/apt/apt.conf.d/20auto-upgrades
with the following contents:
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
So indeed the information in Ubuntu 10.04 server guide is out-of-date.
If you're using Puppet like we do at Bippo and Soluvas, you can use something like this to automate proper unattended-upgrades configuration:
# Unattended upgrades
package { unattended-upgrades: ensure => present }
file { '/etc/apt/apt.conf.d/50unattended-upgrades':
content => template('bipposerver/50unattended-upgrades'),
mode => 0644,
require => Package['unattended-upgrades'],
}
file { '/etc/apt/apt.conf.d/20auto-upgrades':
source => 'puppet:///bipposerver/20auto-upgrades',
mode => 0644,
require => Package['unattended-upgrades'],
}
service { unattended-upgrades:
enable => true,
subscribe => [ Package['unattended-upgrades'],
File['/etc/apt/apt.conf.d/50unattended-upgrades',
'/etc/apt/apt.conf.d/20auto-upgrades'] ],
}
Make sure to provide the templates/files 50unattended-upgrades
and 20auto-upgrades
as you see fit.
I'm also updating the Ubuntu Wiki page to reflect this.
Solution 3:
I don't see anything wrong with your /etc/apt/apt.conf.d/50unattended-upgrades
. Mine looks almost like yours but I only let security upgrades be applied automatically, nothing else. I also have it set to send mail simply to "root" (Postfix handles the rest).
But: the init script /etc/init.d/unattended-upgrades
is not for running unattended upgrades. It just checks whether the unattended upgrade process is running and waits until it exits. I don't really know why it is needed or why it does what it does (it wasn't even present on previous Ubuntu versions) but it is not the way to do unattended upgrades.
Instead there is, on Ubuntu, a Python program called unnattended-upgrades
that does the work. Try running that manually and see what happens. Also check the output of the command
apt-config shell UnattendedUpgradeInterval APT::Periodic::Unattended-Upgrade
It should say UnattendedUpgradeInterval='1'
, indicating that you configured APT correctly to allow for unattended upgrades.
Ubuntu runs /etc/cron.daily/apt
daily from cron. If you look at that script you see that it does various APT-related things, among them unattended upgrades. My guess is that you somehow disabled that cron script and so nothing happens unattended.
That's it, more or less, off the top of my head. Please post a followup if you have tried my ideas without success.
HTH