Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pull_with_options uses /var/tmp as tmp space, preventing pulling big files during kickstart installs #2571

Closed
champtar opened this issue Mar 25, 2022 · 8 comments · Fixed by #2875 or #2913

Comments

@champtar
Copy link

Using libostree/2021.3 (Alma 8.5)
I'm trying to install a tree over https containing big files (~1.5G) using anaconda/kickstart
While anaconda is running /var/tmp only has 800 Mo free (/dev/mapper/live-rw), and once pull_with_options pulls a big file, running df -h, I can see / fill up until I get a No space left on device.
lsof /var/tmp shows a deleted file:
image

file:// install are working but not https:// (so either libcurl or the code around it need love)
If possible tmp space should be in the ostree repo dir by default IMO.

As a workaround we can just mount a tmpfs on top of /var/tmp:

%pre
mount -t tmpfs -o size=100% tmpfs /var/tmp/
%end
@cgwalters
Copy link
Member

If possible tmp space should be in the ostree repo dir by default IMO.

Yes; hmm, AFAICS this should be the case right now. This needs a bit more debugging; there's various places where we pass the tempdir down, and it should point to the repository tmpdir i.e. /ostree/repo/tmp.

@champtar
Copy link
Author

Do you know if it shipped with 8.7, IE should I try again ?

@NeilHanlon
Copy link

Heya - Just a note as I am experiencing this as well in the current 8.8 releases with the following ostree/rpm-ostree.

ostree-2022.2-6.el8
rpm-ostree-2022.10.115.g15eba7b1-2.el8_8

More than happy to try and debug this -- I was looking into the code which performs the download and found my way toward the libGObject interfaces for ostree and rpm-ostree, but would appreciate any pointers you have to where I can look further, @cgwalters.

FYI the versions above are from Rocky Linux 8.8, but I did confirm it occurs w/ RHEL versions, too.

@dbnicholson
Copy link
Member

I'm pretty sure this is from the fetcher. Unless OSTREE_FETCHER_REQUEST_LINKABLE is set (which is not the common case AFAICT), _ostree_fetcher_tmpf_from_flags uses glnx_open_anonymous_tmpfile, which uses TMPDIR or /var/tmp as a fallback.

@dbnicholson
Copy link
Member

So, I believe as a workaround you can set TMPDIR to somewhere with lots of space (potentially /ostree/repo/tmp) and see if that avoids the problem.

@cgwalters
Copy link
Member

Right, the _LINKABLE flag is set if

  if (!is_meta && pull_data->trusted_http_direct)
    flags |= OSTREE_FETCHER_REQUEST_LINKABLE;

That logic dates to 2e3889a

Which directly writes to the repo only if we're not verifying checksums.

But that's a bug; first, we should always be opening the tempfile in the repo location because that's where the space will be allocated.

Second, it'd actually be a lot more efficient to just verify the checksum as we're fetching and then if that passes, directly use that fd we allocated for the final file.

cgwalters added a commit to cgwalters/ostree that referenced this issue Jun 6, 2023
In an installation environment (like a live ISO) we may
not have significant space outside of the target installation
repository.

There's no reason not to always open a linkable tempfile.  In
the future we should fix the pull path to verify the checksum
and then just directly link in the object instead of copying.

Closes: ostreedev#2571
@cgwalters
Copy link
Member

PR in #2875

@cgwalters
Copy link
Member

xref #2900 (comment) - when we aim to re-land this it'll need to be done in a way that avoids breaking flatpak (even if we find a flatpak fix, we should be conservative and still work with older versions).

cgwalters added a commit to cgwalters/ostree that referenced this issue Jun 29, 2023
This reverts commit 4e61e6f
and re-instates the fix for ensuring that we download temporary
files into the repository location.

However in order to ensure we don't re-introduce
ostreedev#2900
we detect the case where we're writing to a FUSE mount
and keep the prior behavior.

I've verified that this works with flatpak.

Note a downside of this is the change needs to be triplicated
across the 3 http backends.

This then again
Closes: ostreedev#2571
cgwalters added a commit to cgwalters/ostree that referenced this issue Jul 5, 2023
This reverts commit 4e61e6f
and re-instates the fix for ensuring that we download temporary
files into the repository location.

However in order to ensure we don't re-introduce
ostreedev#2900
we detect the case where we're writing to a FUSE mount
and keep the prior behavior.

I've verified that this works with flatpak.

Note a downside of this is the change needs to be triplicated
across the 3 http backends.

This then again
Closes: ostreedev#2571
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants