Bug 2326532

Summary: The minimum required space for the root partition of a live installation is incorrectly defined
Product: [Fedora] Fedora Reporter: Claus Conrad <lists>
Component: anacondaAssignee: anaconda-maint
Status: POST --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 42CC: anaconda-maint, awilliam, jkonecny, kkoukiou, lists, mkolman, rvykydal, w
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: f42webuitestday
Fixed In Version: anaconda-42.16 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Partitioning
none
Welcome screen
none
Reclaim space
none
Summary
none
Error
none
journal.output none

Description Claus Conrad 2024-11-15 17:09:57 UTC
After guided shrink, the installation of the boot manager fails. See "Steps to Reproduce" for more details.

Reproducible: Didn't try

Steps to Reproduce:
1. Use the Debian 12 ISO to create the following partitions on an empty disk:
  1. An EFI System (ESP) of ~1 GB (mounted at /boot/efi in Debian)
  2. An ext4 of ~6.4 GB (mounted at / in Debian)
  3. An ext4 of the remaining space (mounted at /home in Debian)
2. Complete the Debian 12 installation. Make sure it can boot.
3. Boot the Rawhide ISO. Select "Share disk with other operating system" and note that "Reclaim space" is enabled and cannot be disabled (as expected, since there is not enough space for a new partition).
4. Select to reclaim 3 GB from the ~6.4 GB ext4 partition.
Actual Results:  
At the step "Installing the bootloader", this error message appears:
> org.fedoraproject.Anaconda.Error: [Errno 2] No such file or directory: 'efibootmgr'
An empty log area is displayed.

Expected Results:  
Installation completes successfully.

Comment 1 Claus Conrad 2024-11-15 17:13:40 UTC
Created attachment 2057945 [details]
Partitioning

Comment 2 Claus Conrad 2024-11-15 17:15:12 UTC
Created attachment 2057946 [details]
Welcome screen

Comment 3 Claus Conrad 2024-11-15 17:15:50 UTC
Created attachment 2057947 [details]
Reclaim space

Comment 4 Claus Conrad 2024-11-15 17:16:29 UTC
Created attachment 2057948 [details]
Summary

Comment 5 Claus Conrad 2024-11-15 17:16:54 UTC
Created attachment 2057949 [details]
Error

Comment 6 Katerina Koukiou 2024-11-18 08:26:22 UTC
I am able to reproduce, when the allocated size reclaimed for the new installation is very close to the required limits.

Attaching some logs for debug purposes in case someone else takes a look.

Comment 7 Katerina Koukiou 2024-11-18 08:27:01 UTC
Created attachment 2058459 [details]
journal.output

Comment 8 Katerina Koukiou 2024-11-18 12:26:22 UTC
This is most likely an issue in the anaconda backend, which incorrectly calculates the requires space for the installation.
Also I believe rsync silently fails because of missing space, therefore the target root is not populated fully, leading to this red-herring error we see here.

Comment 9 Katerina Koukiou 2024-11-18 13:35:08 UTC
Indeed, the backend was silencing rsync exceptions. https://github.com/rhinstaller/anaconda/pull/6006
After fixing that, it's clear that this fails on low space.

So this bug report now aims to anaconda backend incorrectly calculating the required space for installation on Live Image.

The calculation is done like this:

    def _calculate_required_space(self):
        """Calculate size of the live image image."""
        source = os.statvfs(self._target_mount)
        required_space = source.f_frsize * (source.f_blocks - source.f_bfree)
        log.debug("Required space: %s", Size(required_space))
        return required_space

This calculation only considers used blocks in the source filesystem but does not account for additional space requirements during the installation process, aka metadata, journaling, or system overhead.

There have been similar bugs in the past, but closed as wontfix. See https://fedoraproject.org/wiki/Common_F16_bugs#Minimum_space_for_Desktop_live_install_incorrectly_calculated

Comment 10 Adam Williamson 2024-11-25 16:25:15 UTC
I believe https://github.com/rhinstaller/anaconda/pull/6009 is meant to address this?

Comment 11 Katerina Koukiou 2024-11-27 08:06:12 UTC
@Adam yes, fix is contained in anaconda-42.16

Comment 12 Aoife Moloney 2025-02-26 13:16:38 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.