Hey Martin,

The opkg config files used during OE rootfs creation and at-runtime are 
different. The former is supposed to be generated by the opkg package_manager 
implementation [1]. The latter is written by the opkg recipe via the do_install 
(that you identified).

The files you're seeing installed to he incorrect location (`/var/lib`) are the 
product of the rootfs installation, I think. So the issue seems to imply an 
issue in config [1].

Both the recipe and package_manager config files are supposed to handle the 
OPKGLIBDIR variable. But they might not be handling them *at the same place* in 
the OE build process.

My intuition is that the weak-default OPKGLIBDIR assignment is being 
immediately-expanded to the upstream value (/var/lib) in the package_manager 
implementation prior to your bbappend's weak-assignment taking effect [2].

Does this issue reproduce if you assign OPKGLIBDIR more strongly? eg.
```
OPKGLIBDIR = "/data-os/opkg"
```

If it does still, try debugging the values of the package_manager's 
`self.opkg_dir` attribute [1].

[1] 
https://git.openembedded.org/openembedded-core/tree/meta/lib/oe/package_manager/ipk/__init__.py#n111

[2] 
https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-metadata.html?highlight=operators#setting-a-weak-default-value

---
Alex Stewart
Software Engineer. PR&D Security, RTOS.
T&M, Emerson Electric Corp. (NI)

________________________________________
From: yocto@lists.yoctoproject.org <yocto@lists.yoctoproject.org> on behalf of 
Martin Siegumfeldt <m...@gomspace.com>
Sent: Monday, September 16, 2024 06:00
To: yocto@lists.yoctoproject.org
Subject: [EXTERNAL] [yocto] read-only-rootfs and opkg

Hi all, I am trying to realize a rootfs backed by opkg as package manager. It 
appears that the opkg meta-data is directed to a volatile mount (triggered by 
read-only-rootfs feature in order to achieve write access I assume): $ tail -5 
/etc/opkg/opkg. conf

Hi all,

I am trying to realize a rootfs backed by opkg as package manager. It appears 
that the opkg meta-data is directed to a volatile mount (triggered by 
read-only-rootfs feature in order to achieve write access I assume):

$ tail -5 /etc/opkg/opkg.conf
# Default destination for installed packages
dest root /
option lists_dir   /var/lib/opkg/lists
option info_dir    /var/lib/opkg/info
option status_file /var/lib/opkg/status

$ mount | grep var/lib
overlay on /var/lib type overlay 
(rw,relatime,lowerdir=/var/lib,upperdir=/var/volatile/lib,workdir=/var/volatile/.lib-work)

$ find /var/lib/opkg/ | head
/var/lib/opkg/
/var/lib/opkg/status
/var/lib/opkg/info
/var/lib/opkg/info/vim-tiny.list
/var/lib/opkg/info/libdaemon0.list
/var/lib/opkg/info/coreutils.prerm
/var/lib/opkg/info/busybox-syslog.control
/var/lib/opkg/info/libc6.postinst
/var/lib/opkg/info/libmount1.list
/var/lib/opkg/info/libpcap1.postinst

Consequently, any updated meta-data do no persist across reboots.

I have attempted to assign 'OPKGLIBDIR' to a R/W mount:

OPKGLIBDIR ?= "/data-os/opkg"

, which does appear to update the conf file:

$ tail -5 /etc/opkg/opkg.conf
# Default destination for installed packages
dest root /
option lists_dir   /data-os/opkg/opkg/lists
option info_dir    /data-os/opkg/opkg/info
option status_file /data-os/opkg/opkg/status
but meta-data still appears to reside with '/var/lib'

but meta-data still appears residing within '/var/lib':

$ find /data-os/opkg/
/data-os/opkg/
/data-os/opkg/opkg
/data-os/opkg/opkg/info

$ find /var/lib/opkg/ | head
/var/lib/opkg/
/var/lib/opkg/status
/var/lib/opkg/info
/var/lib/opkg/info/vim-tiny.list
/var/lib/opkg/info/libdaemon0.list
/var/lib/opkg/info/coreutils.prerm
/var/lib/opkg/info/busybox-syslog.control
/var/lib/opkg/info/libc6.postinst
/var/lib/opkg/info/libmount1.list
/var/lib/opkg/info/libpcap1.postinst

and opkg appears broken (as nothing is indicated installed):

$ opkg list-installed; echo $?
0


To clarify, I imagine a process where the ipk file is uploaded to the device, 
after which the rootfs is remounted R/W and ipk installed/updated through opkg. 
Installation/update do succeed, but the meta-data do not persist as inteded.

Note, I am on baseline Langdale, no obvious changes seem to have been pushed to 
master though.

Am I missing any available configuration to achieve this?
Thanks,
Martin
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#63854): https://lists.yoctoproject.org/g/yocto/message/63854
Mute This Topic: https://lists.yoctoproject.org/mt/108478012/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to