Speaktech.in

Disable apt auto update and upgrade

Running Ubuntu Server LTS in a virtual machine or virtual box, is helpful to test software installations and meet various other requirement. Therefore is recommended that apt maintains the update and upgrade of its own. On the other hand if you don’t want that update to happen, this article demonstrates how to disable it.

Login into the virtual machine, remember that you have to map the ssh port in the virtual machine to a different one in your host. In this example it is 1122 and the public key authentication is used.

omega:~$ ssh localhost -p 1122
Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-51-generic x86_64)
 * Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage19 packages can be updated.8 updates are security updates.Last login: Fri Dec 9 16:28:50 2016

You will notice if you try to install or remove anything, that apt is already used by the apt-daily.timeror its taking too much time to boot the server. Server bootup pauses for update to happend

ubuntu:~$ sudo apt-get dist-upgrade
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?


To disable it for the next time:

ubuntu:~$ sudo systemctl stop apt-daily.timer
ubuntu:~$ sudo systemctl disable apt-daily.timer
ubuntu:~$ sudo systemctl disable apt-daily.service
ubuntu:~$ sudo systemctl daemon-reload