Message ID | 20230830123912.2052665-1-pidge@baylibre.com |
---|---|
State | New |
Headers | show |
Series | update_mandb: Point to correct /etc/passwd with man | expand |
On Wed, 2023-08-30 at 12:39 +0000, Eilís 'pidge' Ní Fhlannagáin wrote: > [YOCTO #15023] > > In this instance (do_populate_sdk with api-documentation turned on), > pseudo is going to end up finding the passwd/groups files in > recipe-sysroot-native which is incorrect and does not have man. The > solution here should be to ensure that pseudo points to the passwd/groups > files in recipe-sysroot (which does have man:man). > > Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com> > --- > scripts/postinst-intercepts/update_mandb | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/postinst-intercepts/update_mandb b/scripts/postinst-intercepts/update_mandb > index a061bb426a6..6bc073bfff5 100644 > --- a/scripts/postinst-intercepts/update_mandb > +++ b/scripts/postinst-intercepts/update_mandb > @@ -13,4 +13,4 @@ PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${bindir}/mandb --config-file $C > > rm -f $CONFIG > > -chown -R man:man $D${localstatedir}/cache/man/ > +PSEUDO_PASSWD=$D chown -R man:man $D${localstatedir}/cache/man/ Is there a more general problem here? Wouldn't this issue apply to other postinst scripts too? Cheers, Richard
On 30/08/2023 14:19, Richard Purdie wrote: > On Wed, 2023-08-30 at 12:39 +0000, Eilís 'pidge' Ní Fhlannagáin wrote: >> [YOCTO #15023] >> >> In this instance (do_populate_sdk with api-documentation turned on), >> pseudo is going to end up finding the passwd/groups files in >> recipe-sysroot-native which is incorrect and does not have man. The >> solution here should be to ensure that pseudo points to the passwd/groups >> files in recipe-sysroot (which does have man:man). >> >> Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com> >> --- >> scripts/postinst-intercepts/update_mandb | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/scripts/postinst-intercepts/update_mandb b/scripts/postinst-intercepts/update_mandb >> index a061bb426a6..6bc073bfff5 100644 >> --- a/scripts/postinst-intercepts/update_mandb >> +++ b/scripts/postinst-intercepts/update_mandb >> @@ -13,4 +13,4 @@ PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${bindir}/mandb --config-file $C >> >> rm -f $CONFIG >> >> -chown -R man:man $D${localstatedir}/cache/man/ >> +PSEUDO_PASSWD=$D chown -R man:man $D${localstatedir}/cache/man/ > > Is there a more general problem here? Wouldn't this issue apply to > other postinst scripts too? Yes and No. The other postinst scripts if they do attempt to chown, are trying to do it for root:root (which recipe-native-sysroot's passwd and groups obviously have). We could add this to the others as well, just to maintain consistency. This is all because in image.bbclass, we're setting PSEUDO_PASSWD to STAGING_DIR_NATIVE which I believe normally should be correct, except in an instance like this. -e > > Cheers, > > Richard
On Wed, 2023-08-30 at 15:04 +0100, Eilís 'pidge' Ní Fhlannagáin wrote: > On 30/08/2023 14:19, Richard Purdie wrote: > > On Wed, 2023-08-30 at 12:39 +0000, Eilís 'pidge' Ní Fhlannagáin wrote: > > > [YOCTO #15023] > > > > > > In this instance (do_populate_sdk with api-documentation turned on), > > > pseudo is going to end up finding the passwd/groups files in > > > recipe-sysroot-native which is incorrect and does not have man. The > > > solution here should be to ensure that pseudo points to the passwd/groups > > > files in recipe-sysroot (which does have man:man). > > > > > > Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com> > > > --- > > > scripts/postinst-intercepts/update_mandb | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/scripts/postinst-intercepts/update_mandb b/scripts/postinst-intercepts/update_mandb > > > index a061bb426a6..6bc073bfff5 100644 > > > --- a/scripts/postinst-intercepts/update_mandb > > > +++ b/scripts/postinst-intercepts/update_mandb > > > @@ -13,4 +13,4 @@ PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${bindir}/mandb --config-file $C > > > > > > rm -f $CONFIG > > > > > > -chown -R man:man $D${localstatedir}/cache/man/ > > > +PSEUDO_PASSWD=$D chown -R man:man $D${localstatedir}/cache/man/ > > > > Is there a more general problem here? Wouldn't this issue apply to > > other postinst scripts too? > > Yes and No. The other postinst scripts if they do attempt to chown, are > trying to do it for root:root (which recipe-native-sysroot's passwd and > groups obviously have). We could add this to the others as well, just to > maintain consistency. > > This is all because in image.bbclass, we're setting PSEUDO_PASSWD to > STAGING_DIR_NATIVE which I believe normally should be correct, except in > an instance like this. image.bbclass sets it to: meta/classes-recipe/image.bbclass:PSEUDO_PASSWD = "${IMAGE_ROOTFS}:${STAGING_DIR_NATIVE}" so it should look at IMAGE_ROOTFS first, which I think is the same as $D here? Something isn't quite adding up... Cheers, Richard
On 30/08/2023 15:08, Richard Purdie wrote: > On Wed, 2023-08-30 at 15:04 +0100, Eilís 'pidge' Ní Fhlannagáin wrote: >> On 30/08/2023 14:19, Richard Purdie wrote: >>> On Wed, 2023-08-30 at 12:39 +0000, Eilís 'pidge' Ní Fhlannagáin wrote: >>>> [YOCTO #15023] >>>> >>>> In this instance (do_populate_sdk with api-documentation turned on), >>>> pseudo is going to end up finding the passwd/groups files in >>>> recipe-sysroot-native which is incorrect and does not have man. The >>>> solution here should be to ensure that pseudo points to the passwd/groups >>>> files in recipe-sysroot (which does have man:man). >>>> >>>> Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com> >>>> --- >>>> scripts/postinst-intercepts/update_mandb | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/scripts/postinst-intercepts/update_mandb b/scripts/postinst-intercepts/update_mandb >>>> index a061bb426a6..6bc073bfff5 100644 >>>> --- a/scripts/postinst-intercepts/update_mandb >>>> +++ b/scripts/postinst-intercepts/update_mandb >>>> @@ -13,4 +13,4 @@ PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${bindir}/mandb --config-file $C >>>> >>>> rm -f $CONFIG >>>> >>>> -chown -R man:man $D${localstatedir}/cache/man/ >>>> +PSEUDO_PASSWD=$D chown -R man:man $D${localstatedir}/cache/man/ >>> >>> Is there a more general problem here? Wouldn't this issue apply to >>> other postinst scripts too? >> >> Yes and No. The other postinst scripts if they do attempt to chown, are >> trying to do it for root:root (which recipe-native-sysroot's passwd and >> groups obviously have). We could add this to the others as well, just to >> maintain consistency. >> >> This is all because in image.bbclass, we're setting PSEUDO_PASSWD to >> STAGING_DIR_NATIVE which I believe normally should be correct, except in >> an instance like this. > > image.bbclass sets it to: > > meta/classes-recipe/image.bbclass:PSEUDO_PASSWD = "${IMAGE_ROOTFS}:${STAGING_DIR_NATIVE}" > > so it should look at IMAGE_ROOTFS first, which I think is the same as > $D here? > > Something isn't quite adding up... In this case, IMAGE_ROOTFS and D are not the same, either at the start of do_populate_sdk or when the postinst script runs: bitbake -e yields: IMAGE_ROOTFS="/home/pidge/poky/build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0/rootfs" Passing IMAGE_ROOTFS into the update-mandb postinst scripts yields this: D="/home/pidge/poky/build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0/sdk/image/usr/local/oe-sdk-hardcoded-buildpath/sysroots/core2-64-poky-linux" IMAGE_ROOTFS="/home/pidge/poky/build/tmp/work/core2-64-poky-linux/eudev/3.2.12/rootfs" Even if we were relying on an IMAGE_ROOTFS that pointed to what we expected, it is probably the wrong option here because there is no assurance it's populated with a passwd file when we run bitbake core-image-base -f -c do_populate_sdk. I've checked on my setup and have verified that it doesn't contain anything at that stage. In my patch $D is actually set to ${SDK_OUTPUT}/${SDKPATHNATIVE} (not recipe-sysroot, I'll correct this in the log) which incidentally is also the same place we're running mandb from. Cheers, -e > > Cheers, > > Richard
On Wed, 2023-08-30 at 18:07 +0100, Eilís 'pidge' Ní Fhlannagáin wrote: > On 30/08/2023 15:08, Richard Purdie wrote: > > On Wed, 2023-08-30 at 15:04 +0100, Eilís 'pidge' Ní Fhlannagáin wrote: > > > On 30/08/2023 14:19, Richard Purdie wrote: > > > > On Wed, 2023-08-30 at 12:39 +0000, Eilís 'pidge' Ní Fhlannagáin wrote: > > > > > [YOCTO #15023] > > > > > > > > > > In this instance (do_populate_sdk with api-documentation turned on), > > > > > pseudo is going to end up finding the passwd/groups files in > > > > > recipe-sysroot-native which is incorrect and does not have man. The > > > > > solution here should be to ensure that pseudo points to the passwd/groups > > > > > files in recipe-sysroot (which does have man:man). > > > > > > > > > > Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com> > > > > > --- > > > > > scripts/postinst-intercepts/update_mandb | 2 +- > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > diff --git a/scripts/postinst-intercepts/update_mandb b/scripts/postinst-intercepts/update_mandb > > > > > index a061bb426a6..6bc073bfff5 100644 > > > > > --- a/scripts/postinst-intercepts/update_mandb > > > > > +++ b/scripts/postinst-intercepts/update_mandb > > > > > @@ -13,4 +13,4 @@ PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${bindir}/mandb --config-file $C > > > > > > > > > > rm -f $CONFIG > > > > > > > > > > -chown -R man:man $D${localstatedir}/cache/man/ > > > > > +PSEUDO_PASSWD=$D chown -R man:man $D${localstatedir}/cache/man/ > > > > > > > > Is there a more general problem here? Wouldn't this issue apply to > > > > other postinst scripts too? > > > > > > Yes and No. The other postinst scripts if they do attempt to chown, are > > > trying to do it for root:root (which recipe-native-sysroot's passwd and > > > groups obviously have). We could add this to the others as well, just to > > > maintain consistency. > > > > > > This is all because in image.bbclass, we're setting PSEUDO_PASSWD to > > > STAGING_DIR_NATIVE which I believe normally should be correct, except in > > > an instance like this. > > > > image.bbclass sets it to: > > > > meta/classes-recipe/image.bbclass:PSEUDO_PASSWD = "${IMAGE_ROOTFS}:${STAGING_DIR_NATIVE}" > > > > so it should look at IMAGE_ROOTFS first, which I think is the same as > > $D here? > > > > Something isn't quite adding up... > > In this case, IMAGE_ROOTFS and D are not the same, either at the start > of do_populate_sdk or when the postinst script runs: > > bitbake -e yields: > > IMAGE_ROOTFS="/home/pidge/poky/build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0/rootfs" > > Passing IMAGE_ROOTFS into the update-mandb postinst scripts yields this: > > D="/home/pidge/poky/build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0/sdk/image/usr/local/oe-sdk-hardcoded-buildpath/sysroots/core2-64-poky-linux" > IMAGE_ROOTFS="/home/pidge/poky/build/tmp/work/core2-64-poky-linux/eudev/3.2.12/rootfs" > > Even if we were relying on an IMAGE_ROOTFS that pointed to what we > expected, it is probably the wrong option here because there is no > assurance it's populated with a passwd file when we run bitbake > core-image-base -f -c do_populate_sdk. I've checked on my setup and have > verified that it doesn't contain anything at that stage. > > In my patch $D is actually set to ${SDK_OUTPUT}/${SDKPATHNATIVE} (not > recipe-sysroot, I'll correct this in the log) which incidentally is also > the same place we're running mandb from. This might hint at the real issue :) If this is during do_populate_sdk, it is worth noting that the SDK doesn't have file ownership, either for the nativesdk components or the target ones. This therefore shouldn't be running in that context at all! Cheers, Richard
On Wed, 2023-08-30 at 21:08 +0100, Richard Purdie via lists.openembedded.org wrote: > On Wed, 2023-08-30 at 18:07 +0100, Eilís 'pidge' Ní Fhlannagáin wrote: > > On 30/08/2023 15:08, Richard Purdie wrote: > > > On Wed, 2023-08-30 at 15:04 +0100, Eilís 'pidge' Ní Fhlannagáin wrote: > > > > On 30/08/2023 14:19, Richard Purdie wrote: > > > > > On Wed, 2023-08-30 at 12:39 +0000, Eilís 'pidge' Ní Fhlannagáin wrote: > > > > > > [YOCTO #15023] > > > > > > > > > > > > In this instance (do_populate_sdk with api-documentation turned on), > > > > > > pseudo is going to end up finding the passwd/groups files in > > > > > > recipe-sysroot-native which is incorrect and does not have man. The > > > > > > solution here should be to ensure that pseudo points to the passwd/groups > > > > > > files in recipe-sysroot (which does have man:man). > > > > > > > > > > > > Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com> > > > > > > --- > > > > > > scripts/postinst-intercepts/update_mandb | 2 +- > > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > > > diff --git a/scripts/postinst-intercepts/update_mandb b/scripts/postinst-intercepts/update_mandb > > > > > > index a061bb426a6..6bc073bfff5 100644 > > > > > > --- a/scripts/postinst-intercepts/update_mandb > > > > > > +++ b/scripts/postinst-intercepts/update_mandb > > > > > > @@ -13,4 +13,4 @@ PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${bindir}/mandb --config-file $C > > > > > > > > > > > > rm -f $CONFIG > > > > > > > > > > > > -chown -R man:man $D${localstatedir}/cache/man/ > > > > > > +PSEUDO_PASSWD=$D chown -R man:man $D${localstatedir}/cache/man/ > > > > > > > > > > Is there a more general problem here? Wouldn't this issue apply to > > > > > other postinst scripts too? > > > > > > > > Yes and No. The other postinst scripts if they do attempt to chown, are > > > > trying to do it for root:root (which recipe-native-sysroot's passwd and > > > > groups obviously have). We could add this to the others as well, just to > > > > maintain consistency. > > > > > > > > This is all because in image.bbclass, we're setting PSEUDO_PASSWD to > > > > STAGING_DIR_NATIVE which I believe normally should be correct, except in > > > > an instance like this. > > > > > > image.bbclass sets it to: > > > > > > meta/classes-recipe/image.bbclass:PSEUDO_PASSWD = "${IMAGE_ROOTFS}:${STAGING_DIR_NATIVE}" > > > > > > so it should look at IMAGE_ROOTFS first, which I think is the same as > > > $D here? > > > > > > Something isn't quite adding up... > > > > In this case, IMAGE_ROOTFS and D are not the same, either at the start > > of do_populate_sdk or when the postinst script runs: > > > > bitbake -e yields: > > > > IMAGE_ROOTFS="/home/pidge/poky/build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0/rootfs" > > > > Passing IMAGE_ROOTFS into the update-mandb postinst scripts yields this: > > > > D="/home/pidge/poky/build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0/sdk/image/usr/local/oe-sdk-hardcoded-buildpath/sysroots/core2-64-poky-linux" > > IMAGE_ROOTFS="/home/pidge/poky/build/tmp/work/core2-64-poky-linux/eudev/3.2.12/rootfs" > > > > Even if we were relying on an IMAGE_ROOTFS that pointed to what we > > expected, it is probably the wrong option here because there is no > > assurance it's populated with a passwd file when we run bitbake > > core-image-base -f -c do_populate_sdk. I've checked on my setup and have > > verified that it doesn't contain anything at that stage. > > > > In my patch $D is actually set to ${SDK_OUTPUT}/${SDKPATHNATIVE} (not > > recipe-sysroot, I'll correct this in the log) which incidentally is also > > the same place we're running mandb from. > > This might hint at the real issue :) > > If this is during do_populate_sdk, it is worth noting that the SDK > doesn't have file ownership, either for the nativesdk components or the > target ones. This therefore shouldn't be running in that context at > all! Have a look at https://git.yoctoproject.org/poky/tree/scripts/nativesdk-intercept/chown The real question is why that doesn't change man:man (or whatever) to root:root... Cheers, Richard
On 30/08/2023 21:10, Richard Purdie wrote: > On Wed, 2023-08-30 at 21:08 +0100, Richard Purdie via > lists.openembedded.org wrote: >> On Wed, 2023-08-30 at 18:07 +0100, Eilís 'pidge' Ní Fhlannagáin wrote: >>> On 30/08/2023 15:08, Richard Purdie wrote: >>>> On Wed, 2023-08-30 at 15:04 +0100, Eilís 'pidge' Ní Fhlannagáin wrote: >>>>> On 30/08/2023 14:19, Richard Purdie wrote: >>>>>> On Wed, 2023-08-30 at 12:39 +0000, Eilís 'pidge' Ní Fhlannagáin wrote: >>>>>>> [YOCTO #15023] >>>>>>> >>>>>>> In this instance (do_populate_sdk with api-documentation turned on), >>>>>>> pseudo is going to end up finding the passwd/groups files in >>>>>>> recipe-sysroot-native which is incorrect and does not have man. The >>>>>>> solution here should be to ensure that pseudo points to the passwd/groups >>>>>>> files in recipe-sysroot (which does have man:man). >>>>>>> >>>>>>> Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com> >>>>>>> --- >>>>>>> scripts/postinst-intercepts/update_mandb | 2 +- >>>>>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>>>>> >>>>>>> diff --git a/scripts/postinst-intercepts/update_mandb b/scripts/postinst-intercepts/update_mandb >>>>>>> index a061bb426a6..6bc073bfff5 100644 >>>>>>> --- a/scripts/postinst-intercepts/update_mandb >>>>>>> +++ b/scripts/postinst-intercepts/update_mandb >>>>>>> @@ -13,4 +13,4 @@ PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${bindir}/mandb --config-file $C >>>>>>> >>>>>>> rm -f $CONFIG >>>>>>> >>>>>>> -chown -R man:man $D${localstatedir}/cache/man/ >>>>>>> +PSEUDO_PASSWD=$D chown -R man:man $D${localstatedir}/cache/man/ >>>>>> >>>>>> Is there a more general problem here? Wouldn't this issue apply to >>>>>> other postinst scripts too? >>>>> >>>>> Yes and No. The other postinst scripts if they do attempt to chown, are >>>>> trying to do it for root:root (which recipe-native-sysroot's passwd and >>>>> groups obviously have). We could add this to the others as well, just to >>>>> maintain consistency. >>>>> >>>>> This is all because in image.bbclass, we're setting PSEUDO_PASSWD to >>>>> STAGING_DIR_NATIVE which I believe normally should be correct, except in >>>>> an instance like this. >>>> >>>> image.bbclass sets it to: >>>> >>>> meta/classes-recipe/image.bbclass:PSEUDO_PASSWD = "${IMAGE_ROOTFS}:${STAGING_DIR_NATIVE}" >>>> >>>> so it should look at IMAGE_ROOTFS first, which I think is the same as >>>> $D here? >>>> >>>> Something isn't quite adding up... >>> >>> In this case, IMAGE_ROOTFS and D are not the same, either at the start >>> of do_populate_sdk or when the postinst script runs: >>> >>> bitbake -e yields: >>> >>> IMAGE_ROOTFS="/home/pidge/poky/build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0/rootfs" >>> >>> Passing IMAGE_ROOTFS into the update-mandb postinst scripts yields this: >>> >>> D="/home/pidge/poky/build/tmp/work/qemux86_64-poky-linux/core-image-base/1.0/sdk/image/usr/local/oe-sdk-hardcoded-buildpath/sysroots/core2-64-poky-linux" >>> IMAGE_ROOTFS="/home/pidge/poky/build/tmp/work/core2-64-poky-linux/eudev/3.2.12/rootfs" >>> >>> Even if we were relying on an IMAGE_ROOTFS that pointed to what we >>> expected, it is probably the wrong option here because there is no >>> assurance it's populated with a passwd file when we run bitbake >>> core-image-base -f -c do_populate_sdk. I've checked on my setup and have >>> verified that it doesn't contain anything at that stage. >>> >>> In my patch $D is actually set to ${SDK_OUTPUT}/${SDKPATHNATIVE} (not >>> recipe-sysroot, I'll correct this in the log) which incidentally is also >>> the same place we're running mandb from. >> >> This might hint at the real issue :) >> >> If this is during do_populate_sdk, it is worth noting that the SDK >> doesn't have file ownership, either for the nativesdk components or the >> target ones. This therefore shouldn't be running in that context at >> all! > > Have a look at > > https://git.yoctoproject.org/poky/tree/scripts/nativesdk-intercept/chown > > The real question is why that doesn't change man:man (or whatever) to > root:root... There's a few issues going on. The chown intercept isn't in PATH and the intercept seems a bit fragile (it's flaking out for some reason, my guess is it's just parsing the chown args incorrectly). I've a patch I'm working on to fix this, so yes, ignore this patch. It "fixes" it, but you're right, the issue is deeper. > > Cheers, > > Richard >
diff --git a/scripts/postinst-intercepts/update_mandb b/scripts/postinst-intercepts/update_mandb index a061bb426a6..6bc073bfff5 100644 --- a/scripts/postinst-intercepts/update_mandb +++ b/scripts/postinst-intercepts/update_mandb @@ -13,4 +13,4 @@ PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${bindir}/mandb --config-file $C rm -f $CONFIG -chown -R man:man $D${localstatedir}/cache/man/ +PSEUDO_PASSWD=$D chown -R man:man $D${localstatedir}/cache/man/
[YOCTO #15023] In this instance (do_populate_sdk with api-documentation turned on), pseudo is going to end up finding the passwd/groups files in recipe-sysroot-native which is incorrect and does not have man. The solution here should be to ensure that pseudo points to the passwd/groups files in recipe-sysroot (which does have man:man). Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com> --- scripts/postinst-intercepts/update_mandb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)