-
Notifications
You must be signed in to change notification settings - Fork 59
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
Labeling supported architectures and runtime introspection #154
Comments
Without linking anything:
But no objections to sticking this somewhere as JSON in |
Isn't that arch though and not base arch? I think @lucab is looking for a way for a process to know "which FCOS basearch am I?" without having to maintain a table similar to libdnf's.
I like the idea of putting it in |
Assuming
This would be the safer approach. I'd personally prefer not to add a new place for people to find this information that is specific only to Fedora CoreOS and not applicable to Fedora. |
Add a `basearch` key to the manifest. This can be used at compose time to assert the architecture the compose is running on. Though my motivation is for the common case where it gets omitted from the input manifest and gets automatically added by rpm-ostree into `/usr/share/rpm-ostree/treefile.json` for introspection on the client. (The crucial part here is that the treefile created by rpm-ostree remains deserializable into a `TreeComposeConfig`). Closes: coreos/fedora-coreos-tracker#154
I opened a proposal at coreos/rpm-ostree#1766 to just include the base arch as part of the treefile. So one can simply read |
is there a reason to do that vs using librpm/libdnf? i.e. is it easier for some software to read that file (json) than it is to call the library? |
libdnf is not a public stable API and I doubt it will be anytime soon.
Reading a JSON file is significantly easier for e.g. Go code than calling into C. That said...I am not sure why this API doesn't live in librpm. Maybe the naming of architectures differs even across RPM-using distributions? |
We do ship |
wow didn't know you could do that across repos |
If I closed something it was unintentional! |
I did mean for coreos/rpm-ostree#1766 to close this, but for some reason it didn't when it got pushed to master, but it did when you pushed it to your fork. I'm guessing some permissions issue maybe? |
If it is supposed to be closed then no big deal. I was just syncing my fork with upstream. Really weird though. |
Pretty sure it's because @rh-atomic-bot did the push and has access to rpm-ostree but not this repo. |
There is followup from an out-of-band discussion at coreos/rpm-ostree#1766 (comment). We are thinking of augmenting |
How does the os-release file get generated to begin with? I'd prefer if we make the change for all of Fedora and not just for ostree based systems. |
@dustymabe https://src.fedoraproject.org/rpms/fedora-release/blob/f30/f/fedora-release.spec#_378 however the package itself is |
If the file is dynamically updated during rpm scriptlets then the package could still be noarch, but that would beg the question: If we can dynamically update it during rpm scriptlets then where are we pulling that information from and why couldn't consumers of this new interface do the same thing? This gets us back to an earlier comment I had:
|
Looking to resolve this soon in order to address coreos/coreos-assembler#463 (comment). Interestingly, cosa will need that information as well, so it is indeed not just about runtime FCOS introspection.
The issue is that what applies to traditional Fedora in this case literally can't be applied to FCOS. Here's a suggested answer on how to do this on traditional Fedora (https://unix.stackexchange.com/a/317487):
This works off of But of course we ship neither My suggestion right now is that instead of maintaining another table (even though it'd be much smaller since we only care about a subset of these architectures) is to teach cosa to pick up the base arch from rpm-ostree:
and inject that into the OSTree (e.g. either in the commit metadata, or a file, or maybe both). This means we use the exact same table as the rest of Fedora. We should also probably use that in cosa itself instead of So to answer one of the original comment of this issue:
This would live in cosa, which I think seems like a fitting place since a lot of the enablement for each arch happens there. |
I guess we could use the dnf code I pasted above to do this too, but cosa has a runtime dependency on rpm-ostree, and only a build dependency on dnf (e.g. we could technically delete dnf from the container after it's built). Also, rpm-ostree uses the libdnf table, not the dnf copy (although the libdnf one was originally taken from dnf...), and I think the goal is to eventually dedupe these things into libdnf. And it's the same table rpm-ostree in FCOS would use for e.g. package layering. |
If cosa needs the table we could have e.g. |
(Of course doing that would probably require a libdnf patch to add API) |
Yeah, though hopefully cosa doesn't need the table itself, just the ability to lookup. So e.g. the table in cosa would be more of a list of supported base archs. |
Injected in commit metadata in coreos/coreos-assembler#590 (coreos/coreos-assembler@62ad7de). See commit message for some of the rationale, though open for discussions! |
Fixed by coreos/coreos-assembler#590. |
Example {
"deployments" : [
{
"unlocked" : "none",
"requested-local-packages" : [
],
"base-commit-meta" : {
"coreos-assembler.config-dirty" : "true",
"coreos-assembler.config-gitrev" : "e5ffda727170e124c7f7d8782e256b0462bf9869",
"coreos-assembler.basearch" : "x86_64",
"rpmostree.inputhash" : "0e2ba98bac847c8a8cc5ffd42822a41d53ef6719ccaf6a0094559768aa24da33",
"version" : "30.1",
"rpmostree.rpmmd-repos" : [
{
"id" : "fedora-coreos-pool",
"timestamp" : 7435743550895030272
},
{
"id" : "fedora",
"timestamp" : -7689964138319052800
},
{
"id" : "fedora-updates",
"timestamp" : -1292510703390818304
},
{
"id" : "coreos-assembler-local-overrides",
"timestamp" : 1402332922660257792
}
]
},
"base-removals" : [
],
"gpg-enabled" : false,
"origin" : "fedora/x86_64/coreos/testing-devel",
"osname" : "fedora-coreos",
"pinned" : false,
"requested-base-local-replacements" : [
],
"checksum" : "ce718b90ce19c2cac07fa45efdce91aad208a508c98e9f7f572f5aaba76f569a",
"regenerate-initramfs" : false,
"id" : "fedora-coreos-ce718b90ce19c2cac07fa45efdce91aad208a508c98e9f7f572f5aaba76f569a.0",
"version" : "30.1",
"requested-packages" : [
],
"requested-base-removals" : [
],
"serial" : 0,
"base-local-replacements" : [
],
"timestamp" : 1561753297,
"booted" : true,
"packages" : [
]
}
],
"transaction" : null,
"cached-update" : null
} |
Since bash is not great at reading json, I think it is needed in /etc/os-release such that systemd unit can use OSTREE_VERSION is in there, and so to construct a url to a downloadbale executable, BASE_ARCH is the missing piece. |
|
This is a public followup to an offline discussion started with @jlebon.
On FCOS, we maintain a table of well-known platforms, so that software running on a node can introspect this at runtime by looking up the OEM-ID from kernel command-line.
Similarly, we should maintain a table of well-known architectures. Currently we only have
amd64
, but more are coming (see #78).Additionally, it should be possible for a node to introspect its own OS architecture. An example of such a usecase would be for the update client to communicate this to the update-serving backend.
It looks like there are two approaches currently in use:
uname -m
)I don't know where Fedora proper maintains such a table, but it would be nice to be aligned on that. Assuming such table is based on the latter approach, we should provide some way to read that information without linking to libdnf. In Container Linux this information was part of the "board label" in os-release, but pretty much any file in a machine-friendly format under
/usr
would be fine.The text was updated successfully, but these errors were encountered: