Skip to contentSkip to conversation

Git Auth error on ls-remote (git-remote-https) since update to Yocto-5.0

DISCUSSION Lukas Weiß 3 participants 6 messages May 21, 2024 – May 22, 2024

lore
Share & tools
lore
#0 lore raw

Hello there,
i just updated our Yocto Project to latest 5.0 release. First tests went well, but now after a subsequent repo-update (tag=yocto-5.0) i have problems with call of most bitbake calls because of an error in some recipes with code in our own repository: Clean build runs without problems, but when i run fetch for any recipe, i get the following error:

Quoted 14 lines
$ bitbake -C fetch myapp
...
bb.data_smart.ExpansionError: Failure expanding variable
fetcher_hashes_dummyfunc[vardepvalue], expression was
${@bb.fetch.get_hashvalue(d)} which triggered exception FetchError:
Fetcher failure: Fetch command export PSEUDO_DISABLED=1; export
DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/11510/bus"; export
GIT_SSH="/home/admin/workspaces/yocto/build/conf/ssh_util/yocto_ssh.sh";
export PATH="(...)"; export HOME="/home/admin"; git -c gc.autoDetach=false
-c core.pager=cat -c safe.bareRepository=all ls-remote
https://gitreader:[email protected]/swupdate.git failed with exit code
128, output:
fatal: Authentication failed for 'https://repo.srv/swupdate.git/'

(shortened, full output see attachment; anonymized)

My Recipe of swupdate uses

Quoted 4 lines

SRC_URI = "git://repo.srv/swupdate.git;protocol=https;user=${AUTH_SCM_USER}:${AUTH_SCM_PASSWD};branch=${BRANCH}"

I have multiple Recipes using this scheme, most are working, three not. I can not find a difference. When i run the given command ( green ) with hosts git, everything works fine (so it is not really a auth problem!)

I figured out, that the problem belongs to the git ls-remote command of the git-remote-https program in recipes recipe-sysroot-native dir ( u-boot-plat/2019.01-/recipe-sysroot-native/usr/share/git-core/git-remote-https ). I can even reproduce this, when i run the ls-remote git command manually with my hosts git, with GIT_EXEC_PATH -Env variable set to the git-core dir in recipe-sysroot-native.  When i replace the git-remote-https program with the hosts one, everything runs fine.

Any ideas what is going wrong here?

PS: I didn't have the Problem on older Yocto-Versions.

$ bitbake -C fetch myapp
Loading cache: 100% |###############################################################################################################################################################################| Time: 0:00:00
Loaded 4753 entries from dependency cache.
WARNING: /home/admin/workspaces/yocto/build/../sources/meta-plat/recipes-support/swupdate/swupdate_git.bb: Exception during build_dependencies for fetcher_hashes_dummyfunc  --:--:--
WARNING: /home/admin/workspaces/yocto/build/../sources/meta-plat/recipes-support/swupdate/swupdate_git.bb: Error during finalise of /home/admin/workspaces/yocto/build/../sources/meta-plat/recipes-support/swupdate/swupdate_git.bb
WARNING: /home/admin/workspaces/yocto/build/../sources/meta-plat/recipes-bsp/linux-plat/linux-plat_4.6.bb: Exception during build_dependencies for fetcher_hashes_dummyfunc
WARNING: /home/admin/workspaces/yocto/build/../sources/meta-plat/recipes-bsp/linux-plat/linux-plat_4.6.bb: Error during finalise of /home/admin/workspaces/yocto/build/../sources/meta-plat/recipes-bsp/linux-plat/linux-plat_4.6.bb
WARNING: /home/admin/workspaces/yocto/build/../sources/meta-plat/recipes-bsp/u-boot-plat/u-boot-plat_2019.01.bb: Exception during build_dependencies for fetcher_hashes_dummyfunc
WARNING: /home/admin/workspaces/yocto/build/../sources/meta-plat/recipes-bsp/u-boot-plat/u-boot-plat_2019.01.bb: Error during finalise of /home/admin/workspaces/yocto/build/../sources/meta-plat/recipes-bsp/u-boot-plat/u-boot-plat_2019.01.bb
ERROR: ExpansionError during parsing /home/admin/workspaces/yocto/build/../sources/meta-plat/recipes-support/swupdate/swupdate_git.bb
Traceback (most recent call last):
  File "/home/admin/workspaces/yocto/sources/poky/bitbake/lib/bb/fetch2/__init__.py", line 1248, in srcrev_internal_helper(ud=<bb.fetch2.FetchData object at 0x7fc3f9c73690>, d=<bb.data_smart.DataSmart object at 0x7fc404e84d90>, name='default'):
             d.setVar("__BBAUTOREV_ACTED_UPON", True)
Quoted 1 line

srcrev = ud.method.latest_revision(ud, d, name)

File "/home/admin/workspaces/yocto/sources/poky/bitbake/lib/bb/fetch2/__init__.py", line 1670, in Git.latest_revision(ud=<bb.fetch2.FetchData object at 0x7fc3f9c73690>, d=<bb.data_smart.DataSmart object at 0x7fc404e84d90>, name='default'):
except KeyError:
> revs[key] = rev = self._latest_revision(ud, d, name)
return rev
File "/home/admin/workspaces/yocto/sources/poky/bitbake/lib/bb/fetch2/git.py", line 850, in Git._latest_revision(ud=<bb.fetch2.FetchData object at 0x7fc3f9c73690>, d=<bb.data_smart.DataSmart object at 0x7fc404e84d90>, name='default'):

Quoted 1 line
       output = self._lsremote(ud, d, "")

# Tags of the form ^{} may not work, need to fallback to other form
File "/home/admin/workspaces/yocto/sources/poky/bitbake/lib/bb/fetch2/git.py", line 833, in Git._lsremote(ud=<bb.fetch2.FetchData object at 0x7fc3f9c73690>, d=<bb.data_smart.DataSmart object at 0x7fc404e84d90>, search=''):
bb.fetch2.check_network_access(d, cmd, repourl)
> output = runfetchcmd(cmd, d, True)
if not output:
File "/home/admin/workspaces/yocto/sources/poky/bitbake/lib/bb/fetch2/__init__.py", line 960, in runfetchcmd(cmd='export PSEUDO_DISABLED=1; export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/11510/bus"; export GIT_SSH="/home/admin/workspaces/yocto/build/conf/ssh_util/yocto_ssh.sh"; export PATH="/home/admin/workspaces/yocto/build/tmp/sysroots-uninative/x86_64-linux-plat/usr/bin:/home/admin/workspaces/yocto/sources/poky/scripts:/home/admin/workspaces/yocto/build/tmp/work/armv5e-plat-linux-plat-gnueabi/swupdate/git/recipe-sysroot-native/usr/bin/arm-plat-linux-plat-gnueabi:/home/admin/workspaces/yocto/build/tmp/work/armv5e-plat-linux-plat-gnueabi/swupdate/git/recipe-sysroot/usr/bin/crossscripts:/home/admin/workspaces/yocto/build/tmp/work/armv5e-plat-linux-plat-gnueabi/swupdate/git/recipe-sysroot-native/usr/sbin:/home/admin/workspaces/yocto/build/tmp/work/armv5e-plat-linux-plat-gnueabi/swupdate/git/recipe-sysroot-native/usr/bin:/home/admin/workspaces/yocto/build/tmp/work/armv5e-plat-linux-plat-gnueabi/swupdate/git/recipe-sysroot-native/sbin:/home/admin/workspaces/yocto/build/tmp/work/armv5e-plat-linux-plat-gnueabi/swupdate/git/recipe-sysroot-native/bin:/home/admin/workspaces/yocto/sources/poky/bitbake/bin:/home/admin/workspaces/yocto/build/tmp/hosttools"; export HOME="/home/admin"; git -c gc.autoDetach=false -c core.pager=cat -c safe.bareRepository=all ls-remote https://gitreader:[email protected]/swupdate.git ', d=<bb.data_smart.DataSmart object at 0x7fc404e84d90>, quiet=True, cleanup=[], log=None, workdir=None):

Quoted 1 line

raise FetchError(error_message)

bb.data_smart.ExpansionError: Failure expanding variable fetcher_hashes_dummyfunc[vardepvalue], expression was ${@bb.fetch.get_hashvalue(d)} which triggered exception FetchError: Fetcher failure: Fetch command export PSEUDO_DISABLED=1; export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/11510/bus"; export GIT_SSH="/home/admin/workspaces/yocto/build/conf/ssh_util/yocto_ssh.sh"; export PATH="/home/admin/workspaces/yocto/build/tmp/sysroots-uninative/x86_64-linux-plat/usr/bin:/home/admin/workspaces/yocto/sources/poky/scripts:/home/admin/workspaces/yocto/build/tmp/work/armv5e-plat-linux-plat-gnueabi/swupdate/git/recipe-sysroot-native/usr/bin/arm-plat-linux-plat-gnueabi:/home/admin/workspaces/yocto/build/tmp/work/armv5e-plat-linux-plat-gnueabi/swupdate/git/recipe-sysroot/usr/bin/crossscripts:/home/admin/workspaces/yocto/build/tmp/work/armv5e-plat-linux-plat-gnueabi/swupdate/git/recipe-sysroot-native/usr/sbin:/home/admin/workspaces/yocto/build/tmp/work/armv5e-plat-linux-plat-gnueabi/swupdate/git/recipe-sysroot-native/usr/bin:/home/admin/workspaces/yocto/build/tmp/work/armv5e-plat-linux-plat-gnueabi/swupdate/git/recipe-sysroot-native/sbin:/home/admin/workspaces/yocto/build/tmp/work/armv5e-plat-linux-plat-gnueabi/swupdate/git/recipe-sysroot-native/bin:/home/admin/workspaces/yocto/sources/poky/bitbake/bin:/home/admin/workspaces/yocto/build/tmp/hosttools"; export HOME="/home/admin"; git -c gc.autoDetach=false -c core.pager=cat -c safe.bareRepository=all ls-remote https://gitreader:[email protected]/swupdate.git failed with exit code 128, output:
fatal: Authentication failed for 'https://repo.srv/swupdate.git/'

The variable dependency chain for the failure is: fetcher_hashes_dummyfunc[vardepvalue]

ERROR: Parsing halted due to errors, see error messages above

Summary: There were 6 WARNING messages.
Summary: There were 2 ERROR messages, returning a non-zero exit code.

#1 lore raw

Supplying passwords this way is a terrible idea, and isn't supported (there's a comment in git fetcher source stating that explicitly). You should transition everything to ssh (at which point the issue will go away anyway), or place the https secrets into a more secure location (man gitcredentials may help).

Alex

Quoted 30 lines · Lukas Weiß via lists.yoctoproject.org

Hello there,
i just updated our Yocto Project to latest 5.0 release. First tests went well, but now after a subsequent repo-update (tag=yocto-5.0) i have problems with call of most bitbake calls because of an error in some recipes with code in our own repository: Clean build runs without problems, but when i run fetch for any recipe, i get the following error:

$ bitbake -C fetch myapp
...
bb.data_smart.ExpansionError: Failure expanding variable fetcher_hashes_dummyfunc[vardepvalue], expression was ${@bb.fetch.get_hashvalue(d)} which triggered exception FetchError: Fetcher failure: Fetch command export PSEUDO_DISABLED=1; export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/11510/bus"; export GIT_SSH="/home/admin/workspaces/yocto/build/conf/ssh_util/yocto_ssh.sh"; export PATH="(...)"; export HOME="/home/admin"; git -c gc.autoDetach=false -c core.pager=cat -c safe.bareRepository=all ls-remote https://gitreader:[email protected]/swupdate.git  failed with exit code 128, output:
fatal: Authentication failed for 'https://repo.srv/swupdate.git/'

(shortened, full output see attachment; anonymized)

My Recipe of swupdate uses

SRC_URI = "git://repo.srv/swupdate.git;protocol=https;user=${AUTH_SCM_USER}:${AUTH_SCM_PASSWD};branch=${BRANCH}"

I have multiple Recipes using this scheme, most are working, three not. I can not find a difference. When i run the given command (green) with hosts git, everything works fine (so it is not really a auth problem!)

I figured out, that the problem belongs to the git ls-remote command of the git-remote-https program in recipes recipe-sysroot-native dir (u-boot-plat/2019.01-/recipe-sysroot-native/usr/share/git-core/git-remote-https). I can even reproduce this, when i run the ls-remote git command manually with my hosts git, with GIT_EXEC_PATH-Env variable set to the git-core dir in recipe-sysroot-native. When i replace the git-remote-https program with the hosts one, everything runs fine.

Any ideas what is going wrong here?

PS: I didn't have the Problem on older Yocto-Versions.
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#63152): https://lists.yoctoproject.org/g/yocto/message/63152
Mute This Topic: https://lists.yoctoproject.org/mt/106223085/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

You are definitely right, we should switch to another auth mechanism. It's not that easy, as build shall work in CI on our Build-Server - haven't found a good "best practice" here yet.

But why did it work 2 weeks ago (even on Yocto-5.0) and still does for other git-commands than ls-remote?

#3 lore raw

You might want to try to bisect poky? If there’s any fix, it needs to be justified with something else than ‘unbreaks passwords in recipes’.

Alex

Quoted 6 lines · Lukas Weiß via Lists.Yoctoproject.Org

You are definitely right, we should switch to another auth mechanism. It's not that easy, as build shall work in CI on our Build-Server - haven't found a good "best practice" here yet.

But why did it work 2 weeks ago (even on Yocto-5.0) and still does for other git-commands than ls-remote?

#4 lore raw
In reply to Lukas Weiß

Looks like you are using wget2 fetcher instead of old good wget?!

Which distro on the host are you using? Fedora? Or something else?

Please, start reading from here!

https://lists.yoctoproject.org/g/yocto/message/63118

Zee
_______

Quoted 24 lines · Lukas Weiß via lists.yoctoproject.org

Hello there,
i just updated our Yocto Project to latest 5.0 release. First tests went well, but now after a subsequent repo-update (tag=yocto-5.0) i have problems with call of most bitbake calls because of an error in some recipes with code in our own repository: Clean build runs without problems, but when i run fetch for any recipe, i get the following error:

$ bitbake -C fetch myapp
...
bb.data_smart.ExpansionError: Failure expanding variable fetcher_hashes_dummyfunc[vardepvalue], expression was ${@bb.fetch.get_hashvalue(d)} which triggered exception FetchError: Fetcher failure: Fetch command export PSEUDO_DISABLED=1; export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/11510/bus"; export GIT_SSH="/home/admin/workspaces/yocto/build/conf/ssh_util/yocto_ssh.sh"; export PATH="(...)"; export HOME="/home/admin"; git -c gc.autoDetach=false -c core.pager=cat -c safe.bareRepository=all ls-remote https://gitreader:[email protected]/swupdate.git  failed with exit code 128, output:
fatal: Authentication failed for 'https://repo.srv/swupdate.git/'

(shortened, full output see attachment; anonymized)

My Recipe of swupdate uses

SRC_URI = "git://repo.srv/swupdate.git;protocol=https;user=${AUTH_SCM_USER}:${AUTH_SCM_PASSWD};branch=${BRANCH}"

I have multiple Recipes using this scheme, most are working, three not. I can not find a difference. When i run the given command (green) with hosts git, everything works fine (so it is not really a auth problem!)

I figured out, that the problem belongs to the git ls-remote command of the git-remote-https program in recipes recipe-sysroot-native dir (u-boot-plat/2019.01-/recipe-sysroot-native/usr/share/git-core/git-remote-https). I can even reproduce this, when i run the ls-remote git command manually with my hosts git, with GIT_EXEC_PATH-Env variable set to the git-core dir in recipe-sysroot-native. When i replace the git-remote-https program with the hosts one, everything runs fine.

Any ideas what is going wrong here?

PS: I didn't have the Problem on older Yocto-Versions.

#5 lore raw

We don't use wget2, at least it's not installed on the host. Also, we don't use Fedora, but Debian 12.5 and Ubuntu 22.04.4 hosts.