Bug 2068290

Summary: Required space calculation includes room for swap partition even if one won't be created
Product: [Fedora] Fedora Reporter: Adam Williamson <awilliam>
Component: anacondaAssignee: Anaconda Maintenance Team <anaconda-maint-list>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 37CC: anaconda-maint-list, hobbes1069, jonathan, kellin, vanmeeuwen+fedora, vponcova, vslavik, w
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: anaconda-37.12-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-12-13 17:20:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Adam Williamson 2022-03-24 20:10:57 UTC
When you go through INSTALLATION DESTINATION and pick automatic partitioning, anaconda runs a calculation of whether there's enough free space and requires you to clear some if there isn't enough.

This calculation seems to *always* include space for a swap partition, even though on Fedora we do not create one by default any more since https://fedoraproject.org/wiki/Changes/SwapOnZRAM . The calculation is done here:

https://github.com/rhinstaller/anaconda/blob/c714884495691310b44305e09c24c1522c50d70a/pyanaconda/ui/gui/spokes/storage.py#L622

It *always* includes space for a swap partition - `auto_swap = suggest_swap_size()` , then includes `auto_swap` in subsequent calculations and calls - without regard to whether the automatic partitioning will actually create one.

I believe this code was written before the swaponzram change and just nobody realized it would need updating with that change; before that change, we could assume that automatic partitioning would always include a swap partition of the size suggested by `suggest_swap_size()`, but these days that is no longer a safe assumption.

Note I think there *are* still some cases in which a swap partition is included, so we need to do some kind of check as to whether one is going to be included, we can't just switch to *always* not including it in the calculation.

Comment 1 Adam Williamson 2022-03-24 20:11:51 UTC
Sorry, forgot to credit Richard Shaw for this discovery - I'm just passing the report along:

https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/OAQTWLBNZQ54OZE7FHJQYZDVY4FQO5NG/

Comment 2 Vendula Poncova 2022-07-26 14:25:09 UTC
Fixed in https://github.com/rhinstaller/anaconda/pull/4238.

Comment 3 Adam Williamson 2022-07-26 21:30:25 UTC
Woohoo! Thanks.

Comment 4 Ben Cotton 2022-08-09 13:41:35 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle.
Changing version to 37.