Thursday, June 29, 2017

How to turn off ubuntu unattended updates and upgrades in Ubutntu



 Since Ubuntu 16.x unattended updates and uprades are enabled by default. These run on a schedule periodically to keep your system up to date. SOmetimes you do not want to let Ubuntu automatically do this. THe below commands can be used to shutdown and disable the unttended updates and upgrades service

In a root shell (sudo -i) typing the three commands below will disable unatended updates and upgrades

systemctl mask apt-daily.service
systemctl disable apt-daily.timer
systemctl disable unattended-upgrades

You can reverse this action by using the following three commands as root:


systemctl unmask apt-daily.service
systemctl enable apt-daily.timer
systemctl enable unattended-upgrades

Note: If you have a doubt as to the difference between masking and disabling. Masking prevents a service from ever running/being started. Disable only prevents a service from being started automatically.

 If you do not want to prevent the service from running but want more fine grained control over unattended upgrades.  You can edit the file located at "/etc/apt/apt.conf.d/20auto-upgrades" on your Ubuntu system.

 APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

By changing the "1" to "0" you can disable a specific feature example you want only unattended updates but no upgrades.




No comments:

Post a Comment