Opkg install on Ubuntu

Hi there,

Can I run opkg install on Ubuntu to install ipk to rootfs in Ubuntu?

My command is:

cd openwrt/staging_dir/
./host/bin/opkg -d ./target-arm-mix510-linux_musl/root-xxx/ -f ./target-arm-mix510-linux_musl/root-xxx/etc/opkg.conf install szd_demo_1.0-1_arm_cortex-a9.ipk

But I got error

Collected errors:
 * make_directory: Cannot create directory `//usr/lib/opkg': Permission denied.
 * make_directory: Cannot create directory `/var/opkg-lists': Permission denied.
 * make_directory: Cannot create directory `//usr/lib/opkg': Permission denied.
 * make_directory: Cannot create directory `/var/opkg-lists': Permission denied.
 * resolve_pkg_dest_list: Unknown dest name: `./target-arm-mix510-linux_musl/root-xxx/'.

Thanks a lot.

Please connect to your OpenWrt device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

ubus call system board

Take a look in include/rootfs.mk, it contains this incantation:

# where to build (and put) .ipk packages
opkg = \
  IPKG_NO_SCRIPT=1 \
  IPKG_INSTROOT=$(1) \
  TMPDIR=$(1)/tmp \
  $(STAGING_DIR_HOST)/bin/opkg \
	--offline-root $(1) \
	--force-postinstall \
	--add-dest root:/ \
	--add-arch all:100 \
	--add-arch $(if $(ARCH_PACKAGES),$(ARCH_PACKAGES),$(BOARD)):200
1 Like

Thank you very much, But I got another error

Unknown package 'szd_demo'.
Collected errors:
 * pkg_hash_check_unresolved: cannot find dependency libc for szd_demo
 * pkg_hash_check_unresolved: cannot find dependency libstdcpp6 for szd_demo
 * pkg_hash_fetch_best_installation_candidate: Packages for szd_demo found, but incompatible with the architectures configured
 * opkg_install_cmd: Cannot install package szd_demo.

ask the people you got the package from, it didn't come from here.

here is the code.

#include "demo.hpp"


int main(int argc, char* argv[]) {

	cout <<"This is a SZD C++ demo" <<endl;

	return 0;
}

the code is irrelevant, and I said package ...

you'll need to use sudo or an account with elevated permissions

being that this package is a simple demo, I would suggest omitting it from the build .. or add the relevant dependencies to the makefile

...
DEPENDS := +libstdcpp +libstdcxx
...

You need to first do a full build to create all the packages required for your demo package, then when you do your manual run of opkg it should work.

But, backing up a bit, what are you trying to accomplish? If you're just testing out creation of a package from scratch, none of this should be necessary, just put the thing into feeds/packages/ in the right place and do make menuconfig to see if it appears...