Bug 15296 - Postinstall scriptlets of ['busybox'] have failed when trying to install apache2
Summary: Postinstall scriptlets of ['busybox'] have failed when trying to install apache2
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: unspecified
Hardware: Other arm64
: Medium normal
Target Milestone: 5.0
Assignee: Flaviu Nistor
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2023-11-23 14:13 UTC by Flaviu Nistor
Modified: 2023-11-27 11:11 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Flaviu Nistor 2023-11-23 14:13:03 UTC
Hello,

I am Yocto (kirkstone) and I added apache2 in the list of recipes I want to install:
IMAGE_INSTALL:append = " apache2"

The recipe works, but I get an error when do_rootfs is executed for my image.

do_rootfs: Postinstall scriptlets of ['busybox'] have failed. If the intention is to defer them to first boot, then please place them into pkg_postinst_ontarget:${PN} (). Deferring to first boot via 'exit 1' is no longer supported.

In the details error, I can see:
update-alternatives: Error: not linking ....../rootfs/usr/sbin/httpd to /bin/busybox.nosuid since ...../rootfs/usr/sbin/httpd exists and is not a link.

I think the error is coming from the fact that apache2 recipe is creating httpd under /usr/sbin/ when doing the install.
When busybox recipe is executed by bitbake it tries to create the httpd link under the same location, but since the file is already there it fails.

Best Regards,
Flaviu
Comment 1 Randy MacLeod 2023-11-23 15:54:59 UTC
Have you enable httpd in busybox?
If so don't do that or send a patch to add httpd alternative entries, please.
Comment 2 Ross Burton 2023-11-23 16:33:39 UTC
Right, you must have also turned on httpd in busybox.  Your choices are to either also add the alternative when you do that for both apache and busybox, or don't turn on httpd in busybox.

Personally I'd recommend not using the httpd in busybox.
Comment 3 Flaviu Nistor 2023-11-24 07:27:18 UTC
Hello,

thanks both of you for the quick answer and suggestions.

"Have you enable httpd in busybox?"
"Personally I'd recommend not using the httpd in busybox."

The busybox is getting installed by some package manager, so the *.bb for busybox gets executed as it is. I even tried to remove it by using:
IMAGE_INSTALL:remove = " busybox", but still gets baked (maybe there is a dependency somewhere).

I would also prefer the solution to disable the http for busybox. Do you have a quick suggestion how to do this (I will create a *.bbapand)?

Just as a clarification (and a correct starting point), setting the alternatives means using?:
ALTERNATIVE_PRIORITY[]
ALTERNATIVE_${PN}
Comment 4 Ross Burton 2023-11-24 11:37:25 UTC
httpd isn't enabled in the oe-core busybox by default, so this is something one of your layers is doing.

Ideally, find the layer that is doing that and understand why.  A bbappend can override this by adding a .cfg file to SRC_URI which just contains "# CONFIG_HTTPD is not set".

If you look at meta/recipes-core/busybox/busybox/defconfig in your poky/oe-core tree, you'll see that's the default, which is why we said that this is something your environment is doing.
Comment 5 Flaviu Nistor 2023-11-27 10:30:33 UTC
Thanks a lot for the hint.
As suspected by you, indeed httpd for busybox was enabled in a different layer.
I had another misleading problem (my problem) since I thought that:
# CONFIG_HTTPD is not set 
means that this is a comment and will not be taken into consideration (my fault).

Problem is now solved.
Again, many thanks for your help!
Comment 6 Ross Burton 2023-11-27 11:11:03 UTC
You're not the first person to think that:

# CONFIG_HTTPD is not set 

is a comment and not an explicit 'unset' instruction!  Whoever made this design choice in the kernel (which has been copied into busybox and uboot) needs to fix it...

Closing as this is now resolved.