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

**URL:** https://hub.mender.io/t/in-readonly-a-b-update-debian-package-info-will-overwrite/5867
**Category:** General Discussions
**Tags:** yocto
**Created:** [May 29, 2023, 5:42am UTC](https://hub.mender.io/t/in-readonly-a-b-update-debian-package-info-will-overwrite/5867 "2023-05-29T05:42:35Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![chezgi](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/chezgi/32/1887_2.png) [@chezgi](https://hub.mender.io/u/chezgi)
#### Post date: [May 29, 2023, 5:42am UTC](https://hub.mender.io/t/in-readonly-a-b-update-debian-package-info-will-overwrite/5867/1 "2023-05-29T05:42:35Z")

</div>

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?  
thanks

---

<div class="post-metadata">

### Author: ![chezgi](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/chezgi/32/1887_2.png) [@chezgi](https://hub.mender.io/u/chezgi)
#### Post date: [June 7, 2023, 11:51am UTC](https://hub.mender.io/t/in-readonly-a-b-update-debian-package-info-will-overwrite/5867/2 "2023-06-07T11:51:27Z")

</div>

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

update\_pkginfo.bb:

```auto
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."

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

SRC_URI = "file://update_package_info.sh"

S = "${WORKDIR}"

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

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

inherit mender-script

MENDER_POSTINSTALL_SCRIPT = "update_package_info.sh"

```

update\_package\_info.sh:

```sh
#!/bin/sh

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

```

---

<div class="post-metadata">

### Author: ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)
#### Post date: [June 7, 2023, 8:18pm UTC](https://hub.mender.io/t/in-readonly-a-b-update-debian-package-info-will-overwrite/5867/3 "2023-06-07T20:18:09Z")

</div>

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.

Greetz,  
Josef

---

<div class="post-metadata">

### Author: ![chezgi](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/chezgi/32/1887_2.png) [@chezgi](https://hub.mender.io/u/chezgi)
#### Post date: [June 8, 2023, 5:17am UTC](https://hub.mender.io/t/in-readonly-a-b-update-debian-package-info-will-overwrite/5867/4 "2023-06-08T05:17:32Z")

</div>

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,…]
