Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On my Debian 6.0.8 system the /etc/cron.daily/apt file is missing. Therefore, unattended upgrades do not work.

How can I recreate/fix /etc/cron.daily/apt?

share|improve this question
    
It will not help with this problem but to prevent future issues may I suggest etckeeper. All you would have to do is use git to revert the change: joeyh.name/code/etckeeper –  dfc Jan 20 at 3:03

2 Answers 2

up vote 4 down vote accepted

first find which package contains the missing file:

$ dpkg --search /etc/cron.daily/apt
apt: /etc/cron.daily/apt

which is that case is the package "apt", and then re-install it:

$ sudo apt-get -o Dpkg::Options::="--force-confmiss" --reinstall install apt

edit: added the option to force the miss conf

share|improve this answer
1  
This won't work as the missing file is in /etc and is considered a config file. As such it won't be installed again when doing --reinstall; unless you se -o DPkg::options::=--force-confmiss –  alxgomz Jan 19 at 11:32
    
Correct, in that case we need to use the -o Dpkg::Options::="--force-confmiss", so for that example it's $ sudo apt-get -o Dpkg::Options::="--force-confmiss" --reinstall install apt –  theofpa Jan 19 at 11:37
    
This was very helpful as my virtual hosting provider decided it would be a good idea to remove this file, so even though I thought I had enabled automatic security updates, nothing was actually updated. –  Alex Dupuy 2 days ago

You should extract the apt deb package in a temp location and then copy the missing file to where it should be. For instance if your apt cache still contains the deb package apt you can do:

cd /tmp
dpkg -x /var/cache/apt/archives/apt_0.9.7.9+deb7u1_amd64.deb .
cp /tmp/etc/cron.daily/apt /etc/cron.daily/

If you don't have the deb file in your cache anymore, just download it and apply the same procedure.

share|improve this answer

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.