Re: error when try to use sudo command in recipe


 

Hi Khem,

Thanks for the reply, though I am not sure I fully understand the first part of your answer. I'm trying to do something similar to the thread creator, i.e running "podman pull" at build time to populate an image store that I can later install into the target rootfs.

Still, I am failing to understand why /usr/bin/sudo doesn't show up as owned by the root user, even when running under pseudo. Also, why has this changed between Dunfell and master and where exactly has the changed happened..

Best regards,
--Adrian


From: Khem Raj <raj.khem@...>
Sent: Monday, April 3, 2023 4:57 PM
To: Adrian Dudau <adrian.dudau@...>
Cc: yocto@... <yocto@...>
Subject: Re: [yocto] error when try to use sudo command in recipe
 
You don't often get email from raj.khem@.... Learn why this is important
CAUTION: External Sender - Be cautious when clicking links or opening attachments. Please email InfoSec@... with any questions.



On Mon, Apr 3, 2023 at 12:25 AM <adrian.dudau@...> wrote:
On Mon, Feb 6, 2023 at 01:13 AM, Richard Purdie wrote:
Hi Richard,

Jumping on this thread to provide some clarifications as I hit the same bug.
I can confirm that this is not an environment issue. I could reproduce it by adding a sudo call in an empty recipe like this:

SUMMARY = ""
HOMEPAGE = ""
LICENSE = ""
SECTION = ""
DEPENDS = ""

SRC_URI = ""

do_install() {
    ls -l /usr/bin/sudo
    sudo ls -l /usr/bin/sudo
}

Build already use a fake root environment using pseudo to intercept the calls so this might not be out of line here. What is the original issue you are running into ?



Running bitbake barebone on my x86 machine produces this error:

| -rwxr-xr-x 1 nobody 65534 232416 Mar  1 13:59 /usr/bin/sudo
| sudo: /etc/sudo.conf is owned by uid 65534, should be 0
| sudo: /etc/sudo.conf is owned by uid 65534, should be 0
| sudo: error in /etc/sudo.conf, line 0 while loading plugin "sudoers_policy"
| sudo: /usr/libexec/sudo/sudoers.so must be owned by uid 0
| sudo: fatal error, unable to load plugins

Indeed it seems that ownership is broken somehow in the bb environment. The issue was introduced somewhere between dunfell and kirkstone. I know it's a large timespan but it's a bit time consuming to narrow it down.

Hoping to get some help on this. I would try to investigate further myself but I have no idea where to start to be honest.

Best regards,
--Adrian



Join yocto@lists.yoctoproject.org to automatically receive all group messages.