3

Following the Debian wiki documentation and this answer I have successfully set up unattended upgrades. I have confirmed that upgrades are really run.

However, I want to avoid eventually getting disk space problems, so I want to make sure that apt clean is also run regularly.

The Debian documentation seems to imply that I need create a file at /etc/apt/apt.conf.d/02periodic and add something like this to it

APT::Periodic::AutocleanInterval "21";

But I haven't needed any of the other settings suggested for that file (such as APT::Periodic::Enable "1").

I find the wiki page really confusing. It suggests two completely different ways of configuring when to run unattended upgrades: Automatic call via /etc/apt/apt.conf.d/02periodic and Modifying download and upgrade schedules (on systemd), but gives no indication when or why you would use one or the other. I've used the latter way, since that seemed simplest.

/lib/systemd/system/apt-daily-upgrade.timer (which is definitely run) clearly states

Description=Daily apt upgrade and clean activities

Note the and clean.

So, will I get automatic apt clean without creating a 02periodic, or not?

  • 1
    This is a general Debian question and has nothing to do with Raspberry Pi. – Ingo Mar 24 '19 at 16:33
  • 1
    I'm new to both Raspberry Pi and Debian, so it is quite possible that I have misclassified my question, but it depends on what the answer is. One could have assumed that unattended upgrades themselves would be identical in Debian and Raspberry Pi, but they are not, which can be seen in one of the answers that I refer to in my question. – Klas Mellbourn Mar 24 '19 at 18:01
  • I think that the answer to my question is "no". You have to do the following, since autoclean is not turned on by default: echo 'APT::Periodic::AutocleanInterval "7";' | sudo tee -a /etc/apt/apt.conf.d/20auto-upgrades – Klas Mellbourn Apr 20 '19 at 09:59
  • Please make your comment an answer. This will finish the question and show others that it has a solution. After two days you can accept your own answer. – Ingo Apr 20 '19 at 10:39

1 Answers1

1

I think that the answer to my question is "no".

You have to do the following, since autoclean is not turned on by default:

echo 'APT::Periodic::AutocleanInterval "7";' | sudo tee -a /etc/apt/apt.conf.d/20auto-upgrades

I have confirmed that this causes cleanup of files in /var/cache/apt/archives/ that would otherwise have been left there.