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

Remove unused /home/tooling/.local #181

Merged
merged 1 commit into from
Aug 19, 2024
Merged

Remove unused /home/tooling/.local #181

merged 1 commit into from
Aug 19, 2024

Conversation

dkwon17
Copy link
Collaborator

@dkwon17 dkwon17 commented Aug 15, 2024

This PR fixes the issue where podman was not found when there is a volume mounted to /home/user/.local.

Fixes eclipse-che/che#23095

In the base image, before this PR an empty /home/tooling/.local directory is created. Stowing this empty directory to /home/user created a hard link for the /home/.local directory, which caused both /home/user/.local and /home/tooling/.local to be affected by the volume mount to /home/user/.local.

This PR removes the /home/tooling/.local directory, since it was not used at all in the Dockerfile, and was only used in the entrypoint to store the podman wrapper. In this PR, the podman wrapper set up by the entrypoint is now stored in /home/user/.local instead.

To test this PR

  1. Build the base image:
$ cd base/ubi8
$ DOCKER_BUILDKIT=1 docker image build --progress=plain -t quay.io/<username>/<repo>:base-image .

I've built my own here: quay.io/dkwon17/developer-images:base-image

  1. Push the image to quay.

  2. Start the following workspace:

<CHE-HOST>#https://github.com/redhat-developer/devspaces/tree/devspaces-3-rhel-8?image=quay.io/<username>/<repo>:base-image
  1. In the terminal, there should be no problems with running podman info
devspaces (devspaces-3-rhel-8) $ podman info
host:
  arch: amd64
  buildahVersion: 1.33.8
  cgroupControllers:
...

And which podman should output the following:

devspaces (devspaces-3-rhel-8) $ which podman
~/.local/bin/podman

Signed-off-by: David Kwon <dakwon@redhat.com>
@dkwon17 dkwon17 changed the title Remove /home/tooling/.local Remove unused /home/tooling/.local Aug 15, 2024
@dkwon17 dkwon17 marked this pull request as draft August 15, 2024 23:26
@dkwon17 dkwon17 marked this pull request as ready for review August 16, 2024 03:09
@dkwon17
Copy link
Collaborator Author

dkwon17 commented Aug 16, 2024

To test this even further, you can build the UDI image with your custom base image by replacing line 4 of the udi dockerfile here so that the base image matches the base image built from this PR.

Then, the UDI can be built and pushed by running:

cd universal/ubi8
DOCKER_BUILDKIT=1 docker image build --progress=plain -t  quay.io/<username>/<repo>:udi .
docker push quay.io/<username>/<repo>:udi

To test that eclipse-che/che#23095 is fixed, create a workspace with this URL:

<CHE-HOST>/#https://github.com/redhat-developer/devspaces/tree/devspaces-3-rhel-8?image=quay.io/<username>/<repo>:udi

I've built my own UDI image from this PR available here: quay.io/dkwon17/developer-images:udi

Check that podman exists by running which podman. podman should be located in ~/.local/bin

Copy link
Collaborator

@svor svor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

openshift-ci bot commented Aug 16, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dkwon17, ibuziuk, svor

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Contributor

@AObuchow AObuchow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I was able to reproduce the bug with a workspace created from a fork of the ds-plugin-registry-dev devfile that uses a custom DWOC that disables persistent home on the dogfooding cluster.

With the fixed image, podman was again on path:

$ which podman
~/.local/bin/podman

However, with my custom DWOC, podman info failed:

$ podman info
ERRO[0000] running `/usr/bin/newuidmap 1520 0 1001030000 1 1 10000 65536`:  
Error: cannot set up namespace using "/usr/bin/newuidmap": fork/exec /usr/bin/newuidmap: operation not permitted

I'm almost certain the reason podman info is failing here is due to my custom DWOC having missing configuration fields, because:

  • If I start the same workspace with persistent home enabled, the same issue arises (home persistence is not causing the issue)
  • If I start the same workspace without my custom DWOC, and use the dogfooding's Che-owned DWOC, then podman info succeeds.

Maybe this points to another bug? I'm not sure. I'm unable to see how the dogfooding's che-owned DWOC is configured (don't have the correct priviledges)

Here's my custom DWOC, it only has persisten home disabled:

apiVersion: controller.devfile.io/v1alpha1
config:
  workspace:
    persistUserHome:
      enabled: true
kind: DevWorkspaceOperatorConfig
  name: custom-dwoc
  namespace: aobuchow-che-1cac83

@dkwon17
Copy link
Collaborator Author

dkwon17 commented Aug 19, 2024

@AObuchow the custom DWOC should include:

config:
  workspace:
    containerSecurityContext:
      allowPrivilegeEscalation: true
      capabilities:
        add:
          - SETGID
          - SETUID

Podman build should be working after that

@AObuchow
Copy link
Contributor

@dkwon17 thanks for the follow-up, sounds good :)

@dkwon17 dkwon17 merged commit ecac159 into main Aug 19, 2024
2 checks passed
@dkwon17 dkwon17 deleted the update-ubi-tooling branch August 19, 2024 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot build plugin registry with podman
4 participants