In readonly A/B update, debian package info will overwrite

Hello everybody
when using A/B mode, i used overlayfs for some places like:

  • /var/
  • /etc/
  • /home/
    this overlays has some side effects. one of them is debian package info will
    not updated when updating system.
    /var/lib/dpkg/ will be changed for the first boot and after update it will not updated.
    and dpkg-query always shows old package versions.
    has anyone a solution for this problem?

i asked chatgpt for this problem and below solution is given. is it true?

SUMMARY = "Custom solution hook script for updating package information"
DESCRIPTION = "A custom solution hook script that updates package information after an A/B Mender update."

LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://"

S = "${WORKDIR}"

do_install() {
    install -d ${D}${sysconfdir}/mender/postinstall.d
    install -m 0755 ${S}/ ${D}${sysconfdir}/mender/postinstall.d/

FILES_${PN} += "${sysconfdir}/mender/postinstall.d"

inherit mender-script



# Update package information using dpkg
dpkg --configure -a

Sorry, @chezgi,

The snippet provided by ChatGPT seems to be mostly nonsense, especially given the fact that it is a Yocto-ish-looking thing, and you asked for Debian.


thanks @TheYoctoJester
i asked for yocto,
readonly rootfs and A/B update mechanism is used in yocto not debian.

the package management used for yocto is dpkg.
you can select package management system in yocto [rpm,dpkg,…]