Can apt-get dist-upgrade -y cause a restart of the system?

I mean can it cause a restart without further confirmation?

  • The -y flag with dist-upgrade is unwise. You are saying "It's okay to destroy my system if I made any mistakes. Don't bother me with such petty details." A reboot afterward, for any reason, would be merely icing on that terrible cake. – user535733 Aug 10 at 14:13
  • But then you can not do automatic updates with a script – tom Aug 13 at 12:56
  • You don't need to script automatic updates anyway: Unattended Upgrades is already included with every release of Ubuntu (except Ubuntu Core, which uses a different equivalent). – user535733 Aug 13 at 15:02

I have never seen this. Even when updating kernels (which gives a message saying you should restart your machine before the new kernel is in effect).

But, apt-get is run with root priviledge, and it executes all sorts of "post install" scripts found in the .deb packages. If one of those scripts would do an 'init 6' or some other command that restarts the system, then yes: apt-get will restart the system. This could even be the case without the -y flag.

Basically, you are trusting the repositories where the .deb packages are, and as a consequence, you are also trusting the people that create those .deb packages to not do anything too malicious...

| improve this answer | |
  • Thank you very much :) Issue is solved. – tom Aug 10 at 12:25
  • It can but me too have never seen it happen. Generally the idea is that you can keep on working when you upgrade so a reboot would be dangerous to do unless confirmed. I would consider it a serious bug if a reboot is done without user consent. – Rinzwind Aug 10 at 12:31
  • Unattended Upgrades has an option to reboot (when required) after completion. The option is turned off by default. A supplementary option is to reboot at a specific time (when required). – user535733 Aug 13 at 14:57

Your Answer

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

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