Skip to content

Instantly share code, notes, and snippets.

@tomzo
tomzo / on-boot.sh
Created May 26, 2019 14:49
Kill, disable and purge unattended upgrades in ubuntu
#!/bin/bash
# disable automatic upgrades to avoid error on start: "Could not get lock /var/lib/dpkg/lock"
cat << EOF > 20auto-upgrades
// Do "apt-get update" automatically every n-days (0=disable)
APT::Periodic::Update-Package-Lists "0";
// Run the "unattended-upgrade" security upgrade script
// every n-days (0=disabled)
// Requires the package "unattended-upgrades" and will write
// a log in /var/log/unattended-upgrades
APT::Periodic::Unattended-Upgrade "0";