为什么 BitBake 生成的 OS 中缺少 /var/lib/dpkg/status?

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

我通过将 apt 包添加到我的食谱中的 IMAGE_INSTALL 变量,将 apt 安装到由 BitBake 构建的系统上。

apt-getapt-cache 现在在构建的系统上执行,但是如果我尝试对它们做任何有用的事情(例如 apt-get updateapt-cache search),我出现以下错误:

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

经过初步搜索,我在 Yocto Project 邮件列表中找到了这个交易所:

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.

这个错误是因为你需要在local.conf,package-management中添加package-managementEXTRA_IMAGE_FEATURES

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

我添加了 package-management 但没有看到任何不同的输出。

经过touch /var/lib/dpkg/statusapt-get update、returns如下:

Reading package lists...Done

如何通过使用 BitBake 元数据使 apt 进入正常运行状态?

我在 NXP 网站上找到了类似的 thread

您需要设置自己的网络服务器并提供所有这些包并将服务器 URL 添加到源列表。 SourceList

此外,您必须通过 运行 bitbake package-index 更新软件包清单并将 PACKAGE_CLASSES ?= " package_deb" 添加到 conf/local.conf

我之前已经成功设置过OPKG。步骤类似,大家可以找找here