Search code examples
aptyoctodpkgbitbakeopenembedded

Why is /var/lib/dpkg/status missing on a BitBake-generated OS?


I have installed apt onto a system built by BitBake by adding the apt package to the IMAGE_INSTALL variable in my recipe.

apt-get and apt-cache now execute on the built system, but if I try to do anything useful with them (such as apt-get update or apt-cache search), I get the following error:

E: Could not open file /var/lib/dpkg/status - open (2: No such file or directory)
E: The package lists or status file could not be parsed or opened

After some preliminary searching, I found this exchange on the Yocto Project mailing list:

Hi,

I have some requirement with apt-get in yocto genearted rootfs.

I built the yocto source code with enabling the apt package.

But after booting the image on my machine and run the "apt-get" command for installing some package it gives the following error.

Could not open the file /var/lib/dpkg/status open(2: no such a file or directory).

The package lists or status files could not be parsed or opened.

This error is because you need to add package-management to EXTRA_IMAGE_FEATURES in local.conf,

PACKAGE_CLASSES ?= "package_deb"
EXTRA_IMAGE_FEATURES = "debug-tweaks package-management"

I've added package-management but don't see any different output.

After a touch /var/lib/dpkg/status, apt-get update returns the following:

Reading package lists...Done

How can I get apt into a functioning state through the use of BitBake metadata?


Solution

  • I have found a similar thread from the NXP website.

    You would need to set up your own web server and provide all those packages and add the server URL to the source list. SourceList

    In addition, you have to update the package manifest by running bitbake package-index and add PACKAGE_CLASSES ?= " package_deb" to conf/local.conf

    I have successfully set up OPKG before. The steps are similar, you can find it here