Bug 1086

Summary: "dpkg --list" shows "/var/lib/dpkg/status: No such file or directory"
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Dexuan Cui <dexuan.cui>
Component: coreAssignee: Dexuan Cui <dexuan.cui>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: dexuan.cui, dvhart, meta.mr.watcher, meta.watcher, sgw, shane.wang
Version: unspecified   
Target Milestone: 1.1   
Hardware: x86   
OS: Multiple   
Whiteboard: The patch is already in poky master(Sep 22, 2011)
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---
Bug Depends on: 1070    
Bug Blocks:    

Description Dexuan Cui 2011-05-18 18:31:00 UTC
In target,  "dpkg --list" shows "dpkg-query: failed to open package info file `/var/lib/dpkg/status' for reading: No such file or directory"

Actually the files(status and available) does exist, but not in /var/lib/dpkg/ -- they're in /var/dpkg/. "ln -s /var/dpkg/{status, available} /var/lib/dpkg" can resolve the issue.

grepping '/var/dpkg' shows there are many files(package_deb.bbclass, rootfs_deb.bbclass, populate_sdk_deb.bbclas, apt.conf,... ) in which '/var/dpkg' is used and /var/lib/dpkg is not used at all.

However, looks dpkg's default admindir is /var/lib/dpkg -- e.g., Ubuntu uses this.


Pasted Mark's reply in oe-core mailing list:
------------------------------------------------
I would say that /var/lib/dpkg is the "correct" directory to use.  This matches
the behavior on other deb bases systems.  (It also mimics other pkg managers who
place their data into /var/lib/...)

--Mark
------------------------------------------------

So looks we should fix the recipes which use /var/dpkg/.
Comment 1 Dexuan Cui 2011-05-24 00:20:44 UTC
Porting the commits of OE should fix this bug:

ommit 41e0fbf792037f249d1b8d283b3de81718887c9f
Author: Filip Zyzniewski <filip.zyzniewski@gmail.com>
Date:   Sun Feb 13 03:26:58 2011 +0000

    deb packages support: switch from /var/dpkg to /var/lib/dpkg

    OE generally tries to use /var/dpkg, but the change is missing
    in some places, so it is needed to move completely to one of the
    options. Keeping the dpkg's default /var/lib/dpkg causes less
    maintenance overhead for OE.

    Signed-off-by: Filip Zyzniewski <filip.zyzniewski@gmail.com>
    Signed-off-by: Tom Rini <tom_rini@mentor.com>


commit 3b801ad400951fbc722587a7cf83d40a957e5022
Author: Filip Zyzniewski <filip.zyzniewski@gmail.com>
Date:   Mon Feb 7 02:00:35 2011 +0000

    dpkg-native: Fix the admindir location.

    Until now the admindir was specified as $STAGING_DIR_NATIVE/var/dpkg,
    which caused update-alternatives to put alternative definitions there.
    This patch causes the definitions to be put into the host's rootfs
    during rootfs_deb_do_rootfs (when running busybox postinst for
    example).

    resulting line in Dpkg.pm: our $admindir="$ENV{D}/var/dpkg"

    Signed-off-by: Filip Zyzniewski <filip.zyzniewski@gmail.com>
    Signed-off-by: Tom Rini <tom_rini@mentor.com>


ps, this commit is not related to this bug, but we should also port it to poky since I believe poky does have the same isse by my test:

commit 1659da8e9279a6e2293a69c69ee26f27f694b089
Author: Filip Zyzniewski <filip.zyzniewski@gmail.com>
Date:   Sun Feb 20 18:27:00 2011 +0000

    package_deb.bbclass/apt: armel architecture name for eabi systems.

    For dpkg EABI system architecture is called armel, not arm.
    Reference: http://wiki.debian.org/ArmEabiPort

    Signed-off-by: Filip Zyzniewski <filip.zyzniewski@gmail.com>
    Signed-off-by: Tom Rini <tom_rini@mentor.com>
Comment 2 Dexuan Cui 2011-06-02 16:41:54 UTC
I've backported the patches and testing.