I have scenario when Ubuntu 16.04 LTS server is powered on every day for 1 hour.

How to setup it in the way, that when started it updates itself automatically with an automatic reboot if needed?

Note: by updating I mean - keeping system up to date. Similar to running apt-get dist-upgrade (or similar, so that at least security updates are installed).

  • You can check those config files in /etc/apt/apt.conf.d/, especially 50unattended-upgrades – alfred Oct 28 '17 at 14:01
  • I know about "unattended-upgrades" package, but I am not sure that it will update the server when it is powered on only for one hour during a day. Is there any reliable config, that guarantees that updates are installed on boot? – Maris B. Oct 28 '17 at 14:08
  • how about Unattended-Upgrade::InstallOnShutdown "true"; – alfred Oct 29 '17 at 14:20
  • @alfred - it is not exactly what I am looking for. But I will use it, if nothing else comes up. Also, will it update Ubuntu on sudo reboot? Does it counts as a shutdown? – Maris B. Oct 30 '17 at 8:18
  • I personally don't know if Ubuntu or apt or unattended-upgrades themselves give a solution for your case. If you really want to install updates right after reboot, from my knowledge, you can write a crontab job to run at boot, and do "apt update" and "unattended-upgrades" when network is ready(you also need some way to check network before doing update, or a systemd service after network-online.target). For your question about reboot, I think it will, bases on some google result. I don't use that, so I'm not sure what its behavior is. – alfred Oct 30 '17 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.