Skip to contentSkip to conversation

Fakeroot fails with externalsrc

DISCUSSION Kjeld Flarup 2 participants 3 messages Mar 7, 2025 – Mar 10, 2025

lore
Share & tools
lore
#0 lore raw

Hi

I'm trying to make a CI/CD Yocto build in a git repository which is used in a recipe.

I have made an include file  meta-codesys/recipes-codesys/codesys-src.inc which normally contains.

Quoted 6 lines

SRC_URI = "gitsm://gitlab.deif.com/codesys/codesys-runtimes.git;protocol=https;branch=master"

SRCREV = "927fe8fa0b9e6537b3d7ec9f2231e13c4b367a61"

When building in the codesys-runtimes repository I clone the Yocto project and replaces codesys-src.inc with

Quoted 5 lines

inherit externalsrc
EXTERNALSRC = "/userdata/codesys-runtimes" EXTERNALSRC_BUILD = "/userdata/codesys-runtimes/build"

And then I run bitbake where I get this error

Quoted 11 lines

*** 0418:            os.lchown(path, uid, gid)
0419:
0420:    # Return a list of configuration files based on either the
default
0421:    # files/fs-perms.txt or the contents of FILESYSTEM_PERMS_TABLES
0422:    # paths are resolved via BBPATH
Exception: PermissionError: [Errno 1] Operation not permitted:
'/userdata/codesys-runtimes/yocto/tmp-glibc/work/cortexa53-crypto-oe-linux/codesys-runtime/1.0-r0/package/usr'

Quoted 7 lines

ERROR: Logfile of failure stored in:
/userdata/codesys-runtimes/yocto/tmp-glibc/work/cortexa53-crypto-oe-linux/codesys-runtime/1.0-r0/temp/log.do_package.59961

ERROR: Task (/userdata/codesys-runtimes/yocto/meta-codesys/recipes-codesys/codesys-runtime/codesys-runtime.bb:do_package) failed with exit code '1'

The problem is that do_package tries to set uid to root, but that is not allowed, unless fakeroot is used. Why does this fail when externalsrc is used?

Just for the record, if I do not change codesys-src.inc it builds.

--
--
Regards
Kjeld Flarup
DEIF A/S

#1 lore raw

Pseudo ignores the source- and build-dirs[1] (and everything that's inside them), via the PSEUDO_IGNORE_PATHS variable.
E.g. When you set "/userdata/codesys-runtimes" as EXTERNALSRC, that becomes ${S} - every path that starts with this prefix will be outside of fakeroot.
You need to change this folder structure in a way that the EXTERNALSRC path doesn't clash with your Yocto build-dir - build-dir can contain the source-dir, but the source-dir shouldn't contain the build-dir.

[1]: https://git.yoctoproject.org/poky/tree/meta/conf/bitbake.conf#n754

Quoted 59 lines · Kjeld Flarup via lists.yoctoproject.org

Hi

I'm trying to make a CI/CD Yocto build in a git repository which is used in a recipe.

I have made an include file meta-codesys/recipes-codesys/codesys-src.inc which normally contains.

    SRC_URI =
    "gitsm://gitlab.deif.com/codesys/codesys-runtimes.git;protocol=https;branch=master"
    SRCREV = "927fe8fa0b9e6537b3d7ec9f2231e13c4b367a61"


When building in the codesys-runtimes repository I clone the Yocto project and replaces codesys-src.inc with

inherit externalsrc
EXTERNALSRC = "/userdata/codesys-runtimes" EXTERNALSRC_BUILD = "/userdata/codesys-runtimes/build"

And then I run bitbake where I get this error

 *** 0418:            os.lchown(path, uid, gid)
     0419:
     0420:    # Return a list of configuration files based on
either the default
     0421:    # files/fs-perms.txt or the contents of
FILESYSTEM_PERMS_TABLES
     0422:    # paths are resolved via BBPATH
Exception: PermissionError: [Errno 1] Operation not permitted:
'/userdata/codesys-runtimes/yocto/tmp-glibc/work/cortexa53-crypto-oe-linux/codesys-runtime/1.0-r0/package/usr'

ERROR: Logfile of failure stored in:
/userdata/codesys-runtimes/yocto/tmp-glibc/work/cortexa53-crypto-oe-linux/codesys-runtime/1.0-r0/temp/log.do_package.59961
ERROR: Task (/userdata/codesys-runtimes/yocto/meta-codesys/recipes-codesys/codesys-runtime/codesys-runtime.bb:do_package) failed with exit code '1'


The problem is that do_package tries to set uid to root, but that is not allowed, unless fakeroot is used.
Why does this fail when externalsrc is used?

Just for the record, if I do not change codesys-src.inc it builds.
--
--
Regards
Kjeld Flarup
DEIF A/S

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#64930): https://lists.yoctoproject.org/g/yocto/message/64930
Mute This Topic: https://lists.yoctoproject.org/mt/111574850/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

Thanks, that makes sense.

I kept yocto under my project, because I wanted to take advantage of the Gitlab CI cache. But I solved the problem instead by setting a TMPDIR.

Best regards

Kjeld Flarup Christensen

Software Designer
BSP Software
DEIF A/S

Email:   [email protected]<mailto:[email protected]> <mailto:[email protected]>
Tel.:    +45 9614 3568<tel:+45%209614%203568> <tel:+45%209614%203568>
Mobile:  +45 4029 4149<tel:+45%204029%204149> <tel:+45%204029%204149>

[cid:30596ddb-7b04-4c9d-8818-8935c283e09a]

deif.com<https://deif.com/> <https://deif.com/>

[cid:2ab65bea-e110-4ebf-9280-913f7623dd02]<https://www.linkedin.com/company/21145/?utm_medium=email&utm_source=link-to-emailsignature&utm_campaign=signature-only> [cid:bfdc7927-4f6c-464f-b49b-7ef90e2a8b8e] <https://www.youtube.com/@deifgroup?utm_medium=email&utm_source=link-to-emailsignature&utm_campaign=signature-only> Follow us on LinkedIn and Youtube
________________________________
From: Gyorgy Sarvari <[email protected]>
Sent: Saturday, March 8, 2025 20:19
To: [email protected] <[email protected]>; Kjeld Flarup Christensen <[email protected]>
Subject: Re: [yocto] Fakeroot fails with externalsrc

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

Pseudo ignores the source- and build-dirs[1] (and everything that's inside them), via the PSEUDO_IGNORE_PATHS variable.
E.g. When you set "/userdata/codesys-runtimes" as EXTERNALSRC, that becomes ${S} - every path that starts with this prefix will be outside of fakeroot.
You need to change this folder structure in a way that the EXTERNALSRC path doesn't clash with your Yocto build-dir - build-dir can contain the source-dir, but the source-dir shouldn't contain the build-dir.

[1]: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.yoctoproject.org%2Fpoky%2Ftree%2Fmeta%2Fconf%2Fbitbake.conf%23n754&data=05%7C02%7Ckfa%40deif.com%7C289daeeec4e44581f46008dd5e7621c3%7C3c7af82f7d06424482294b118df8fed0%7C0%7C0%7C638770583664666272%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=yI1xENWadC3e68SBSXfJ4u%2B6mR%2B7uJ5MfbEzwC4BRIg%3D&reserved=0<https://git.yoctoproject.org/poky/tree/meta/conf/bitbake.conf#n754>

Quoted 59 lines · Kjeld Flarup via lists.yoctoproject.org

Hi

I'm trying to make a CI/CD Yocto build in a git repository which is used in a recipe.

I have made an include file
meta-codesys/recipes-codesys/codesys-src.inc which normally contains.

    SRC_URI =
    "gitsm://gitlab.deif.com/codesys/codesys-runtimes.git;protocol=https;branch=master"
    SRCREV = "927fe8fa0b9e6537b3d7ec9f2231e13c4b367a61"

When building in the codesys-runtimes repository I clone the Yocto project and replaces codesys-src.inc with

inherit externalsrc
EXTERNALSRC = "/userdata/codesys-runtimes" EXTERNALSRC_BUILD = "/userdata/codesys-runtimes/build"

And then I run bitbake where I get this error

*** 0418: os.lchown(path, uid, gid)
0419:
0420: # Return a list of configuration files based on
either the default
0421: # files/fs-perms.txt or the contents of
FILESYSTEM_PERMS_TABLES
0422: # paths are resolved via BBPATH
Exception: PermissionError: [Errno 1] Operation not permitted:
'/userdata/codesys-runtimes/yocto/tmp-glibc/work/cortexa53-crypto-oe-linux/codesys-runtime/1.0-r0/package/usr'

ERROR: Logfile of failure stored in:
/userdata/codesys-runtimes/yocto/tmp-glibc/work/cortexa53-crypto-oe-linux/codesys-runtime/1.0-r0/temp/log.do_package.59961
ERROR: Task (/userdata/codesys-runtimes/yocto/meta-codesys/recipes-codesys/codesys-runtime/codesys-runtime.bb:do_package) failed with exit code '1'

The problem is that do_package tries to set uid to root, but that is not allowed, unless fakeroot is used.
Why does this fail when externalsrc is used?

Just for the record, if I do not change codesys-src.inc it builds.

--
--
Regards
Kjeld Flarup
DEIF A/S

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#64930): https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.yoctoproject.org%2Fg%2Fyocto%2Fmessage%2F64930&data=05%7C02%7Ckfa%40deif.com%7C289daeeec4e44581f46008dd5e7621c3%7C3c7af82f7d06424482294b118df8fed0%7C0%7C0%7C638770583664685055%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=ccrbxj5hChHWJNaRG7%2BQADSYCyp%2BAeFSxDBGQYOT0Qs%3D&reserved=0<https://lists.yoctoproject.org/g/yocto/message/64930>
Mute This Topic: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.yoctoproject.org%2Fmt%2F111574850%2F6084445&data=05%7C02%7Ckfa%40deif.com%7C289daeeec4e44581f46008dd5e7621c3%7C3c7af82f7d06424482294b118df8fed0%7C0%7C0%7C638770583664697650%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=hEjj4usNfeI7HIhPLWP2lsMV1gr4iNr5iXDWS0nPMww%3D&reserved=0<https://lists.yoctoproject.org/mt/111574850/6084445>
Group Owner: [email protected]
Unsubscribe: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.yoctoproject.org%2Fg%2Fyocto%2Funsub&data=05%7C02%7Ckfa%40deif.com%7C289daeeec4e44581f46008dd5e7621c3%7C3c7af82f7d06424482294b118df8fed0%7C0%7C0%7C638770583664709585%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=NdnG1z6tl28gEiQW9igeh0%2BWn7dvKCBa0%2FqwOxtAhlo%3D&reserved=0<https://lists.yoctoproject.org/g/yocto/unsub> [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-