Bug 457868

Summary: Offline updater does not check if enough disk space is available before updating
Product: [Applications] Discover Reporter: Kishore Gopalakrishnan <kishore96>
Component: Updates (offline)Assignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: major CC: aleixpol, madLyfe, nate
Priority: NOR    
Version: master   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 5.26
Sentry Crash Report:

Description Kishore Gopalakrishnan 2022-08-14 07:41:03 UTC
SUMMARY
If the hard disk becomes full during an offline update, the update seems to fail halfway, and then various bad things happen (e.g. kernel panic on boot if the newest kernel could not be installed properly). If an offline update would make the disk full, Discover should refuse to do an offline update, and instead ask the user to free up enough space first.

STEPS TO REPRODUCE
1. Perform an offline update when the root partition is very close to full

OBSERVED RESULTS
I left my machine at the screen that said 'preparing updates'. After some time, I noticed a kernel panic screen (something about being unable to mount root). Booting from an older kernel (in grub) worked, and then I found out that my root partition was full, which probably made the installation fail halfway, leaving the system in a broken state.

EXPECTED RESULTS
If the free space is too low to perform an update successfully, the system should refuse to perform an offline update (at least with an online update, you have the option to free up space and fix things before rebooting).

SOFTWARE VERSIONS
(This is in a virtual machine)
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.25.80
KDE Frameworks Version: 5.97.0
Qt Version: 5.15.5
Kernel Version: 5.15.0-46-generic (64-bit)
Graphics Platform: X11
Processors: 2 × AMD EPYC Processor (with IBPB)
Memory: 1.9 GiB of RAM
Graphics Processor: virgl
Manufacturer: QEMU

ADDITIONAL INFORMATION
May be related to https://bugs.kde.org/show_bug.cgi?id=436285 (see https://bugs.kde.org/show_bug.cgi?id=436285#c7)

Not sure if this is a bug in Discover or packagekit
Comment 1 Nate Graham 2022-08-15 18:24:00 UTC
> Not sure if this is a bug in Discover or packagekit

Discover should handle this case regardless.
Comment 2 Aleix Pol 2022-08-23 16:20:44 UTC
How would we know if there's enough space to perform an update? we check if the free space is bigger than the download size?
Comment 3 Nate Graham 2022-08-23 16:55:15 UTC
Yeah.
Comment 4 Bug Janitor Service 2022-08-26 10:36:13 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/discover/-/merge_requests/361
Comment 5 Aleix Pol 2022-08-30 23:10:03 UTC
Git commit b3d8fbef0788144ad7385247bb3b615b6ae6e808 by Aleix Pol Gonzalez, on behalf of Aleix Pol i Gonzalez.
Committed on 30/08/2022 at 23:08.
Pushed by apol into branch 'master'.

pk: Include an error message when there is not enough space for an update

It can prevent users getting in an unfortunate situation.
There are some cases where this error might not apply, so there's a
button to dismiss the message.

M  +38   -1    discover/qml/UpdatesPage.qml
M  +1    -0    libdiscover/backends/DummyBackend/DummyBackend.cpp
M  +9    -0    libdiscover/backends/PackageKitBackend/PackageKitUpdater.cpp
M  +9    -0    libdiscover/resources/AbstractBackendUpdater.cpp
M  +11   -0    libdiscover/resources/AbstractBackendUpdater.h
M  +16   -0    libdiscover/resources/ResourcesUpdatesModel.cpp
M  +4    -0    libdiscover/resources/ResourcesUpdatesModel.h

https://invent.kde.org/plasma/discover/commit/b3d8fbef0788144ad7385247bb3b615b6ae6e808
Comment 6 Kishore Gopalakrishnan 2022-09-03 11:32:19 UTC
*** Bug 436285 has been marked as a duplicate of this bug. ***