Bug #12400

tails-additional-software should clean obsolete cached .deb's

Added by intrigeri 2017-03-21 08:01:23 . Updated 2017-06-12 16:10:08 .

Status:
Resolved
Priority:
Elevated
Assignee:
Category:
Target version:
Start date:
2017-03-21
Due date:
% Done:

100%

Feature Branch:
bugfix/12400-additional-software-autoclean
Type of work:
Code
Blueprint:

Starter:
Affected tool:
Additional Software Packages
Deliverable for:

Description

… otherwise obsolete packages will pile up endlessly: we’ve had to disable apt-daily.timer to ensure it doesn’t 1. waste RAM; 2. run at the same time as tails-additional-software (which would break the latter).

I think this must be run:

  • after a successful apt-get update (once APT knows which packages are not available anymore)
  • before the installation step (so that we don’t try to store all packages twice, e.g. after upgrading to 3.0)

It would be nice if this was done in time for Tails 3.0, so that Jessie packages are removed from the cache and this feature doesn’t suddenly require twice as much storage space as before on the Persistent volume.


Subtasks


Related issues

Related to Tails - Bug #12390: Consider disabling apt-daily.timer Resolved 2017-03-20

History

#1 Updated by intrigeri 2017-03-21 08:01:32

  • related to Bug #12390: Consider disabling apt-daily.timer added

#2 Updated by intrigeri 2017-03-21 08:01:44

  • Assignee set to alant

Alan, wanna take care of this?

#3 Updated by intrigeri 2017-04-15 16:23:36

  • Priority changed from Normal to Elevated

Ping? This has the potential to break stuff on upgrades to 3.0, so if you can’t handle it by May 15, please reassign to me :)

#4 Updated by alant 2017-05-11 16:42:21

  • Status changed from Confirmed to In Progress

I’m taking care of this during the upgrade setp, between `apt-get update` and `apt-get install`.
I don’t see the need of doing it during the initial install, as there is no reason for the cache to have changed since the last update.

#5 Updated by alant 2017-05-11 17:09:07

  • Assignee changed from alant to intrigeri
  • QA Check set to Ready for QA
  • Feature Branch set to bugfix/12400-additional-software-autoclean

I think the feature branch fixes the issue. Tested by live patching only though.

#6 Updated by intrigeri 2017-05-16 13:53:26

  • % Done changed from 0 to 60

Code review passes, pushed a few typo fixes on top. Will set up a persistence on 2.x with additional packages, upgrade to an ISO built from this branch, and see if it indeeds deletes the obsolete packages.

#7 Updated by intrigeri 2017-05-16 15:22:47

  • Target version changed from Tails_3.0 to Tails_3.0~rc1

#8 Updated by intrigeri 2017-05-16 17:54:55

  • Assignee changed from intrigeri to alant
  • Target version changed from Tails_3.0~rc1 to Tails_3.0
  • QA Check changed from Ready for QA to Dev Needed

So the code works as intended, but apt-get autoclean doesn’t do what we want: the old, i386 packages are still around, and thus the issue this ticket is about is still there.

#9 Updated by intrigeri 2017-05-16 17:59:53

One (ugly, but simple and efficient) way to solve the problem could be to delete all .deb’s from the cache whenever i386 APT lists are present. This could be done very early, even before running apt-get update, as on a Tails amd64 system we know these lists shouldn’t be around.

#10 Updated by intrigeri 2017-05-16 18:00:22

  • Subject changed from tails-additional-software should run apt-get autoclean to tails-additional-software should clean obsolete cached .deb's

#11 Updated by alant 2017-06-03 16:43:11

  • Assignee changed from alant to intrigeri
  • % Done changed from 60 to 70
  • QA Check changed from Dev Needed to Ready for QA

> One (ugly, but simple and efficient) way to solve the problem could be to delete all .deb’s from the cache whenever i386 APT lists are present.

Done, please review.

#12 Updated by intrigeri 2017-06-03 18:19:26

Code review:

  • IMO the variable name must be updated in notify_user = subprocess.check_output, now that notify_user is a different kind of beast => commit:fbcfa32163a2d8b91a1e66fe9cb8f6e31a6c6ca2
  • “when a package list matches pattern” doesn’t match what the code currently does => commit:a88cadd3a50240c166c2d2459ed37ae73528a854
  • I’d rather see the call to clear_obsolete_cache not make the whole thing abort if there’s any problem => commit:85c648ec1a4103f5084d4b50272451e22ad47fab
  • I felt the “Remove outdated packages from the local package cache […]” comment was now misleading, i.e. it didn’t take into account my previous review => commit:027ef9dfbb5c1b247be849d6afc6a7d4fa52ba9e.

I’ll now test the current state of my (not pushed yet branch):

  1. start Tails 2.12 on a USB stick
  2. create a persistent volume & enable APT features
  3. reboot and unlock persistence
  4. add packages to the list of additional software
  5. reboot
  6. check that the expected packages are in the cache
  7. shutdown
  8. upgrade the USB stick with an ISO built from the topic branch
  9. boot the resulting USB stick, unlock persistence
  10. check that the old packages are gone and the new ones are installed
  11. check in the logs that nothing bad happened

#13 Updated by intrigeri 2017-06-04 08:48:36

  • Assignee changed from intrigeri to alant
  • % Done changed from 70 to 80

Tests completed successfully => assuming you’ll trust my testing procedure, please review my code changes and merge into testing (and then testing into devel). Thanks!

#14 Updated by alant 2017-06-04 15:32:48

  • Status changed from In Progress to Fix committed
  • Assignee deleted (alant)
  • % Done changed from 80 to 100

Merged, thanks!

#15 Updated by anonym 2017-06-08 13:10:59

  • QA Check changed from Ready for QA to Pass

#16 Updated by intrigeri 2017-06-12 16:10:08

  • Status changed from Fix committed to Resolved