How to build the Photon OS ISO file - dcasota/photonos-scripts GitHub Wiki

  1. Prerequisites

    • cpu power e.g. Intel i9
    • 32GB ram and more
    • free disk space e.g. 120GB
  2. Prepare the builder environment

    • Builder environment
      • supported virtual environment: VMware Workstation, VMware ESXi and more
      • technical possible and tested: WSL2, baremetal, Azure VM GenV2
    • Builder os
      • Photon OS 3,4,5
      • Ubuntu
  3. preparation

    Login as root.

    Necessary on Photon 3.0:

    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
    

    Prepare the environment.

    tdnf makecache
    tdnf update tdnf
    tdnf distro-sync -y
    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
    cd $HOME
    PHOTON_RELEASE="5.0"
    pip3 install git+https://github.com/vmware/photon-os-installer.git
    # specify the photon os branch
    git clone -b $PHOTON_RELEASE https://github.com/vmware/photon.git
    cd photon/
    
    # new findings June 26th 2024
    sudo python3 -m venv .venv
    source .venv/bin/activate
    sudo pip3 install docker
    sudo pip3 install pyOpenSSL
    

    Start make build. Sometimes the process breaks and can be restarted by a loop to finish a few more packages.

    for i in {1..10}; do make -j$((`nproc`-1)) image IMG_NAME=iso THREADS=$((`nproc`-1)); done
    

Troubleshooting

"Failed during building package"

This occured eg. on 'Building rpm is failed /usr/src/photon/SPECS/kafka.spec'. The workaround is to restart the process with less parallel threads. make -j4 image IMG_NAME=iso THREADS=4

"error: metadata-generation-failed"

This version conflict caused issue occured on pip3 install photon-os-installer.git and ended with error: invalid command 'egg_info'. Try this if not already applied:

python -m pip install --upgrade pip
pip3 install --upgrade pip
pip3 install setuptools ez_setup

error openjdk17 build during make build of Photon OS iso on WSL2

Package build openjdk17-17.0.8 fails when using Photon OS on WSL2 as make build environment. The logfile indicates the reason.

checking for cygpath... [not found]
checking for wslpath... [not found]
checking for cmd.exe... [not found]

Solution or workaround: none Remarks: The root cause hasn't been identified yet. /bin/wslpath is present. Accordingly to the logfile, the installation meccano can detect wsl, but identified the environment as wsl1.

update sources

To update the source e.g. Photon OS 4.0, run the following commands:

cd /photon
git fetch
git merge origin/4.0