Error: opkg while building openwrt for linksys 3200acm Router

I keep getting this crazy error that I cant seem to track down:

package/system/openwrt-keyring/compile.txt:install -d -m0755 /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/openwrt-keyring-2019-07-25-8080ef34/.pkgdir/openwrt-keyring/etc/opkg/keys/
package/system/openwrt-keyring/compile.txt:install -m0644 /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/openwrt-keyring-2019-07-25-8080ef34/usign/* /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/openwrt-keyring-2019-07-25-8080ef34/.pkgdir/openwrt-keyring/etc/opkg/keys/
package/system/openwrt-keyring/compile.txt:install -d -m0755 /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/openwrt-keyring-2019-07-25-8080ef34/ipkg-arm_cortex-a9_vfpv3-d16/openwrt-keyring/etc/opkg/keys/
package/system/openwrt-keyring/compile.txt:install -m0644 /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/openwrt-keyring-2019-07-25-8080ef34/usign/* /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/openwrt-keyring-2019-07-25-8080ef34/ipkg-arm_cortex-a9_vfpv3-d16/openwrt-keyring/etc/opkg/keys/
package/system/opkg/download.txt:make[2]: Entering directory '/home/eliminater74/Builds/openwrt/BUILD/openwrt/package/system/opkg'
package/system/opkg/download.txt:SHELL= flock /home/eliminater74/Builds/openwrt/BUILD/openwrt/tmp/.opkg-2020-12-24-9bbc7eae.tar.xz.flock -c '  	/home/eliminater74/Builds/openwrt/BUILD/openwrt/scripts/download.pl "/home/eliminater74/Builds/openwrt/BUILD/openwrt/dl" "opkg-2020-12-24-9bbc7eae.tar.xz" "baa32d1b381d0eb2e224f4742974581c6705c13814662442ebd1288a91c2d577" "" || (  	echo "Checking out files from the git repository..."; mkdir -p /home/eliminater74/Builds/openwrt/BUILD/openwrt/tmp/dl && cd /home/eliminater74/Builds/openwrt/BUILD/openwrt/tmp/dl && rm -rf opkg-2020-12-24-9bbc7eae && [ \! -d opkg-2020-12-24-9bbc7eae ] && git clone  https://git.openwrt.org/project/opkg-lede.git opkg-2020-12-24-9bbc7eae && (cd opkg-2020-12-24-9bbc7eae && git checkout 9bbc7eae91edc3dbb020e2a50d51d9a3fbbf31ca && git submodule update --init --recursive) && echo "Packing checkout..." && export TAR_TIMESTAMP=`cd opkg-2020-12-24-9bbc7eae && git log -1 --format='\''@%ct'\''` && rm -rf opkg-2020-12-24-9bbc7eae/.git && 	tar --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name ${TAR_TIMESTAMP:+--mtime="$TAR_TIMESTAMP"} -c opkg-2020-12-24-9bbc7eae | 	xz -zc -7e > /home/eliminater74/Builds/openwrt/BUILD/openwrt/tmp/dl/opkg-2020-12-24-9bbc7eae.tar.xz && mv /home/eliminater74/Builds/openwrt/BUILD/openwrt/tmp/dl/opkg-2020-12-24-9bbc7eae.tar.xz /home/eliminater74/Builds/openwrt/BUILD/openwrt/dl/ && rm -rf opkg-2020-12-24-9bbc7eae;  )    '
package/system/opkg/download.txt:+ curl -f --connect-timeout 20 --retry 5 --location --insecure https://sources.openwrt.org/opkg-2020-12-24-9bbc7eae.tar.xz
package/system/opkg/download.txt:make[2]: Leaving directory '/home/eliminater74/Builds/openwrt/BUILD/openwrt/package/system/opkg'
package/system/opkg/download.txt:time: package/system/opkg/download#0.17#0.09#1.22
target/linux/install.txt:IPKG_NO_SCRIPT=1 IPKG_INSTROOT=/home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/root.orig-mvebu TMPDIR=/home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/root.orig-mvebu/tmp /home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/bin/opkg --offline-root /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/root.orig-mvebu --force-postinstall --add-dest root:/ --add-arch all:100 --add-arch arm_cortex-a9_vfpv3-d16:200 list-installed > /home/eliminater74/Builds/openwrt/BUILD/openwrt/bin/targets/mvebu/cortexa9/openwrt-snapshot-r15338-8348896357-mvebu-cortexa9-linksys_wrt3200acm.manifest
target/linux/install.txt:bash: line 1: /home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/bin/opkg: No such file or directory

Error: target/linux/install.txt:bash: line 1: /home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/bin/opkg: No such file or directory

Just started having this issue some time ago, cant seem to figure out what the deal is,
from what I see is this is what it should be doing:

package/system/opkg/download.txt:time: package/system/opkg/download#0.19#0.10#2.45
package/system/opkg/host-compile.txt:make[2]: Entering directory '/home/eliminater74/Builds/openwrt/BUILD/openwrt/package/system/opkg'
package/system/opkg/host-compile.txt:SHELL= flock /home/eliminater74/Builds/openwrt/BUILD/openwrt/tmp/.opkg-2020-12-05-efb26a35.tar.xz.flock -c '  	/home/eliminater74/Builds/openwrt/BUILD/openwrt/scripts/download.pl "/home/eliminater74/Builds/openwrt/BUILD/openwrt/dl" "opkg-2020-12-05-efb26a35.tar.xz" "9294140567f1b122a7229fc80ab1b70e167b478c1a3062e0b64631c189beeda5" "" || (  	echo "Checking out files from the git repository..."; mkdir -p /home/eliminater74/Builds/openwrt/BUILD/openwrt/tmp/dl && cd /home/eliminater74/Builds/openwrt/BUILD/openwrt/tmp/dl && rm -rf opkg-2020-12-05-efb26a35 && [ \! -d opkg-2020-12-05-efb26a35 ] && git clone  https://git.openwrt.org/project/opkg-lede.git opkg-2020-12-05-efb26a35 && (cd opkg-2020-12-05-efb26a35 && git checkout efb26a35e4e5446f135307c4ff7df9e9563c23a9 && git submodule update --init --recursive) && echo "Packing checkout..." && export TAR_TIMESTAMP=`cd opkg-2020-12-05-efb26a35 && git log -1 --format='\''@%ct'\''` && rm -rf opkg-2020-12-05-efb26a35/.git && 	tar --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name ${TAR_TIMESTAMP:+--mtime="$TAR_TIMESTAMP"} -c opkg-2020-12-05-efb26a35 | 	xz -zc -7e > /home/eliminater74/Builds/openwrt/BUILD/openwrt/tmp/dl/opkg-2020-12-05-efb26a35.tar.xz && mv /home/eliminater74/Builds/openwrt/BUILD/openwrt/tmp/dl/opkg-2020-12-05-efb26a35.tar.xz /home/eliminater74/Builds/openwrt/BUILD/openwrt/dl/ && rm -rf opkg-2020-12-05-efb26a35;  )    '
package/system/opkg/host-compile.txt:. /home/eliminater74/Builds/openwrt/BUILD/openwrt/include/shell.sh; xzcat /home/eliminater74/Builds/openwrt/BUILD/openwrt/dl/opkg-2020-12-05-efb26a35.tar.xz | tar -C /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/hostpkg/opkg-2020-12-05-efb26a35/.. -xf -
package/system/opkg/host-compile.txt:[ ! -d ./src/ ] || cp -fpR ./src/* /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/hostpkg/opkg-2020-12-05-efb26a35
package/system/opkg/host-compile.txt:touch /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/hostpkg/opkg-2020-12-05-efb26a35/.preparedd5b3bbd74fc714fcc08b52064361c6d4_6664517399ebbbc92a37c5bb081b5c53
package/system/opkg/host-compile.txt:(cd /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/hostpkg/opkg-2020-12-05-efb26a35; CFLAGS="-O2 -I/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/include -I/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/hostpkg/include -I/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/host/include" CXXFLAGS="-O2 -I/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/include -I/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/hostpkg/include -I/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/host/include" LDFLAGS="-L/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/lib -L/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/hostpkg/lib -L/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/host/lib" cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/bin/ccache" -DCMAKE_C_COMPILER_ARG1="gcc" -DCMAKE_CXX_COMPILER="/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/bin/ccache" -DCMAKE_CXX_COMPILER_ARG1="g++" -DCMAKE_ASM_COMPILER="/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/bin/ccache" -DCMAKE_ASM_COMPILER_ARG1="gcc" -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_EXE_LINKER_FLAGS:STRING="-L/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/lib -L/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/hostpkg/lib -L/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/host/lib" -DCMAKE_MODULE_LINKER_FLAGS:STRING="-L/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/lib -L/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/hostpkg/lib -L/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/host/lib" -DCMAKE_SHARED_LINKER_FLAGS:STRING="-L/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/lib -L/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/hostpkg/lib -L/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/host/lib" -DCMAKE_FIND_ROOT_PATH="/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/host;/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/hostpkg;/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host" -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_STRIP=: -DCMAKE_INSTALL_PREFIX=/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/hostpkg -DCMAKE_PREFIX_PATH=/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/hostpkg -DCMAKE_SKIP_RPATH=TRUE -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_EXPORT_PACKAGE_REGISTRY=FALSE -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=TRUE -DCMAKE_FIND_USE_PACKAGE_REGISTRY=FALSE -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=TRUE -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=FALSE -DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=TRUE -DSTATIC_UBOX=ON -DBUILD_TESTS=OFF -DHOST_CPU=arm_cortex-a9_vfpv3-d16 -DLOCK_FILE=/tmp/opkg.lock -DVERSION="efb26a35e4e5446f135307c4ff7df9e9563c23a9 (2020-12-05)" /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/hostpkg/opkg-2020-12-05-efb26a35 )
package/system/opkg/host-compile.txt:-- Build files have been written to: /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/hostpkg/opkg-2020-12-05-efb26a35
package/system/opkg/host-compile.txt:touch /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/hostpkg/opkg-2020-12-05-efb26a35/.configured
package/system/opkg/host-compile.txt:CFLAGS="-O2 -I/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/include -I/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/hostpkg/include -I/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/host/include" CPPFLAGS="-I/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/include -I/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/hostpkg/include -I/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/host/include" CXXFLAGS="" LDFLAGS="-L/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/lib -L/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/hostpkg/lib -L/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/host/lib" make --jobserver-auth=3,4  -C /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/hostpkg/opkg-2020-12-05-efb26a35  
package/system/opkg/host-compile.txt:make[3]: Entering directory '/home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/hostpkg/opkg-2020-12-05-efb26a35'
package/system/opkg/host-compile.txt:make[4]: Entering directory '/home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/hostpkg/opkg-2020-12-05-efb26a35'
package/system/opkg/host-compile.txt:make[5]: Entering directory '/home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/hostpkg/opkg-2020-12-05-efb26a35'
package/system/opkg/host-compile.txt:make[5]: Leaving directory '/home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/hostpkg/opkg-2020-12-05-efb26a35'
package/system/opkg/host-compile.txt:make[5]: Entering directory '/home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/hostpkg/opkg-2020-12-05-efb26a35'
package/system/opkg/host-compile.txt:make[5]: Leaving directory '/home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/hostpkg/opkg-2020-12-05-efb26a35'
package/system/opkg/host-compile.txt:make[5]: Entering directory '/home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/hostpkg/opkg-2020-12-05-efb26a35'
package/system/opkg/host-compile.txt:Scanning dependencies of target opkg

But its not even changing into that Directory to even build:
see:

package/system/opkg/download.txt:time: package/system/opkg/download#0.17#0.09#1.22
target/linux/install.txt:IPKG_NO_SCRIPT=1 IPKG_INSTROOT=/home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/root.orig-mvebu TMPDIR=/home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/root.orig-mvebu/tmp /home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/bin/opkg --offline-root /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/root.orig-mvebu --force-postinstall --add-dest root:/ --add-arch all:100 --add-arch arm_cortex-a9_vfpv3-d16:200 list-installed > /home/eliminater74/Builds/openwrt/BUILD/openwrt/bin/targets/mvebu/cortexa9/openwrt-snapshot-r15338-8348896357-mvebu-cortexa9-linksys_wrt3200acm.manifest
target/linux/install.txt:bash: line 1: /home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/bin/opkg: No such file or directory
[eliminater74@PureFusion:logs]$ cd ..
logs_20201215/  logs_20201215-2/  logs_20201216/  logs/
[eliminater74@PureFusion:[LOGS]]$ cd logs_20201216

so I am lost to what the deal is, can anyone tell me what I am doing wrong.........

Thanks, to anyone that can help.

Not sure how host opkg ended up being missing. Try the following to see if we can remade it

make package/opkg/host/clean
make package/opkg/host/compile

Or try a clean build and this time record each steps taken

Looks like that worked:

 ➭ make package/opkg/host/clean
 make[1] package/opkg/host/clean
 make[2] -C package/system/opkg host-clean
✔  21:50:34 ‹5.9.16-1-clear›  ~/Builds/openwrt/BUILD/openwrt [master ↓·1|✚ 1… 1]
 ➭ make package/opkg/host/compile
 make[1] package/opkg/host/compile
 make[2] -C package/libs/libjson-c host-compile
 make[2] -C package/libs/libubox host-compile
 make[2] -C package/system/opkg host-compile

But still Dont understand the problem, and I have used clean builds ,many times..
also my main Linux system is Arch Linux,
but had the same problem on 2 very different Virtual-box Ubuntu and Debian Systems...

Not to mention on 2 different computer systems.

In case the scene is still there, please check if staging_dir/host/bin/opkg is really there. Sometimes the "no such file or directory" error is for program interpreter, not the executable itself.

Try the following command and check the ld-linux-xx.so part

➜  ~/git-repo/openwrt/openwrt git:(hybla) ldd staging_dir/host/bin/opkg
        linux-vdso.so.1 =>  (0x00007ffc04df9000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa1ce5dd000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fa1ce20f000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fa1ce7f9000)
1 Like

here is the results of that command:

 ➭ ldd staging_dir/host/bin/opkg
	linux-vdso.so.1 (0x00007ffc6c1b1000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007ff7138d6000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007ff71370d000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007ff713986000)

Also using a script to build openWRT and adding the

make package/opkg/host/clean
make package/opkg/host/compile

I now get this error:

DEVICE_ID="linksys_wrt3200acm" BIN_DIR="/home/eliminater74/Builds/openwrt/BUILD/openwrt/bin/targets/mvebu/cortexa9" SOURCE_DATE_EPOCH=1608827021 IMAGE_NAME="openwrt-snapshot-r15339-bc99b56d7e-mvebu-cortexa9-linksys_wrt3200acm-squashfs-factory.img" IMAGE_TYPE=factory IMAGE_FILESYSTEM="squashfs" IMAGE_PREFIX="openwrt-snapshot-r15339-bc99b56d7e-mvebu-cortexa9-linksys_wrt3200acm" DEVICE_VENDOR="Linksys" DEVICE_MODEL="WRT3200ACM" DEVICE_VARIANT="" DEVICE_ALT0_VENDOR="Linksys" DEVICE_ALT0_MODEL="Rango" DEVICE_ALT0_VARIANT="" DEVICE_ALT1_VENDOR="" DEVICE_ALT1_MODEL="" DEVICE_ALT1_VARIANT="" DEVICE_ALT2_VENDOR="" DEVICE_ALT2_MODEL="" DEVICE_ALT2_VARIANT="" DEVICE_TITLE="Linksys WRT3200ACM" DEVICE_PACKAGES="kmod-mwlwifi wpad-basic-wolfssl kmod-btmrvl kmod-mwifiex-sdio mwlwifi-firmware-88w8964 iwinfo" TARGET="mvebu" SUBTARGET="cortexa9" VERSION_NUMBER="SNAPSHOT" VERSION_CODE="r15339-bc99b56d7e" SUPPORTED_DEVICES="linksys,wrt3200acm armada-385-linksys-rango linksys,rango" /home/eliminater74/Builds/openwrt/BUILD/openwrt/scripts/json_add_image_info.py /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/json_info_files/openwrt-snapshot-r15339-bc99b56d7e-mvebu-cortexa9-linksys_wrt3200acm-squashfs-factory.img.json
IPKG_NO_SCRIPT=1 IPKG_INSTROOT=/home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/root.orig-mvebu TMPDIR=/home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/root.orig-mvebu/tmp /home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/bin/opkg --offline-root /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/root.orig-mvebu --force-postinstall --add-dest root:/ --add-arch all:100 --add-arch arm_cortex-a9_vfpv3-d16:200 list-installed > /home/eliminater74/Builds/openwrt/BUILD/openwrt/bin/targets/mvebu/cortexa9/openwrt-snapshot-r15339-bc99b56d7e-mvebu-cortexa9-linksys_wrt3200acm.manifest
Collected errors:
 * opkg_conf_load: Could not create lock file /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/root.orig-mvebu//tmp/opkg.lock: No such file or directory.
make[4]: *** [Makefile:142: install] Error 255
make[4]: Leaving directory '/home/eliminater74/Builds/openwrt/BUILD/openwrt/target/linux/mvebu/image'
make[3]: *** [Makefile:21: install] Error 2
make[3]: Leaving directory '/home/eliminater74/Builds/openwrt/BUILD/openwrt/target/linux/mvebu'
make[2]: *** [Makefile:13: install] Error 2
make[2]: Leaving directory '/home/eliminater74/Builds/openwrt/BUILD/openwrt/target/linux'
time: target/linux/install#1527.17#179.31#296.45
    ERROR: target/linux failed to build.
make[1]: *** [target/Makefile:25: target/linux/install] Error 1
make[1]: Leaving directory '/home/eliminater74/Builds/openwrt/BUILD/openwrt'
make: *** [/home/eliminater74/Builds/openwrt/BUILD/openwrt/include/toplevel.mk:242: target/install] Error 2

Were those parent directories there?

Your full script and also the condition before the script execution may matter here. That said, the opkg host clean & compile command was provided solely for trying to fix the previous issue, for once. No need to run them on every build

Here is my script that I had working 100% till just recently with that opkg error:
I make some mods and changes from time 2 time just to see if I can make it better..
work in progress.. I took the log from the buildbots for this wrt3200ACM Router build.
and kinda just followed it along with my script.. it seemed to have been working for a while now..
also note, when I just build the basic .config from snapshot for this device.. it builds without error:
but when I build my known working .configs, it now gives that opkg error..
gota me something im adding or something that was changed that is causing this now.

Here is my work in progress:

#!/bin/sh
#
#   Copyright (C) 2006-2021
#
# Updated: 12/20/2020
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
########################################################################################
# exec 3>&1 1>>${LOG_FILE} 
#
# echo -e "${blue} This is stdout"
# echo -e "${blue} This is stderr" 1>&2
# echo -e "${blue} This is the console (fd 3)" 1>&3
# echo -e "${blue} This is both the log and the console":${reset}" | tee /dev/fd/3
#######################################################################################
### ============================================= ###
# Ansi color code variables
red="\e[0;91m"
blue="\e[0;94m"
expand_bg="\e[K"
blue_bg="\e[0;104m${expand_bg}"
red_bg="\e[0;101m${expand_bg}"
green_bg="\e[0;102m${expand_bg}"
green="\e[0;92m"
white="\e[0;97m"
bold="\e[1m"
uline="\e[4m"
reset="\e[0m"
### ============================================= ###

SECONDS=0
CDBU=$(date +"%F_%H%M%S")
#BAK="../abu/$CDBU"
#cp .config "$BAK"
#cd openwrt
### -------------------------------------------------- ###
echo -e "${blue} ${blue} Setting up Logfile:${reset}"
#LOG_FILE=/tmp/openWRT.log
LOG_FILE="../build_$CDBU.log"
#exec > >(tee ${LOG_FILE}) 2>&1
#LOG_FILE="./logfile_$CDBU.log"
#exec 3>&1 1>>${LOG_FILE} 2>&1
### -------------------------------------------------- ###

### -------------------------------------------------------------- ###

export TOOLCHAIN=/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-8.4.0_musl_eabi/bin
export STAGINGDIR=/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/bin
export STAGING_DIR=/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-8.4.0_musl_eabi
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

######################
#### ADDING PATHS #### Updated: 12/24/2020
######################
# Append "$1" to $PATH when not already in.
# This function API is accessible to scripts in /etc/profile.d
append_path () {
    case ":$PATH:" in
        *:"$1":*)
            ;;
        *)
            PATH="${PATH:+$PATH:}$1"
    esac
}
### -------------------------------------------------------------- ###

# Append our default paths
append_path $TOOLCHAIN
append_path $STAGINGDIR
# append_path $
# append_path 
# Force PATH to be environment
export PATH





echo -e "${green_bg} ${expand_bg} ${reset}"
echo -e "${green_bg} ${expand_bg} ${reset}"
echo -e "${blue} :${reset}"
echo -e "${green} You are about to build OpenWRT Firmware:${reset}"
echo -e "${blue} :${reset}"
echo -e "${red} :${reset}"
echo -e "${blue} :${reset}"
echo -e "${green} Getting Ready To Build OpenWRT Firmware:${reset}"
echo -e "${blue} :${reset}"
echo -e "${green} Updating Main Source. (git pull) ${reset}"
git pull
[ "$?" -ne 0 ] && echo -e "${red} Updating the main OpenWrt source code failed.${reset}" && exit 1
echo -e "${blue} gitcheckout Ensure that Git HEAD is sane:${reset}" 
if [ -d .git ]; then git checkout -f master; git branch --set-upstream-to origin/master; else exit 0; fi
echo -e "${blue} gitfresh update:${reset}"
echo -e "${green} Please Wait, Might take a while:${reset}"
git clean -f -f -d -x
echo -e "${blue} fetchrefs Fetching Git remote refs:${reset}" 
git fetch origin +refs/heads/master:refs/remotes/origin/master
echo -e "${blue} gitverify Ensure that Git HEAD is pointing to a branch or tag:${reset}" 
git rev-parse --abbrev-ref HEAD | grep -vxqF HEAD || git show-ref --tags --dereference 2>/dev/null | sed -ne "/^$(git rev-parse HEAD) / { s|^.*/||; s|\^.*||; p }" | grep -qE "^v[0-9][0-9]\."
### ---------------[ Create Random Envirement ]--------------------------------------- ###
echo -e "${green} Create New Random Envirement:${reset}" 
./scripts/env new linksys"$RANDOM"
### ---------------------------------------------------------------------------------- ###
echo -e "${blue} Clone Luci Theme argon to package:${reset}" 
git clone git@github.com:jerrykuku/luci-theme-argon.git package/luci-theme-argon
echo -e "${blue} rmtmp Remove tmp folder:${reset}" 
rm -rf tmp/
echo -e "${blue} rmbuild_dir Remove build_dir folder:${reset}" 
rm -rf build_dir
echo -e "${blue} rmfeedlinks Remove feed symlinks:${reset}" 
rm -rf package/feeds/
### ------------------------------------------------------------------------------------------------------------------------------ ###
echo -e "${blue} dlfeeds Downloading feeds.conf.default:${reset}" 
#wget https://downloads.openwrt.org/snapshots/targets/mvebu/cortexa9/feeds.buildinfo  -O feeds.conf.default
#wget https://gist.githubusercontent.com/Eliminater74/d7347ba9aad666ffd4c42a1a0ba49007/raw/5221406dbaa5ebd460e01740a1bd632b06016d01/feeds.conf.default -O feeds.conf.default
### ------------------------------------------------------------------------------------------------------------------------------ ###
echo -e "${blue} cpfeeds Copying feeds.conf.default:${reset}" 
cp ../feeds.conf.default feeds.conf.default
echo -e "${blue} updatefeeds Updating feeds:${reset}" 
./scripts/feeds update -a
[ "$?" -ne 0 ] && echo -e "${red} Updating the feeds failed.${reset}" && exit 1
echo -e "${blue} installfeeds Installing feeds:${reset}" 
./scripts/feeds install -a
echo -e "${blue} Creating LOGS Directory:${reset}"
mkdir -p logs
# ======================================================================================================== #
#echo -e "${blue} dlconfigseed downloading Snapshot config.buildinfo to .config:${reset}"
#wget https://downloads.openwrt.org/snapshots/targets/mvebu/cortexa9/config.buildinfo -O .config
#echo -e "${blue} dlconfigseed downloading Stable config.buildinfo to .config:${reset}"
#wget https://downloads.openwrt.org/releases/19.07.4/targets/mvebu/cortexa9/config.buildinfo -O .config
#echo -e "${blue} dlconfigseed Downloading Davidc502's config.buildinfo to .config:${reset}"
#wget https://dc502wrt.org/releases/config.buildinfo -O .config
echo -e "${blue} configseed copy .config to current dir:${reset}" 
cp ../.config .config
# ======================================================================================================== #
echo -e "${blue} newconfig Seeding .config:${reset}" 
printf 'CONFIG_TARGET_mvebu=y\nCONFIG_TARGET_mvebu_cortexa9=y\nCONFIG_SIGNED_PACKAGES=y\n' >> .config
echo -e "${blue} newconfig Seeding extra .config:${reset}" 
printf 'CONFIG_TARGET_mvebu_cortexa9_DEVICE_linksys_wrt3200acm=y\nCONFIG_CCACHE=y\nCONFIG_BUILD_LOG=y\n' >> .config
echo -e "${blue} delbin Removing output directory:${reset}" 
rm -rf bin/
echo -e "${blue} Cleaning scripts/config:${reset}" 
make scripts/config/ clean V=s
echo -e "${blue} defconfig Populating .config:${reset}" 
make defconfig
echo -e "${blue} Checking architecture:${reset}" 
grep -sq CONFIG_TARGET_mvebu=y .config
echo -e "${blue} property 'libc' set:${reset}" 
sed -ne '/^CONFIG_LIBC=/ { s!^CONFIG_LIBC="\(.*\)"!\1!; s!^musl$!!; s!.\+!-&!p }' .config
echo -e "${blue} Preparing ./dl and linking it:${reset}" 
# mkdir -p $PWD/dl && rm -rf ./dl && ln -sf $PWD/dl ./dl
rm -rf ./dl && mkdir -p ../dl && ln -sf ../dl ./dl
echo -e "${blue} menuconfig menuconfig .config, Please Wait:${reset}" 
make menuconfig
echo -e "${blue} Building and installing GNU tar:${reset}" 
make -j$(($(nproc)+1)) tools/tar/compile V=s 
echo -e "${blue} Populating dl/:${reset}" 
make -j$(($(nproc)+1)) download V=s
echo -e "${blue} Cleaning base-files:${reset}" 
make package/base-files/clean V=s 
echo -e "${blue} Cleaning luci:${reset}" 
make package/luci/clean V=s
### -----------------------------------[CCACHE HOLD]---------------------------------- ###
echo -e "${blue} Setting ccache directory:${reset}"
export CCACHE_DIR=/home/eliminater74/Builds/openwrt/BUILD/openwrt/.ccache
echo -e "${blue} Fix Sloppiness of ccache:${reset}"
ccache --set-config=sloppiness=file_macro,locale,time_macros
### ---------------------------------------------------------------------------------- ###
echo -e "${blue} Building and installing tools:${reset}" 
make -j$(($(nproc)+1)) tools/install V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
echo -e "${blue} Building and installing toolchain:${reset}" 
make -j$(($(nproc)+1)) toolchain/install V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
echo -e "${blue} Building kmods:${reset}" 
make -j$(($(nproc)+1)) target/compile 'IGNORE_ERRORS=n m' BUILD_LOG=1 V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
echo -e "${blue} property 'kernelversion' set:${reset}" 
make --no-print-directory -C target/linux/ val.LINUX_VERSION val.LINUX_RELEASE val.LINUX_VERMAGIC | xargs printf '%s-%s-%s\n'
echo -e "${blue} Cleaning up package build:${reset}" 
make package/cleanup V=s
### --------------------------------------------------------------------------------------- ###
### ------------[ SYSTEM FILE NAME CHANGES WORKAROUND]------------------------------------- ###
echo -e "${red}Renaming Some system Files To Fix Some Packages: (Ugly Workaround)${reset}" 
# sudo mv /usr/lib/libgcc_s.so.1 /usr/lib/libgcc_s.so.1.bak
# sudo mv /usr/lib/libpthread.so /usr/lib/libpthread.so.bak
# sudo mv /usr/lib/libpthread.a /usr/lib/libpthread.a.bak
# sudo mv /usr/lib/libc.a /usr/lib/libc.a.bak
# sudo mv /usr/lib/libpam.so /usr/lib/libpam.so.bak
# sudo mv /usr/lib/libiconv.so /usr/lib/libiconv.so.bak
### --------------------------------------------------------------------------------------- ###
echo -e "${blue} Building packages:${reset}" 
make -j$(($(nproc)+1)) package/compile 'IGNORE_ERRORS=n m' BUILD_LOG=1 V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
### --------------------------------------------------------------------------------------- ###
echo -e "${red}CHanging System Files Back:${reset}" 
# sudo mv /usr/lib/libgcc_s.so.1.bak /usr/lib/libgcc_s.so.1
# sudo mv /usr/lib/libpthread.so.bak /usr/lib/libpthread.so
# sudo mv /usr/lib/libpthread.a.bak /usr/lib/libpthread.a
# sudo mv /usr/lib/libc.a.bak /usr/lib/libc.a
# sudo mv /usr/lib/libpam.so.bak /usr/lib/libpam.so
# sudo mv /usr/lib/libiconv.so.bak /usr/lib/libiconv.so
### --------------------------------------------------------------------------------------- ###
### ---------[ TMP Create Exit to Fix Broken Packages ]------------------------------------ ###
#echo -e "${red} Exited: Please Run Next Script After Fixing Packages:${reset}" 
#exit
### --------------------------------------------------------------------------------------- ###
#echo -e "${red} Cleaning up package host opkg:${reset}" 
#make package/opkg/host/clean V=s
#echo -e "${red} Building package Host opkg:${reset}" 
#make -j$(($(nproc)+1)) package/opkg/host/compile V=s  'IGNORE_ERRORS=n m' BUILD_LOG=1
echo -e "${blue} Installing packages:${reset}" 
make -j$(($(nproc)+1)) package/install V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
echo -e "${blue} Indexing packages:${reset}" 
make -j$(($(nproc)+1)) package/index CONFIG_SIGNED_PACKAGES= V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
echo -e "${blue} Building and installing images:${reset}" 
make -j$(($(nproc)+1)) target/install V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
echo -e "${blue} Generating config.buildinfo, version.buildinfo and feeds.buildinfo:${reset}" 
make -j1 buildinfo V=s  || true
echo -e "${blue} Generate profiles.json in target folder:${reset}" 
make -j1 json_overview_image_info V=s  || true
echo -e "${blue} Calculating checksums:${reset}" 
make -j1 checksum V=s 
echo -e "${blue} df Reporting disk usage:${reset}" 
df -h
echo -e "${blue} Setting ccache directory again:${reset}"
export CCACHE_DIR=/home/eliminater74/Builds/openwrt/BUILD/openwrt/.ccache
echo -e "${blue} ccachestat Reporting ccache stats:${reset}"
ccache -s
echo -e "${blue} :${reset}" 
echo -e "${blue} :${reset}" 
### ---------------[ Timer Display ]---------------------------------------------------- ###
if (( $SECONDS > 3600 )) ; then
    let "hours=SECONDS/3600"
    let "minutes=(SECONDS%3600)/60"
    let "seconds=(SECONDS%3600)%60"
    echo -e "${green} Completed in $hours hour(s), $minutes minute(s) and $seconds second(s)${reset}" 
elif (( $SECONDS > 60 )) ; then
    let "minutes=(SECONDS%3600)/60"
    let "seconds=(SECONDS%3600)%60"
    echo -e "${green} Completed in $minutes minute(s) and $seconds second(s)${reset}"
else
    echo -e "${green} Completed in $SECONDS seconds${reset}"
fi
### ------------------------------------------------------------------------------------ ###
echo -e "${blue} :${reset}" 
echo -e "${blue} :${reset}" 
echo -e "${green} Finished: Your Image(s)/Package(s) are in ./bin:${reset}" 
###################################################################################################################################
### BELOW NOT REALLY USED ###
#############################

echo -e "${blue} :${reset}" 
echo -e "${blue} :${reset}" 
echo -e "${blue} :${reset}" 

my last working build was on 20201221, since then, hasnt worked at all.

Usually I just do

cp dev-config .config
make defconfig
make -j7

I invoke make with specific targets like package/opkg/host/compile, target/compile only when debugging/testing something. I got the impression that these build targets are somewhat "loosely" depended on each other and got to prepare myself to check further should a random invoke fail

been down that road also, had just as many problems before going to a scrip way following the same way the buildbots for openwrt do.. it has worked for months just till 12/21/2020. Now it doesnt work
anymore.. get that errors about opkg all the time no matter what I do.. if I build a basic wrt3200acm min firmware, it works perfect without that error........

So it would be nice to know why I get this error:

also, I build on my Main Machine Arch Linux, also have tried on VirtualBox Debian Latest and Ubuntu both Desktop and Server latest....... and built both ways, using Make and using script..
and always Errors out........ So either way, something is wrong.

after doing a bit more debugging, I see that I think my Error is here:

make[4]: Entering directory '/home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/libiconv-1.16/src'
make[4]: *** [Makefile:114: install] Error 1
make[3]: *** [Makefile:54: install] Error 2
make[2]: *** [Makefile:93: /home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/libiconv-1.16/.built] Error 2
make[1]: *** [package/Makefile:114: package/libs/libiconv-full/compile] Error 1

Which prob explains why opkg never got built and or installed..

It builds fine when I do this manually:

 ➭ make package/libiconv/host/clean
 make[1] package/libiconv/host/clean
 make[2] -C package/libs/libiconv host-clean
✔  11:24:04 ‹5.9.16-1-clear›  ~/Builds/openwrt/BUILD/openwrt [master|✚ 1… 1]
 ➭ make package/libiconv/host/compile
 make[1] package/libiconv/host/compile
 make[2] -C package/libs/libiconv host-compile

So im lost:

Here is the reason:

libtool: link: ccache_cc -znow -zrelro -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -fmacro-prefix-map=/home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/libiconv-1.16=libiconv-1.16 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z -Wl,now -Wl,-z -Wl,relro -Wl,-rpath -Wl,\$ORIGIN/../lib iconv.o -o iconv  -L/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-8.4.0_musl_eabi/usr/lib -L/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-8.4.0_musl_eabi/lib ../srclib/libicrt.a /usr/lib/libiconv.so
/usr/lib/libiconv.so: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:114: install] Error 1
make[4]: Leaving directory '/home/eliminater74/Builds/openwrt/BUILD/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/libiconv-1.16/src'

But I dont think thats the main reason for the opkg to fail........

this just might be one that I overlooked before...

because the main reason for above is my Arch linux, it tends to try and use my system libs over the built libes from the toolchain...

reason behind renaming some system files during the package build... but I have that section disabled for now.