Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I tell Ubuntu 12.10 to perform auto updates silently without any questions and messages? In GUI tool there is an option to do this if security updates are available. But I want all updates to be installed this way.

I think it can be done using apt-get with cron. But is it the best way?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

The package unattended-upgrades is used by Ubuntu to silently install important security updates to your system. It is enabled by default and runs on every current Ubuntu release.

You can use the same utility to upgrade your system by enabling unattended-upgrades to upgrade non security related updates. For that use your favourite text editor to edit the necessary config file located on /etc/apt/apt.conf.d/50unattended-upgrades, ie:

sudo nano /etc/apt/apt.conf.d/50unattended-upgrades

and remove the // marks on the start of the line "${distro_id}:${distro_codename}-updates"; so it looks like this

enter image description here

Dont forget to save the file.

You can change the configuration of the unattended updates by editing the file /etc/apt/apt.conf.d/10periodic, options for the configuration are in the /etc/cron.daily/apt script header. Read them to configure the frequency of the unattended updates.

That is it! Your system will be updating itself, user independent and without interaction needed.

share|improve this answer
    
Thank you, it works. But sometimes notification about updates appears and updates installer icon shows up. What is the best way to disable this behaviour? Also, I want to see notifications like "Some updates has been installed" when it happens. How can I achieve this? –  Riateche Nov 22 '12 at 8:18
    
You need to disable the update manager on its interface. The unattended-upgrades will still keep on working. That is user based though and another question. Ask "How can I disable the update-manager for all users" on the site. –  Bruno Pereira Nov 22 '12 at 10:17

This is not a good idea, but one of the great things about Linux is you can do it anyway.

in a root conjob run

apt-get update && apt-get upgrade -y

This will update the apt-cache and then apply your upgrades. However, this could also fail if there are conflicting config files or other things dpkg needs to prompt for (dpkg will detect that it's non-interactive and will do the default for the question, the same as if you just pressed enter on the command line, if there is no default dpkg will fail).

There is also the problem of human tendency. If you update your system like this, things could change on you randomly. This could cause things to break or act differently until you restart the program. However you would have no way of knowing this, because everything happened behind the scenes.

A slightly better option may be to pop the GUI at a given time. Something like:

0 3 * * * export DISPLAY=:0 && /usr/bin/update-manager

in your users crontab. Again this will fail quite a bit (if that user is not logged in at 3am, if the DISPLAY variable is wrong, etc.)

Basically it's a bad idea, no one needs to be "that" up to date, set the "other updates" to display immediately in update-manager, and accept that your only going to get the notice when something on the system runs apt-get update (there is already a nightly cron job for this.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.