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

podvm-image: don't mount tmpfs on /usr #946

Merged
merged 1 commit into from
Oct 21, 2024
Merged

Conversation

msanft
Copy link
Contributor

@msanft msanft commented Oct 21, 2024

This is a prerequisite for using peer pods with GPUs, as they require an OCI hook to facilitate GPU attachment to containers, which is expected in /usr/share by default. If we mount a tmpfs on /usr, the files placed in the initial image through the contents attribute of the repart builder will become invisible, so we now only mount it at /usr/bin instead.

This is a prerequisite for using peer pods with GPUs, as they require an OCI hook to facilitate GPU attachment to containers, which is expected in `/usr/share` by default. If we mount a tmpfs on `/usr`, the files placed in the initial image through the `contents` attribute of the repart builder will become invisible, so we now only mount it at `/usr/bin` instead.
@msanft msanft added the no changelog PRs not listed in the release notes label Oct 21, 2024
@burgerdev
Copy link
Contributor

Why do we need a tmpfs on /usr/bin? Do we even need a tmpfs at /usr?

       /usr   This directory is usually mounted from a separate
              partition.  It should hold only shareable, read-only data,
              so that it can be mounted by various machines running
              Linux.

@msanft
Copy link
Contributor Author

msanft commented Oct 21, 2024

Why do we need a tmpfs on /usr/bin? Do we even need a tmpfs at /usr?

Good question! Unfortunately, Nix doesn't adhere to the FHS (or other things that are common sense in other distributions, e.g. /usr being merged - i.e. /bin linking to /usr/bin, and so on). Instead, binaries are always sourced from the Nix store for purity. Hence, /usr/bin/env, which is provided as a compatibility wrapper, e.g. to make shebangs of form !#/usr/bin/env bash work, is a symlink to the env binary in the Nix store. The link is created at boot-time within a so-called activation script. Thus /usr/bin needs to be writable.

@msanft msanft merged commit 0db5c0e into main Oct 21, 2024
10 checks passed
@msanft msanft deleted the msanft/podvm-img/usr-overlay branch October 21, 2024 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog PRs not listed in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants