Closed mwoodpatrick closed 11 months ago
Hi @mwoodpatrick,
No doubt, the docs pages haven't advanced in the past months. As a Photon OS enthusiast, I will add a pull request these next days particularly for this issue.
Photon OS has different flavors. The current docker image version is 10/28/2023. Afaik there are no Ubuntu-like chiseled images for e.g. Java, .NET., etc. using the open-source version of Photon OS.
Meanwhile, as a suggestion, make build a current image directly on Photon OS.
Hope this helps. -Daniel
if [ `cat /etc/yum.repos.d/photon.repo | grep -o "packages.vmware.com/photon" | wc -l` -eq 0 ]; then
cd /etc/yum.repos.d/
sed -i 's/dl.bintray.com\/vmware/packages.vmware.com\/photon\/$releasever/g' photon.repo photon-updates.repo photon-extras.repo photon-debuginfo.repo
fi
tdnf install -y kpartx git bc build-essential createrepo_c texinfo wget python3-pip tar dosfstools cdrkit rpm-build
python -m pip install --upgrade pip
pip3 install --upgrade pip
pip3 install setuptools ez_setup
pip3 install docker==2.3.0
# use latest photon-os-installer
pip3 install git+https://github.com/vmware/photon-os-installer.git
# specify the photon os branch
git clone -b 5.0 https://github.com/vmware/photon.git
cd ./photon
Start make image IMG_NAME=iso
.
I did manage to get to the point where it tried to install photon-iso-config and syslinux in a working directory that failed for me with since the build could not find the photon-iso-config package. I will dig further tomorrow. This may be because I'm running Ubuntu 22.04 under WSL-2. I did get Photon OS installed as a WSL-2 distribution.
The current documented way of building images is going to be deprecated soon. We are developing a new way using containers. It's already in use for the dev
branch, see https://github.com/vmware/photon/tree/dev/support/poi . You can look at https://github.com/vmware/photon-os-installer/tree/poi-container/docker for instructions - but that currently doesn't have instructions to build ISO images (so far only cloud images).
Steps to build an ISO:
Create the container as below or just pull: docker pull projects.registry.vmware.com/photon/installer
git pull https://github.com/vmware/photon-os-installer.git
git checkout poi-container
export POI_IMAGE=photon/installer
cd docker && docker buildx build --build-context poi-helper=$(realpath ..) -t $POI_IMAGE .
This is to create a repository with current 5.0 packages. If you have built Photon packages locally, you need to adjust the paths to use the local RPMS
folder instead:
create a temporary repository in /root/repo
(can be anywhere, but adjust paths in following commands):
cd examples/iso
docker run --rm --privileged -v/dev:/dev -v$(pwd):/workdir -v /root/repo/5.0:/repo $POI_IMAGE create-repo -c packages_installer_initrd.json
docker run --rm --privileged -v/dev:/dev -v$(pwd):/workdir -v /root/repo/5.0:/repo $POI_IMAGE create-repo -c minimal_ks.yaml
finally, build the ISO (in the examples/iso
directory): docker run --rm --privileged -v/dev:/dev -v$(pwd):/workdir -v /root/repo/5.0:/repo $POI_IMAGE photon-iso-builder -y iso.yaml
You should now have a new ISO: photon-5.0.iso
(or use -n <name>
to set another name)
Hi @oliverkurth,
I have two questions.
I know that Microsoft Windows WSL isn't supported. Did you try to build the ISO outside VMware virtualization? For the new way with containers and considering support for products outside VMware virtualization, this would mean to add docs about configuring Github Workspaces, Docker Dev Environments, etc. See the use cases listed below.
The second question is about tools deprecation for building images. It makes it difficult to contribute with pull requests in good standing. E.g. Broadcom atomic automation and other divisions are keen on publishing 12-18 months roadmaps. Of course, this is open-source Photon OS and not the closed-source commercial version. That said, are there plans for introducing roadmaps? The last update is from 2022.
Kind regards, Daniel
Microsoft Windows x86_64 with VMware workstation @mwoodpatrick: See Photon OS docs. This is the recommended way. Btw. For NVidia products' interoperability with Photon OS, vSphere works flawlessly. Bare metal provisioning of Photon OS works as well.
Microsoft Windows 11 x86_64 with Windows Features, use case using Ubuntu 18.04
dism /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V # reboot
dism /Online /Enable-Feature /All /FeatureName:Microsoft-Windows-Subsystem-Linux # reboot
bcdedit /set hypervisorlaunchtype auto # reboot
wsl --install Ubuntu-18.04
wsl --set-default Ubuntu-18.04
wsl # start
Is this environment supported?
Microsoft Windows 11 x86_64 with Windows Features, using Photon OS 5.0 docker container
dism /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V # reboot
dism /Online /Enable-Feature /All /FeatureName:Microsoft-Windows-Subsystem-Linux # reboot
bcdedit /set hypervisorlaunchtype auto # reboot
start "Docker Desktop Installer" /wait "Docker Desktop Installer.exe" # reboot
docker pull photon:5.0-20231028 # docker pull photon release from https://hub.docker.com/_/photon/
docker run -it -d photon:5.0-20231028 # run container in background
docker container list # get docker container id
docker export -o photon-5.0-20231028.tar <container id> # docker export
docker container stop <container id> # docker container stop and prune
docker container prune # docker container stop and prune
wsl --set-default-version 2 # set wsl version
wsl --import Ph5 <target dir> photon-5.0-20231028.tar # wsl import
wsl --set-default Ph5 # set wsl default
wsl # start
tdnf install -y docker
Is this environment supported?
Microsoft Windows 11 aarch64 with Windows Features, use case using Ubuntu 18.04 Is this environment supported?
I was able to install & build the photon installer package on archlinux/WSL-2 without issue. I could not find the examples/iso directory in the photon-os-installer poi-container branch I only saw
ls examples ami azure ova rpi
@dcasota this is for personal work unrelated to my work at NVidia and in this case I need to use WSL-2
BTW is there a photon community forum (e.g. on slack) I could not find one. I'm looking to buy a Linux mini PC to connect to my laptop that can run headless and use for testing.
I was able to install & build the photon installer package on archlinux/WSL-2 without issue. I could not find the examples/iso directory in the photon-os-installer poi-container branch I only saw
ls examples ami azure ova rpi
Oh sorry, I forgot to merge that into the poi-container
branch. I just cherry-picked and pushed it, so just try a pull now and you should get 78756125f6d5f9eae675981164cc0c865e6769ff.
That fixed the issue and I was able to build the iso.
The link ks_config.md describing kickstart on page:
appears to be broken, can we get it fixed?
e.g. createrepo_c at https://github.com/vmware/photon/blob/photon-hugo/content/en/docs-v5/installation-guide/building%20images/build-custom-iso-from-source-code-for-photon-os-installer.md ?
From a double you’s or a double youth perspective, creating comprehensive docs at the level of en/content is a wish.
How to build createrepo on newer Ubuntu versions?
Here you go:
#!/bin/bash
if [ "$EUID" -ne 0 ]; then
echo "Should be run as root" 1>&2
exit 1
fi
echo -e "\n*** WARNING: THIS SCRIPT IS TESTED AND MEANT TO BE USED FOR UBUNTU 20.04 (might work in higer versions) ***\n" 1>&2
if command -v createrepo_c &> /dev/null; then
echo "Previous createrepo_c installation found, uninstall it and proceed further" 1>&2
exit 1
fi
topdir="$PWD"
ver="0.20.1"
srcname="createrepo_c-${ver}"
url="https://github.com/rpm-software-management/createrepo_c/archive/refs/tags/$ver.tar.gz"
tarball="$(basename $url)"
pre_reqs=(tar wget libmagic-dev cmake libpopt-dev libbz2-dev libssl-dev)
pre_reqs+=(libcurl4-openssl-dev libxml2-dev libglib2.0-dev python3-dev)
pre_reqs+=(liblzma-dev libsqlite3-dev librpm-dev libzstd-dev make)
if ! dpkg -s ${pre_reqs[@]} &>/dev/null; then
apt update
apt install -y ${pre_reqs[@]}
fi
fini() {
local ret=$?
cd "$topdir"
if [ $ret -eq 0 ]; then
rm -rf "$srcname" "${tarball}"
else
rm -rf "$srcname"
fi
exit $ret
}
trap fini EXIT
if ! ls "${tarball}" &> /dev/null; then
wget -nc "$url"
fi
if ! tar xf "${tarball}"; then
echo "ERROR: failed to extract downloaded tarball" 1>&2
exit 1
fi
cd "$srcname"
if ! cmake . -DWITH_ZCHUNK=OFF -DWITH_LIBMODULEMD=OFF; then
echo "ERROR: cmake failed" 1>&2
exit 1
fi
p="$(nproc)"
make -j$p
make uninstall -j$p
ldconfig
make install -j$p
ldconfig
ln -sv /usr/local/bin/createrepo_c /usr/local/bin/
ln -sv /usr/local/bin/createrepo_c /usr/local/bin/createrepo
I'd like to test my generated image using qemu but can't seem to find a qemu command line the boots the generated iso.
When I run:
qemu-system-x86_64 -boot d -m 2G -cdrom my-photon-5.0-x86_64.iso \ -drive if=none,id=sata-disk,file=photon-5.0.qcow2 \ -device ahci,id=ahci \ -device ide-hd,bus=ahci.0,drive=sata-disk
The installer can't seem to find the drive. Anyone have any suggestions as to what I'm doing wrong?
Can you follow the procedure outlined here https://github.com/vmware/photon-os-installer/pull/24 ? With the exception that you can checkout the poi-container
branch of that project because that PR has been merged to that branch.
Also, it should be possible to create a Photon image for qemu
directly (without an ISO), following the instructions here: https://github.com/vmware/photon-os-installer/tree/poi-container/docker . You just need to convert the raw image file to qcow2
format, which you can do with qemu
tools.
The installer can't seem to find the drive. Anyone have any suggestions as to what I'm doing wrong?
I just tried the qemu-system
command myself - I think I misunderstood - it's not finding the cdrom, and I thought you mean the hard drive. I think the problem is that qemu
emulates an IDE CD drive, and that is no longer support in Photon 5.0. Try using a SATA drive instead. I am not familiar enough with qemu
to find the correct options for that.
Alternatively, try testing the image with VMware Fusion/Workstation/Player or KVM.
I figured it out - try this:
qemu-system-x86_64 -drive id=disk,file=photon-5.0.qcow2,if=none -drive id=cdrom,file=photon-5.0.iso,media=cdrom,if=none,read-only=on -device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0 -device ide-cd,drive=cdrom,bus=ahci.1 -m 4096
Yep that worked, many thanks.
👏 awesome 😃 Recipe should be added to the docs.
I think we can close this now, questions are answered.
Describe the bug
On the page: Building the ISO it documents how to build on Ubuntu and lists the additional packages needed to do the build which includes createrepo unfortunately, createrepo command which can create RPM repositories was removed in Ubuntu 20.04 LTS (see createrepo on Ubuntu 20.04. It would be helpful if the page reflected how to build on the current version of Ubuntu
Reproduction steps
Expected behavior
Packages are installed
Additional context
dev uuid-dev libreadline-dev kpartx git bc Reading package lists... Done Building dependency tree... Done Reading state information... Done E: Unable to locate package createrepo E: Unable to locate package python-aptdaemon E: Unable to locate package python-requests