In a production context, we run scripts to configure/customize the OS. It makes intensive use of apt-get (to install, remove, update, upgrade packages).
Unfortunately it happens (especially just after system boot) that another process starts to do things in background and locks the dpkg status database. It gives the following error :
dpkg: error: dpkg status database is locked by another process
E: Sub-process /usr/bin/dpkg returned an error code (2)
For an end-user this is probably strange but not a big problem since they can just try again a few seconds later. But for instructions in a script .This is very annoying.
My first guess is about some cron/anacron jobs to check package updates. Is there a way to prevent such jobs from running during that time?
Thanks
you could stop automatic updates from the settings of the update manager.
all you need to do is simply setting it to Never.
There in the Image set Automatically check for updates as Never and there on wards you have to check for updates everytime.