27

I just had a look at my Amazon EC2 instance and noticed I had 20 minutes exactly of downtime. I didn't know what caused it so I logged in to SSH and tried upgrading my packages, and saw that the unattended-upgrades package needed upgrading. I went ahead and did this.

After searching it seems like this package can automatically reboot your machine. Not sure why I didn't get to configure this as it came with the OS, but oh well.

Does anyone know how to prevent the package from automatically rebooting? Or how to stop it updating packages altogether? I can do that myself.

1
  • 2
    Be careful as I think that some security fixes (e.g. new kernel?) won't take effect until the next reboot.
    – AdamS
    Jul 18, 2017 at 18:55

3 Answers 3

40

Verify that in the configuration file: /etc/apt/apt.conf.d/50unattended-upgrades you have set:

Unattended-Upgrade::Automatic-Reboot "false";

This will prevent the software to issue reboot also if needed by the upgrades.

Documentation

2
  • 1
    Is this directly active or is it required to reboot or export some variables, etc? Jan 24, 2022 at 7:28
  • sudo sed -i 's/\/\/Unattended-Upgrade::Automatic-Reboot "false";/Unattended-Upgrade::Automatic-Reboot "false";/g' /etc/apt/apt.conf.d/50unattended-upgrades
    – Tyler
    Jan 22 at 16:24
6

To disable automatic upgrades altogether, just remove the package. Try:

sudo apt-get remove unattended-upgrades

See Ubuntu docs for more info. However, if you want to keep the package and configure its behaviour, see this question's solution How do I enable automatic updates?

6
  • 1
    You first link's most voted answer suggest installing it and you're suggesting to remove it? Again, removing it beats the purpose of getting automatic unattendend upgrades altogether!
    – Anwar
    Aug 11, 2016 at 9:53
  • @Anwar Okay, I intended to point to related info, but I agree that the first link could be confusing. Wrt. your second point, though the question includes Or how to stop it updating packages altogether? Aug 11, 2016 at 10:03
  • 1
    You may only extract that information out to point OP to the right direction? Since, it is confusing to see supporting link saying against (at first look at least) the answer.
    – Anwar
    Aug 11, 2016 at 10:07
  • 1
    @AnwarShah Thanks for the suggestions! Hope it's clearer after last edits Aug 11, 2016 at 10:10
  • 2
    Down vote, because removing unattended-upgrades is usually a bad idea. You will miss out on important security updates, especially considering this is a server instance, where you want these to be installed automatically. Aug 23, 2018 at 19:22
0

You can refer to this as well for disabling Amazon Linux's upgrade after reboot https://github.com/Nubisproject/nubis-base/issues/153

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .