Build XCP-ng ISO - issue at create-installimg
-
Hi everyone,
I'm playing around with the build of the XCP-ng ISO to add a custom RPM in it.
Also, I'm facing an issue where I can't find my way out.This is the
create-installimg.shstep where setup_yum_repos ( frommisc.sh) doesn't manage to access the yum config.What is weird is that just before this function is called I manage with a simple cat command to access it.
And as per my understanding at reading the script the TPMDIR is set bymisc.shso I don't have control over it.This is the output of my tests currently.
sudo docker run --rm -it -v "$(pwd)/create-install-image:/create-install-image:ro" -v "$(pwd):/output" b292e8a21068 /bin/bash [root@85b20fccb0e7 /]# /create-install-image/scripts/create-installimg.sh --output /output/install-8.3.img 8.3 -----Set REPOS----- YUMCONF: //tmpdir-VcYHGW/yum-171swX.conf YUMREPOSD: //tmpdir-VcYHGW/yum-repos-eg1dEe.d YUMCONF_TPML: /create-install-image/configs/8.3/yum.conf.tmpl ROOTFS: //tmpdir-VcYHGW/rootfs-1RKWIe YUMFLAGS: --config=//tmpdir-VcYHGW/yum-171swX.conf --installroot=//tmpdir-VcYHGW/rootfs-1RKWIe -q ls REPOSD cat YUMCONF [main] keepcache=1 debuglevel=2 reposdir=//tmpdir-VcYHGW/yum-repos-eg1dEe.d logfile=/var/log/yum.log retries=20 obsoletes=1 gpgcheck=1 assumeyes=1 syslog_ident=mock syslog_device= metadata_expire=0 mdpolicy=group:primary best=1 protected_packages= skip_missing_names_on_install=0 tsflags=nodocs --- ISSUE happens here *setup_yum_repos* ---- CRITICAL:yum.cli:Config error: Error accessing file for config file:////tmpdir-VcYHGW/yum-171swX.confThis is the docker image I'm using.
sudo docker images i Info → U In Use IMAGE ID DISK USAGE CONTENT SIZE EXTRA ghcr.io/xcp-ng/xcp-ng-build-env:8.3 b292e8a21068 543MB 0BI have been building this from the xcp-ng build env repo:
https://github.com/xcp-ng/create-install-image/tree/masterI'm puzzle and can't find what I'm doing wrong here.
Any hint will be much welcome !
-
Hi Vagrantin,
If I'm reading this right, the four-slash path is the tell. I can't confirm without seeing your exact Docker invocation, but this pattern points pretty clearly at one thing.
misc.shbuilds its temp dir from$PWD; something like$PWD/tmpdir-XXXXXX. If Docker is running your build from/, that expands to//tmpdir-XXXXXX. Linux is fine with that. Yum is not. It turns the config path into afile://URI, and////tmpdir-VcYHGW/yum-171swX.confis not a URI anything wants to parse.One other thing worth knowing: a
:roread-only mount on your repo directory causes the same symptom.mktempfails silently, TMPDIR ends up empty, and you get the same mangled path. Different cause, same four-slash result.Two things to try. The faster diagnostic is just
cdinto your repo before calling the script: if the build completes, that was it. The cleaner fix for scripted runs is passing-w /path/to/your/repoto yourdocker runcommand, which sets the working directory explicitly.Before you do either, this will tell you what you're actually dealing with:
echo $PWD && ls -la $TMPDIRThat's my best guess, at least. I'm curious what those two commands show.
-
@poddingue thank you that was it !
I had the feeling that the issue was around the path with the 4 slashes but couldn't figure out why, what and where.
So essentially, after setting the working directory to /tmp for my docker run it worked.
Here is the extract of the working build step for install.img
- name: Build install.img run: | XCPNG_VER="${{ github.event.inputs.xcpng_version }}" docker run --rm \ --user root -w /tmp \ -v "$(pwd)/create-install-image:/create-install-image:ro" \ -v "/tmp/RPM-GPG-KEY-xcp-ng-ce:/etc/pki/rpm-gpg/RPM-GPG-KEY-xcp-ng-ce" \ -v "$(pwd):/output" \ xcp-ng-build-ready \ bash -ce " rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-xcpng rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-xcp-ng-ce /create-install-image/scripts/create-installimg.sh \ --output /output/install-${XCPNG_VER}.img \ --define-repo base!https://updates.xcp-ng.org/8/${XCPNG_VER}/base \ --define-repo updates!https://updates.xcp-ng.org/8/${XCPNG_VER}/updates \ ${XCPNG_VER} echo 'install.img built'Regarding the output you wanted to see, here is it when it fails, first the way I trigger the container for context.
sudo docker run --rm -it -v "$(pwd)/create-install-image:/create-install-image:ro" -v "$(pwd):/output" b292e8a21068 /bin/bash./create-install-image/scripts/create-installimg.sh --output /output/instal.img 8.3 -----Set REPOS----- --- PWD var and TMPDIR content---- / total 20 drwx------ 4 root root 4096 Apr 16 00:54 . drwxr-xr-x 1 root root 4096 Apr 16 00:54 .. drwx------ 2 root root 4096 Apr 16 00:54 rootfs-FJWbFM -rw------- 1 root root 295 Apr 16 00:54 yum-HRyIb1.conf drwx------ 2 root root 4096 Apr 16 00:54 yum-repos-1FbWwV.d --- ISSUE happens here *setup_yum_repos* ---- CRITICAL:yum.cli:Config error: Error accessing file for config file:////tmpdir-sApL80/yum-HRyIb1.confAs soon as I'm moving to different directory other than the root
/then this issue goes away.Now going through the ISO build.
With kind regards. -
Thank you so much for your feedback, @Vagrantin !

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login