Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question
    
anything like synaptic or software center open ? –  AgentCool Feb 7 '13 at 15:56
    
No. At the time of this customization script no user is connected, except the one how run the scripts. –  samb Feb 8 '13 at 7:58

1 Answer 1

up vote 1 down vote accepted

you could stop automatic updates from the settings of the update manager.

all you need to do is simply setting it to Never.enter image description here

There in the Image set Automatically check for updates as Never and there on wards you have to check for updates everytime.

share|improve this answer
    
I guess this is the good way to do it. The equivalent in command line (as averything is automated in our case) is to patch the /etc/apt/apt.conf.d/10periodic file. –  samb Feb 8 '13 at 8:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.