Ubuntu 16.10: Avoid "Could not get lock /var/lib/dpkg/lock" on boot

This article will describe a way to avoid "Could not get lock /var/lib/dpkg/lock" on boot (and periodically).

1 Could not get lock /var/lib/dpkg/lock

This error will be caused because other process running dpkg operation like apt command.

$ sudo apt install -y <package>
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource
temporarily unavailable)

2 Avoid "Could not get lock /var/lib/dpkg/lock"

So stop apt-daily will avoid "Could not get lock /var/lib/dpkg/lock".

$ sudo systemctl mask apt-daily.service
$ sudo systemctl mask apt-daily.timer