Bug 431886 - Discover "Housekeeping" - Wishlist
Summary: Discover "Housekeeping" - Wishlist
Status: RESOLVED UPSTREAM
Alias: None
Product: Discover
Classification: Applications
Component: PackageKit (other bugs)
Version First Reported In: 5.20.5
Platform: Neon Linux
: NOR wishlist
Target Milestone: ---
Assignee: Dan Leinir Turthra Jensen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-21 19:00 UTC by tagwerk19
Modified: 2021-02-04 09:52 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tagwerk19 2021-01-21 19:00:44 UTC
SUMMARY:

    System Updates with Discover seem to leave cached installation files
    and older kernel versions on disc (/var/cache/apt/archives, /boot,
    /usr/lib/modules)

    Maybe it is expected that people know that they need to watch for
    and clean up "the debris". However some sanity checks within Discover
    would help to give a heads up about "eaten up" disc space or, maybe,
    include an option to tidy up old files within Discover.

STEPS TO REPRODUCE:

    Install a Neon system, install filelight (because it is a useful
    thing to have), wait and regularly install updates for a few months.
    Keep watch on disc usage with filelight

OBSERVED RESULTS

    The /var/cache/apt/archives folder steadily grows.

    The number of kernels grow, as can be seen in /boot (as is referred
    to in Bug 430296)

    The number of kernel modules directories grow with each kernel update,
    each of which can take 250 Mbyte.

    The number of initrd files also grows and, from the modification dates,
    they may all need to be rebuilt on a kernel update. In that case the
    update takes markedly longer (Discover waits at 99%) 

EXPECTED RESULTS

    Would expect discover to keep the the last three kernels and files
    and delete the older ones (with an option to keep a "preferred number").

    Would expect a warning if the /var/cache/apt/archives folder grows
    beyond a certain threshold and/or to clean-out old downloads.

SOFTWARE/OS VERSIONS

    Neon Testing
    Discover : 5.20.5
    Plasma : 5.20.5
    Frameworks : 5.79.0
    Qt : 5.15.2

ADDITIONAL INFORMATION

    The behaviour seems io be distro specific, Fedora KDE seems to cope.

    There is also the possibility that the behaviour I'm seeing is the
    result of something I've done or installed - and it all works perfectly
    for other people 8-/
Comment 1 Nate Graham 2021-01-22 14:43:40 UTC
I have noticed this too.

Might be due to the system's own policies, how PackageKit interprets them, or how Discover is calling Packagekit.
Comment 2 tagwerk19 2021-01-29 10:32:40 UTC
(In reply to tagwerk19 from comment #0)

>     The number of initrd files also grows and, from the modification dates,
>     they may all need to be rebuilt on a kernel update. In that case the
>     update takes markedly longer (Discover waits at 99%) 

The rebuild of the initrd* files doesn't happen each time; noticed it when updating linux-firmware
Comment 3 Harald Sitter 2021-02-01 11:00:06 UTC
The archives cache is a cache see `man apt.conf`

The installed kernel topic is tricky though.
The apt in ubuntu 22.04 will eventually fix that [1] with a new option that will be on for packagekit by default, the apt in 20.04 doesn't have that feature.

Apt currently only has a sledge hammer version [2] which is technically accessible by setting autoremove on remove transactions (which discover does not do). That would, as far as I understand the code, remove all dangling packages with aptcc, albeit only when removing something not when upgrading. So it'd only be somewhat helpful anyway and I'm not quite sure it's entirely safe to use - the kernel use case is fine there are guards in place, but everything else might get nuked.

In conclusion I'm leaning towards closing this as an upstream bug and its been fixed upstream already but won't arrive in neon before 2022.
Somewhat relatedly I do already have plans to add space monitoring for /boot to prevent the user from running out of space for kernel updates without warning.

[1] https://salsa.debian.org/apt-team/apt/-/commit/944baec85a7496c1595242a31f6b1b37530451a5
[2] https://github.com/hughsie/PackageKit/issues/201
Comment 4 Nate Graham 2021-02-01 14:58:37 UTC
Well if there's nothing Discover can do, there's nothing Discover can do. :) We could close this as UPSTREAM or else move it to Neon for you folks to implement some kind of interim workaround I suppose. Your choice.
Comment 5 Harald Sitter 2021-02-01 15:30:11 UTC
I don't really see an opportunity for a neon specific workaround. The plan I have for /boot space monitoring in plasma would prevent the most pressing issue of suddenly running out of disk space for new kernel updates. For the general fact that the space footprint of the system keeps growing I'm sure we can wait another year after having lived with the situation for 5 years already ^^

In the meantime users can run
> sudo apt-get --purge autoremove
every once in a while to review the list of dangling packages and have them purged from the system.

Closing as upstream bug.
Comment 6 tagwerk19 2021-02-03 18:03:55 UTC
I suppose the 'dividing line' is whether there are available options in pkcon or not.

I don't see anything that might wrap an "apt-get clean".

I do see a "pkcon --autoremove" option (is it "live"? I've not managed to get it to do anything). With an 'apt autoremove', I see kernels 5.4.0-42 and before cleaned up

With an 'apt-get clean' I've seen about 6 GB tidied from /var/cache. For small VM's (my particular use case), that's a good proportion 8-/
Comment 7 Harald Sitter 2021-02-04 09:52:01 UTC
(In reply to tagwerk19 from comment #6)
> I suppose the 'dividing line' is whether there are available options in
> pkcon or not.
> 
> I don't see anything that might wrap an "apt-get clean".
> 
> I do see a "pkcon --autoremove" option (is it "live"? I've not managed to
> get it to do anything). With an 'apt autoremove', I see kernels 5.4.0-42 and
> before cleaned up

--autremove is not a command you'd use in combination with a command. `pkcon --autoremove remove kwrite`.