KubOS-Preservation-Group / kubos-linux-build

Buildroot board config folder
Apache License 2.0
1 stars 0 forks source link

Git Auth Problem #1

Open jkalatchev7 opened 2 years ago

jkalatchev7 commented 2 years ago

I recently had to change some configurations in my KubOS kernel and in the process of building it, I got ERROR 404: NOT FOUND when buidroot tried to compile and build kubos-1.20.0.tar.gz

It also threw a warning saying: The unauthenticated git protocol running on port 9418 is no longer supported

I struggle for a while with this but it turns out it was due to the fact that buildroot on my VM was using git:// rather than https:// Issuing the following command seems to have fixed the issue but I imagine there is a better way to update this repo to prevent similar problems...

git config --global url."https://".insteadOf git://

MoralCode commented 2 years ago

Ah yes, it seems like git has changed their url schemes for git urls in the name of security

https://github.blog/2021-09-01-improving-git-protocol-security-github/

Other members of the discord have also had success authenticating over an ssh url (git@github.com:kubos/kubos.git) but that requires some setup if you havent used ssh auth before, so id agree that https is a better way to go.

Im not sure when ill have time to fix this, but ill review a pull request if you have time to make one

patrickoppel commented 2 years ago

The ssh authentication didn't work in the end on my side. (At least changing it in the kubos.mk).

I'm keen to find out why git config --global url."https://.insteadOf git:// works, but substituting the hardcoded link containing the git:// doesn't

MoralCode commented 2 years ago

AFAIK the git config --global url."https://".insteadOf git:// will swap out the url on the fly. Maybe your previous attempt was still cached somehow by buildroot and so maybe there was a local repo that still had a remote repo configured with a different URL?

patrickoppel commented 2 years ago

Yeah probably, although the call changes to https:// when modified in the code, thus my confusion.

But I also saw buildroot loads multiple other dependencies with git:// calls. I'm planning to try out buildroot-2022.02.1 tomorrow, which should not use those git:// dependencies anymore

MoralCode commented 2 years ago

I'm planning to try out buildroot-2022.02.1 tomorrow, which should not use those git:// dependencies anymore

isnt that part of the kubos config and not buildroot itself? either way, it would be awesome to know how it goes with the new buildroot. i think i tried to use a newer-than-2019 one at some point and i guess some of the flags got deprecated and i didnt know what i was doing and sorta gave up

patrickoppel commented 2 years ago

Partly, but according to the buildroot changelog, they only got rid of git:// dependencies with the 2022.02.1 version. So there's heaps of other links buildroot 2019 tries to call during the build process, that won't work unless you do git config --global url."https://".insteadOf git://

ravisha2396 commented 2 years ago

Buildroot uses wget on https addresses and this is probably why manually renaming git:// to https:// in kubos.mk is not able to locate the git branch. So you may want to use the git command git config --global url."https://".insteadOf git:// to tell BR to identify it as a github branch rather than a download URL. Below ref is from the BR manual:

Source fetching tools:

In the official tree, most of the package sources are retrieved using wget from ftp, http or https locations. A few packages are only available through a version control system. Moreover, Buildroot is capable of downloading sources via other tools, like rsync or scp (refer to (https://buildroot.org/downloads/manual/manual.html#requirement) for more details).

MoralCode commented 2 years ago

wow that actually makes a ton of sense for why this is the behavior that there is.

Based on my limited experience with buildroot, I feel like I remember seeing some kind of flag or other variable to explicitly tell buildroot that this is a git repository, overriding the default handling for this url so we can make it https:// permanently and have buildroot still treat it as a git url (passing it to git) instead of assuming wget.

unfortunately the "refer to chapter 20" part of the docs that you linked appear to simply say TODO :/

patrickoppel commented 2 years ago

These chapters might be relevant: Github Download Generic Package Reference

MoralCode commented 2 years ago

ah it looks like the variable that may be useful is LIBFOO_SITE_METHOD (presumably replacing the name LIBFOO with whatever matches the place the git url is currently set. Would be interesting to see what this does with a value of git and a url that doesnt start with git:// per the instructions