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?

  • 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 '14 at 3:03

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

| 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 '14 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 '14 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 Sep 29 '14 at 15:10
  • Same thing here with OpenVZ ubuntu-12.04-x86_64.tar.gz template. – Jaime Hablutzel Apr 8 '15 at 17:46

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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