Replies: 9 comments
-
I am adding my thoughts to this. So in general, it seems to me we want to have a smart logic for copying existing system cache metadata to the user's location rather than relying directly on the system cache. This seems reasonable to me since there may be situations where certain repository metadata are found only in the system cache, while others are exclusively in the user cache.
I suggest checking if the user cache is present and up-to-date for a given repository first. If not, then check the system cache. If both caches are empty, we can trigger a remote download if the
I'd also copy the solv files if we choose to copy from the system cache in the above scenario. Is there any potential issue with that?
In general, how would the root know which user metadata to check? Does this imply checking the cache for all available users? I probably wouldn't implement this additional reverse users-to-root cache checking and would wait for potential future use cases...
Maybe I don't fully understand this question. Isn't the current implementation already checking if the stored repomd is in sync with the remote?
I'd continue to reuse data in the root-to-user direction and copy outdated metadata to the user's cache if they are missing. |
Beta Was this translation helpful? Give feedback.
-
Use case - root has downloaded metadata for the The second use case: I am not saying that we have to support both use cases, but we can at least consider them. |
Beta Was this translation helpful? Give feedback.
-
I would rather keep it simple and not share cache data among multiple users. In my day-to-day use, I rarely run DNF as a non-root user, and when I do, I don't mind if it takes some extra time to download metadata. But my opinion here is not very strong. If DNF 5 used system cache data when run as a non-root user, it would be nice if it could use the system cache files directly rather than duplicating them into the user cache and costing space. If we duplicate the cache files anyway, there is less benefit to sharing the cache compared to re-downloading the files. I certainly think that DNF 5 should not use any part of a non-root user's cache when running as root, since as @jan-kolarik said it wouldn't even know where to look, but more importantly for security reasons. |
Beta Was this translation helpful? Give feedback.
-
A question to think about security: |
Beta Was this translation helpful? Give feedback.
-
My vote is definitely in favor of sharing the cache. It will speed up dnf5 and lower the requirements on repository infrastructure. Ideally in both directions but if that is too problematic I think we could at least do the case where unprivileged users uses system cache. |
Beta Was this translation helpful? Give feedback.
-
I think that repomd.xml contains enough information to validate other files. What we cannot validate is solvx files. In past we trusted solvx file from root for other users with I think that we should optimize cache handling due to
|
Beta Was this translation helpful? Give feedback.
-
Reusing root's cache by a normal user is a good thing: Bandwidth and disk space is not for free. It will speed up DNF from user's point of view. Running DNF for read-only operations (e.g. repoquery) under a normal user is in line with best security practices. Reusing root cache is security-safe because a normal user has to trust root for various other reasons. Nevertheless, user's DNF process must be prepared for root removing that files anytime. Reusing a normal user's cache by a root would be great, but it's dangerous: Root must revalidate origin and integrity of the data before using them. If repomd.xml is not singed, root will have to contact a mirror for the verification (either comparing a hash from a mirror manager or an ETag from an HTTP mirror). While root uses the normal user's cache, DNF will have to prevent a user from modifying it. Overall maintaining the coherency (that the cache files are not modified while in use by a different user) can be challenging. Simple solution is copy/reflink them to own cache and validating them after that. But that might take disk space. |
Beta Was this translation helpful? Give feedback.
-
In summary, based on the responses here, it appears there is consensus on sharing only the data from the root to the user, including solv files. When the user cache is empty, it makes sense to reuse even outdated root metadata. Copying metadata seems to be a safe and straightforward solution, as mentioned by @ppisar. Additionally, if we implement the reflink solution where supported by the underlying filesystem, it should address the space concerns raised by @evan-goode. |
Beta Was this translation helpful? Give feedback.
-
Agreed functionality to be implemented against this issue: #1000. |
Beta Was this translation helpful? Give feedback.
-
Problems
Questions
Solutions
--cacheonly
use root cacheBeta Was this translation helpful? Give feedback.
All reactions