Bug 15142

Summary: useradd: missing /bin/false with ipk packages
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Louis Rannou <louis.rannou>
Component: coreAssignee: Unassigned <unassigned>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: Medium+ CC: meta.mr.watcher, meta.watcher, randy.macleod, ross.burton, tgamblin
Version: unspecified   
Target Milestone: 4.3 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Louis Rannou 2023-06-09 13:46:57 UTC
When building an image with PACKAGE_CLASSES = "package_ipk", the useradd command can output a warning because "/bin/false" does not exist.

This happens when the init is systemd

```
NOTE: dbus: Performing useradd with [--root /home/louis/projets/blota/builds/build-memfault/tmp/work/beaglebone_yocto-poky-lin
ux-gnueabi/memfault-image/1.0-r0/rootfs --system --home /var/lib/dbus                              --no-create-home --shell /b
in/false                              --user-group messagebus]
[...]
useradd: Warning: missing or non-executable shell '/bin/false'
```

It seems that for ipks, this useradd command is executed before update-alternatives which creates the symlink '/bin/false'

For rpms, update-alternatives is called before.

Is it possible to force the update-alternatives to be executed first ?
Comment 1 Randy MacLeod 2023-06-15 14:40:00 UTC
Thanks Louis. Are you willing and able to submit a patch?

https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded
Comment 2 Louis Rannou 2023-06-15 20:56:22 UTC
Hello, unfortunately, I couldn't find how to maanage the order of those tasks or how to make one depends on the other.
Comment 3 Ross Burton 2023-06-20 15:14:30 UTC
I'm unconvinced that this is a Medium+ as this is just useradd pointing out that the shell for the new user doesn't exist _yet_.

I'm curious how this doesn't happen with rpm, potentially rpm/dnf is hiding the warning, because the useradd is a preinst and the update-alternatives are postinsts, so it's entirely correct for the useradd fragment (dbus's preinst) to execute before update-alternatives (buybox postinst).
Comment 4 Louis Rannou 2023-06-20 19:58:02 UTC
Maybe I misunderstood something

In the log.do_rootfs in case of packages rpm, it's installing busybox and running update-alternative commands (as postinstall) around line 880. I think this is were /bin/false should be created.
useradd commands are done far later at line 4575.

In the case of ipks, I see some log about busybox installation first, then the failing useradd occurs, and then the update-alternatives are done.
Note that some useradd are done after.

I am not sure, but it looks like busybox postinstall is done right after its installation in rpms while it's delayed in ipks.

I hope that helps,
Louis
Comment 5 Ross Burton 2023-06-20 21:14:20 UTC
Sure, but they're both behaving "correctly": there's no explicit dependency on busybox from dbus.  rpm and opkg are just installing and configuring in a different order.

Is this causing any actual problems, or is it just a warning that you noticed in the log?
Comment 6 Louis Rannou 2023-06-21 06:35:55 UTC
It's just something I noticed. I thought it revealed a missing dependency but it's probably fine as it is
Comment 7 Randy MacLeod 2023-07-26 21:19:08 UTC
Ross and Louis seem to agree that this isn't a bug.
Re-open if that's not accurate.