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

kairos-agent upgrade on custom images fails with missing /etc/os-release keys #1548

Closed
venkatnsrinivasan opened this issue Jun 22, 2023 · 8 comments · Fixed by kairos-io/kairos-docs#42
Assignees
Labels
area/agent bug Something isn't working documentation Improvements or additions to documentation lane/ux

Comments

@venkatnsrinivasan
Copy link
Collaborator

We built a custom image for RHEL 8 with the steps outlined here
https://kairos.io/docs/reference/build-from-scratch/

The resulting image has an /etc/os-release as below.

NAME="Red Hat Enterprise Linux"
VERSION="8.7 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.7"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.7 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/8/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.7
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.7"

This image is able to be deployed successfully but when trying and upgrade via kairos-agent upgrade in Kairos 2.2.0 the upgrade fails with
Cant find IMAGE_REPO key under /etc/os-release

@venkatnsrinivasan venkatnsrinivasan added the bug Something isn't working label Jun 22, 2023
@mauromorales
Copy link
Member

I think the problem is that the following step:

RUN envsubst >>/etc/os-release </usr/lib/os-release.tmpl

is run when building the base images. So when using BYOI it is missing, or at least I couldn't find it on AuroraBuild/osbuilder

@mauromorales
Copy link
Member

I think either osbuilder offer a mechanism how to do this (and then it can be used on the main factory as well), or it should be part of the documentation for BYOI. Having said that, it will be the job of the user doing BYOI to define all or most of the values that go there, e.g. keep their own versioning because at the end of the day, they can decide on the cadence of release and it doesn't fit that they keep the same versioning of our releases. Alternatively we could do something like what we do with the k3s version, and when building the BYOI the final version would be something along the lines of KAIROS_VERSION+OWN_VERSION

@jimmykarily
Copy link
Contributor

Let's do 2 things:

  • Document the needed /etc/os-release values (which they are and what they do)
  • Make them mandatory only when they are needed. E.g. There is no reason to fail an upgrade, if the full image url is provided by the user. We only need the IMAGE_REPO value if a repository is not given with the upgrade command.

@mauromorales
Copy link
Member

@venkatnsrinivasan we added functionality on the osbuilder to update the attributes in the os-release. The docs have been updated to reflect this

# Set the Kairos arguments in os-release file to identify your Kairos image
FROM quay.io/kairos/osbuilder-tools:latest as osbuilder
RUN zypper install -y gettext
RUN mkdir /workspace
COPY --from=base /etc/os-release /workspace/os-release
# You should change the following values according to your own versioning and other details
RUN OS_NAME=kairos-core-fedora \
  OS_VERSION=v9.9.9 \
  OS_ID="kairos" \
  OS_NAME=kairos-core-fedora \
  BUG_REPORT_URL="https://github.com/YOUR_ORG/YOUR_PROJECT/issues" \
  HOME_URL="https://github.com/YOUR_ORG/YOUR_PROJECT" \
  OS_REPO="quay.io/YOUR_ORG/core-fedora" \
  OS_LABEL="latest" \
  GITHUB_REPO="YOUR_ORG/YOUR_PROJECT" \
  VARIANT="core" \
  FLAVOR="fedora" \
  /update-os-release.sh

FROM base
COPY --from=osbuilder /workspace/os-release /etc/os-release

from https://kairos.io/docs/reference/build-from-scratch/

@mudler
Copy link
Member

mudler commented Jul 3, 2023

@mauromorales I guess we can close this now?

@mauromorales
Copy link
Member

It still needs a bump in the agent to check the two items Dimitris added but it comes together with the yip bump so I'm running some tests in a branch

@mauromorales
Copy link
Member

@mudler ⬆️

@mudler mudler moved this from Under review 🔍 to In Progress 🏃 in 🧙Issue tracking board Jul 4, 2023
@mauromorales
Copy link
Member

Agent has been bumped on Kairos. It will be available in the next release. Please don't hesitate to re-open if you encounter any issues.

@github-project-automation github-project-automation bot moved this from In Progress 🏃 to Done ✅ in 🧙Issue tracking board Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/agent bug Something isn't working documentation Improvements or additions to documentation lane/ux
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants