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

Command: make tools, error #139

Open
brimdor opened this issue Feb 10, 2024 · 2 comments
Open

Command: make tools, error #139

brimdor opened this issue Feb 10, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@brimdor
Copy link

brimdor commented Feb 10, 2024

Describe the bug

I have been using Homelab since 2022. I rebuilt to the current build of May 2023 and haven't updated since then. You have made a lot of changes since May 2023 so I decided to rebuild from scratch. I Wiped the controller device I use to run the build commands which in the process of using your latest, also wiped the nodes during the PXE boot. All good things. However, when I attempt to run 'make tools', I get the following error:

Status: Downloaded newer image for nixos/nix:latest
error:
       … while fetching the input 'git+file:///home/brimdor/homelab'

       error: opening Git repository '/home/brimdor/homelab': repository path '/home/brimdor/homelab/' is not owned by current user
make: *** [Makefile:30: tools] Error 1

I have no idea why this is happening, it is a fresh fork as well.

I have verified that my user, brimdor, has ownership of the path.

I do not know how to reproduce this behavior besides attempting to build a brand new setup.

Expected behavior

It's supposed to create the nix container and allow me to start the build process in it.

The last time I posted about a Nix issue, it was cache. That didn't apply here as there is no cache for the first run. I still ran the command you gave me last time: docker volume rm homelab-tools-cache homelab-tools-nix

@brimdor brimdor added the bug Something isn't working label Feb 10, 2024
@brimdor
Copy link
Author

brimdor commented Feb 11, 2024

Git 2.35.2 was given a patch for CVE-2022-24765. This now requires you to set a safe directory configuration in the .git/config file.
But it has to be done inside the container. I recommend doing this in runtime within with Makefile. Adjust the last line of the docker command to be an entrypoint.

tools:
	@docker run \
		--rm \
		--interactive \
		--tty \
		--network host \
		--env "KUBECONFIG=${KUBECONFIG}" \
		--volume "/var/run/docker.sock:/var/run/docker.sock" \
		--volume $(shell pwd):$(shell pwd) \
		--volume ${HOME}/.ssh:/root/.ssh \
		--volume ${HOME}/.terraform.d:/root/.terraform.d \
		--volume homelab-tools-cache:/root/.cache \
		--volume homelab-tools-nix:/nix \
		--workdir $(shell pwd) \
		--entrypoint /bin/sh \
		docker.io/nixos/nix -c "\
		git config --global --add safe.directory $(shell pwd) && \
		nix --experimental-features 'nix-command flakes' develop"

@khuedoan
Copy link
Owner

khuedoan commented Feb 17, 2024

Thank you for reporting and providing the solution, I can reproduce this on my machine.

The tools container is convenient for users who do not have Nix installed, however I'm starting to think it's a leaky abstraction 🤔 (there have been a few Docker/Podman-specific issues that do not exist if we run Nix directly)

MrRedHead added a commit to MrRedHead/homelab that referenced this issue Mar 24, 2024
MrRedHead added a commit to MrRedHead/homelab that referenced this issue Mar 24, 2024
MrRedHead added a commit to MrRedHead/homelab that referenced this issue Mar 24, 2024
brimdor added a commit to pixelpaladins/homelab that referenced this issue May 10, 2024
- adjusted tools in Makefile to add the safe.directory argument to the docker run command in order to fix the error regarding ownership (Refer to khuedoan#139)
brimdor added a commit to pixelpaladins/homelab that referenced this issue May 10, 2024
- adjusted tools in Makefile to add the safe.directory argument to the docker run command in order to fix the error regarding ownership (Refer to khuedoan#139)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants