Skip to contentSkip to conversation

Files copied to /usr/local during installation get removed misteriously

DISCUSSION Javier Casas Marín 3 participants 8 messages Nov 10, 2023 – Nov 15, 2023

lore
Share & tools
lore
#0 lore raw

Hi,
I have a recipe that creates some directories in /usr/local and copies there some files using do_install:append

Quoted 11 lines

inherit qmake5
OE_QMAKE_PATH_HEADERS = "${OE_QMAKE_PATH_QT_HEADERS}" DEPENDS += "qtbase qtdeclarative qtmultimedia libgpiod"

RDEPENDS:${PN} += "qtxmlpatterns qtdeclarative-qmlplugins qtbase-plugins ttf-dejavu-sans qtquickcontrols qtquickcontrols2 qtfreevirtualkeyboard libgpiod valgrind

Quoted 14 lines

do_install:append () {
install -d ${D}${bindir}
install -d ${D}/usr/local/test
install -m 0775 qt_test ${D}${bindir}
install -m 0775 ${S}/test.db ${D}/usr/local/test cp -r ${WORKDIR}/Resources ${D}/usr/local/test/resources cp -r ${WORKDIR}/LocalFiles ${D}/usr/local/test/LocalFiles }
FILES:${PN} += "${bindir}/qt_test"
FILES:${PN} += "/opt/*"
FILES:${PN} += "/usr/local/test/*"

When I build the image, I see the folders appear in /usr/local as expected while creating the rootfs but at some point they are removed and, by the time the rootfs creation finishes, they are gone.
If I take the ipk package and install it on the embedded device the folders and files are created correctly so I guess that the recipe is fine but there is some task during the rootfs creation that deletes all the files in /usr/local (my folders are not the only ones that are deleted).

Who could be doing that or how can I debug it to find the culprit?

Kind regards,
Javi

#2 lore raw
In reply to Javier Casas Marín
Quoted 18 lines · Javier Casas Marín

Hi,
I have a recipe that creates some directories in /usr/local and copies there some files using do_install:append

inherit qmake5
OE_QMAKE_PATH_HEADERS = "${OE_QMAKE_PATH_QT_HEADERS}" DEPENDS += "qtbase qtdeclarative qtmultimedia libgpiod"

RDEPENDS:${PN} += "qtxmlpatterns qtdeclarative-qmlplugins qtbase-plugins ttf-dejavu-sans qtquickcontrols qtquickcontrols2 qtfreevirtualkeyboard libgpiod valgrind

do_install:append () {
install -d ${D}${bindir}
install -d ${D}/usr/local/test
install -m 0775 qt_test ${D}${bindir}
install -m 0775 ${S}/test.db ${D}/usr/local/test

    cp -r ${WORKDIR}/Resources ${D}/usr/local/test/resources
    cp -r ${WORKDIR}/LocalFiles ${D}/usr/local/test/LocalFiles
}
Quoted 8 lines

FILES:${PN} += "${bindir}/qt_test"
FILES:${PN} += "/opt/*"
FILES:${PN} += "/usr/local/test/*"

When I build the image, I see the folders appear in /usr/local as expected while creating the rootfs but at some point they are removed and, by the time the rootfs creation finishes, they are gone.
If I take the ipk package and install it on the embedded device the folders and files are created correctly so I guess that the recipe is fine but there is some task during the rootfs creation that deletes all the files in /usr/local (my folders are not the only ones that are deleted).

Who could be doing that or how can I debug it to find the culprit?

There could be a rootfs postprocessing task which could be involked after rootfs generation to do such tweaks. Look for what you have in ROOTFS_POSTPROCESS_COMMAND variable.

Quoted 17 lines

Kind regards,
Javi

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
You automatically follow any topics you start or reply to. View/Reply Online (#61649): https://lists.yoctoproject.org/g/yocto/message/61649
Mute This Topic: https://lists.yoctoproject.org/mt/102502363/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw

Just in case someone has the same problem, it is the do_userfs function the one that deletes /usr/local directories and files after copying them to ${image_userfs}:

cp -r /build/tmp/work/kontron_mx8mm-ked-linux/image-ked-qt/1.0-r0/rootfs${image_userfs_dir}/* ${image_userfs} rm -rf /build/tmp/work/kontron_mx8mm-ked-linux/image-ked-qt/1.0-r0/rootfs${image_userfs_dir}/*

I have changed the installation folder to /opt that seems more appropiate

Thanks

#4 lore raw
Quoted 5 lines · Javier Casas Marín via lists.yoctoproject.org

Just in case someone has the same problem, it is the do_userfs function the one that deletes /usr/local directories and files after copying them to ${image_userfs}:

cp -r /build/tmp/work/kontron_mx8mm-ked-linux/image-ked-qt/1.0-r0/rootfs${image_userfs_dir}/* ${image_userfs} rm -rf /build/tmp/work/kontron_mx8mm-ked-linux/image-ked-qt/1.0-r0/rootfs${image_userfs_dir}/*

Where is do_userfs defined? It’s not part of oe-core…

Ross

#5 lore raw

It is in run.do_userfs. I saw that the files where removed while do_image_userfs task was running so I looked at the image logs in temp directory and found it there

#6 lore raw
Quoted 2 lines · Javier Casas Marín via lists.yoctoproject.org

It is in run.do_userfs. I saw that the files where removed while do_image_userfs task was running so I looked at the image logs in temp directory and found it there

Sure but _where_ does that come from?

This is the generic yocto channel, and this isn’t a standard part of Yocto:

~/Yocto/openembedded-core (master) $ git grep do_userfs ~/Yocto/openembedded-core (master) $

A bit of googling reveals this to be meta-ktn value-add. I suggest you tell them that this class should be documented more obviously so that yuo don’t waste time trying to figure out why your files are disappearing.

Ross

#7 lore raw

you are right, it is defined in layers/meta-ked/classes/userfs.bbclass I didn't consider that it could be something added by a custom layer but it is, as you said. I'll have a loot at it.

Thanks for the clarification

Javi