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

Avoid re-downloading dom0 update metadata after every restart of template-based UpdateVM #6250

Open
mattmccutchen opened this issue Dec 2, 2020 · 15 comments
Labels
C: updates P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.

Comments

@mattmccutchen
Copy link

mattmccutchen commented Dec 2, 2020

Qubes OS version: R4.0

Affected component(s) or functionality: qubes-dom0-update

Brief summary: If the UpdateVM is a template-based VM, then the dom0 update metadata cache in /var/lib/qubes/dom0-updates/var/cache is lost every time the UpdateVM restarts. This makes qubes-dom0-update periodically re-download tens of megabytes of Fedora 25 repository metadata that are no longer changing, which is slow and unnecessarily burdens the Fedora servers.

How Reproducible: Always (under the conditions previously described)

To Reproduce

Steps to reproduce the behavior:

  1. Choose an UpdateVM that is a template-based VM.
  2. Run sudo qubes-dom0-update in a dom0 terminal.
  3. Restart the UpdateVM.
  4. Run sudo qubes-dom0-update in a dom0 terminal again.

Expected behavior: Unchanged repository metadata such as that of the Fedora 25 repositories is not re-downloaded.

Actual behavior: The metadata is re-downloaded, as one can see from the progress output.

Screenshots: I didn't think to take one before manually fixing the problem on my system, and I suspect reverting the fix to take one would have little value in this case.

Additional context: None.

Solutions you've tried: Manually create a directory under /rw in the UpdateVM, and symlink /var/lib/qubes/dom0-updates to it in the TemplateVM. (FTR, I found two problems with symlinking only /var/lib/qubes/dom0-updates/var/cache: the find command doesn't traverse the symlink (though that could easily be changed) and the ln command fails because it is cross-filesystem. It seems harmless to me to symlink the entire /var/lib/qubes/dom0-updates.)

Relevant documentation you've consulted: https://www.qubes-os.org/doc/software-update-dom0/

Related, non-duplicate issues: None found.

I'd be interested in trying my hand at a fix if the maintainers give some tips about the approach they would accept, but this may be low on my long task list.

@mattmccutchen mattmccutchen added P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists. labels Dec 2, 2020
@DemiMarie
Copy link

Fixing this is quite simple: use a file under /etc/qubes-bind-dirs.d to ensure that /var/lib/qubes/dom0-updates is bind-mounted to a directory under /rw. A symlink would also work, but getting RPM to handle it correctly seems somewhat tricky.

@andrewdavidwong
Copy link
Member

andrewdavidwong commented Dec 4, 2020

This makes qubes-dom0-update periodically re-download tens of megabytes of Fedora 25 repository metadata that are no longer changing, which is slow and unnecessarily burdens the Fedora servers.

I would think that the obvious solution is to disable the EOL Fedora 25 repos, which can only serve as an attack vector at this point (related: #6186).

By contrast, a persistent cache would have the side effect of consuming disk space, which we've found many users to be extremely sensitive about.

I think the difference between the issue title and issue description represents an XY problem as currently stated and risks being a "won't do" due to the aforementioned side effect, so I'll update the title to match the actual problem stated in the description.

@andrewdavidwong andrewdavidwong changed the title dom0 update metadata cache should persist across UpdateVM restarts Unchanging Fedora 25 repository metadata is re-downloaded with every dom0 update Dec 4, 2020
@andrewdavidwong andrewdavidwong added this to the Release 4.0 updates milestone Dec 4, 2020
@mattmccutchen mattmccutchen changed the title Unchanging Fedora 25 repository metadata is re-downloaded with every dom0 update Re-downloading dom0 update metadata after every restart of template-based UpdateVM is wasteful Dec 4, 2020
@mattmccutchen
Copy link
Author

I would think that the obvious solution is to disable the EOL Fedora 25 repos, which can only serve as an attack vector at this point (related: #6186).

Are we assuming that by the time each future Qubes OS version is released, the dom0 Fedora version will be EOL, or that users will never install any dom0 Fedora packages beyond the ones that come with the installer? I for one am one of those lower-class Qubes OS users who installs things like cdparanoia in dom0 because there isn't another practical way on Qubes OS and I can't be bothered to dual boot just for this, so I'll be reverting the change locally.

Also, I cited the unchanging Fedora repos as the most egregious example, but the qubes-dom0-current metadata is also 21 MB and I restart my UpdateVM much more frequently than the metadata_expire setting of the repo (7 days). (I wonder whether 7 days is too long for security updates, but that's another story.)

By contrast, a persistent cache would have the side effect of consuming disk space, which we've found many users to be extremely sensitive about.

Is this any worse than the persistent cache that each system volume will have of the in-VM package metadata under any mainstream setup?

I think the difference between the issue title and issue description represents an XY problem as currently stated and risks being a "won't do" due to the aforementioned side effect, so I'll update the title to match the actual problem stated in the description.

I updated it again to reflect the more general problem I intended to report.

@andrewdavidwong
Copy link
Member

Are we assuming that by the time each future Qubes OS version is released, the dom0 Fedora version will be EOL

Not necessarily. Historically, this has not always been the case.

or that users will never install any dom0 Fedora packages beyond the ones that come with the installer? I for one am one of those lower-class Qubes OS users who installs things like cdparanoia in dom0 because there isn't another practical way on Qubes OS and I can't be bothered to dual boot just for this, so I'll be reverting the change locally.

The need to install packages in dom0 is a fair point, but it is done very rarely compared to checking for Qubes dom0 updates, so it still seems wasteful and time-consuming to download Fedora repo metadata every time after that upstream version has reached EOL. It seems like it would be better just to enable the repo whenever you need to use it to install a package, but I suppose most users won't know how to do that, even if we document it.

Is this any worse than the persistent cache that each system volume will have of the in-VM package metadata under any mainstream setup?

I don't know, but I doubt that would matter to the users who are very sensitive about disk space. On the other hand, #1957 seems somewhat popular, so perhaps there's hope.

@mattmccutchen
Copy link
Author

@andrewdavidwong OK. I think I've presented all the relevant facts, so I'll trust your judgment on the best default for Qubes OS and do whatever I need to do on my own system. If there's a simple contribution you'd like me to try to make, let me know.

@andrewdavidwong
Copy link
Member

@andrewdavidwong OK. I think I've presented all the relevant facts, so I'll trust your judgment on the best default for Qubes OS and do whatever I need to do on my own system.

I was just sharing my opinion. It'll be up to the devs, especially @marmarek, to decide.

If there's a simple contribution you'd like me to try to make, let me know.

Thank you! I'll leave it to the devs to let you know if there's anything you can do.

@iacore
Copy link

iacore commented Apr 9, 2022

This is still slow. Fedora 32 metadata is 90MB in size; dnf is impossible use under poor Internet connection. I can't even install security updates.

Workaround: Use standalone VM as updatevm

@DemiMarie
Copy link

DemiMarie commented Apr 9, 2022

@marmarek can we only re-download the Fedora 32 metadata when we need it?

Edit: What if we shipped it as a file:/// URL?

@logoerthiner1
Copy link

I have just tried cd /etc/yum.repos.d && sudo mkdir old && sudo mv fedora* old to disable fedora 32 update in dom0. Are there any security consequences or other types of consequences by doing this, and is this suggested or not suggested?

@iacore
Copy link

iacore commented Apr 10, 2022

@logoerthiner1 You probably can't install xen then.

@andrewdavidwong
Copy link
Member

I have just tried cd /etc/yum.repos.d && sudo mkdir old && sudo mv fedora* old to disable fedora 32 update in dom0. Are there any security consequences or other types of consequences by doing this, and is this suggested or not suggested?

Please note that the issue tracker (qubes-issues) is not intended to be a place for fielding questions. Instead, we have other venues meant for asking questions, asking for help, and having discussions. (By contrast, the issue tracker is more of a technical tool intended to support our developers in their work.) Thank you for your understanding!

@andrewdavidwong
Copy link
Member

Is this still a problem in 4.1?

@mattmccutchen
Copy link
Author

Is this still a problem in 4.1?

Yes: on my main system (which is now running Qubes 4.1), I temporarily reverted my workaround and performed the original steps to reproduce, and all of the dom0 repository metadata (both Fedora 32 and Qubes 4.1) was re-downloaded.

@andrewdavidwong
Copy link
Member

After skimming this issue and comments again to refresh my memory, this sounds more like an enhancement request than a bug report. It doesn't sound like there's actually a bug in the current update process. It just hasn't been optimized and has a lot of room for improvement. If I've misunderstood, let me know.

@andrewdavidwong andrewdavidwong added T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality. and removed T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists. labels Apr 9, 2023
@andrewdavidwong andrewdavidwong modified the milestones: Release 4.1 updates, Release TBD Apr 9, 2023
@andrewdavidwong andrewdavidwong changed the title Re-downloading dom0 update metadata after every restart of template-based UpdateVM is wasteful Avoid re-downloading dom0 update metadata after every restart of template-based UpdateVM Apr 9, 2023
@mattmccutchen
Copy link
Author

I think the reasons I originally filed this as a bug were that I guessed that the current behavior was unintentional and that the fix would be obvious and uncontroversial and I felt the "steps to reproduce, expected behavior, actual behavior" format of the bug template was better suited to the information I had to convey than the open-ended enhancement request template. It is true that the only impact is poor performance. I imagine there are at least some cases in which we consider poor performance to constitute a bug, but I'm fine if you prefer to regard this one as an enhancement request given the apparent controversy around the proposed fix due to some users' disk space concerns.

@andrewdavidwong andrewdavidwong removed this from the Release TBD milestone Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: updates P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.
Projects
None yet
Development

No branches or pull requests

5 participants