Can I NOT include busybox in image and use another shell? (Findutils path collision)

#1

when I am trying to install a lot of packages that are shell utilities like "find" I get the error that is installed by the budybox package

"* check_data_file_clashes: Package findutils-find wants to install file /usr/bin/find
But that file is already provided by package * busybox"

can I exclude busybox and use another shell instead?
I already have include zsh and use that as default shell.

if so what is the safe way to do this?
I use imagebuilder and use make command to include and exclude packages that I want.

anyone has any experience with this?

0 Likes

#3

I think that you can override file clashes with opkg command line options. (After flashing, but not in imagebuilder)

Technical background: The co-existence of some GNU utilities (some findutils, coreutils) and busybox are not perfect, as they try to use the same paths for executables. (Busybox could be patched to place it's utils into /bin, or Makefiles should have "alternatives" definitions)

1 Like

#4
mv /bin/cp /bin/cp-busy
opkg install coreutils-cp
/usr/bin/cp /usr/bin/cp /bin/cp 

usually just a

which xyz
rm /bin/xyz
opkg install xyz

will do the trick, you can always symlink back to busy later.

for the buildroot you'd have to find the opkg call and mod that.... or grep -v .config etc.... i suppose ideally the .in would deselect the busy variant.... but that is alot more work than rm :wink:

0 Likes

#5

that is my issue exactly.
I don't actually need to remove busybox as I suspect it is needed for the openwrt script defaults and so on(maybe).
I just cant install any packages that have the same executable names and that frustrates me.

0 Likes

#6

Is it a strict requirement to use imagebuilder or would you be willing / able to switch to the OpenWrt buildsystem?

0 Likes

#7

You might be able to do a little trick with imagebuilder: instead of selecting the package, download its .ipk installation package, extract the binary and include it in the image as "custom file". Custom files are placed last to the image, so they would override the symlink from busybox.

Ps. Even with using the full buildroot, there would be the same path conflict.

0 Likes

#8

I have vague memories of this conflict in the past. I presently install “real” diff and find in my from-source builds. A from-source build will let you disable specific busybox applets. Be aware that disabling the wrong things in busybox can result in upgrades being impossible without major surgery on the upgrade scripts.

2 Likes

#9

in bulidroot I had the option of customizing bash(busybox) and deselecting the lean versions of programs I needed.

0 Likes

#10

I use to do the buildroot because of git process being based on that.

I have replaced git versions with the stable ones (even though the stable build process has its own issues in openwrt)

later I tested a build environment that was from stable build but the images created wouldn't work.

0 Likes

#11

Hannu, I see this issue bit another user. Any idea if the powers that be would patch busybox in master to play nicer with alternatives?

0 Likes

#12

Somebody needs to go through all busybox default apps and respective GNU coreutils, findutils, diffutils, etc. packages and evaluate which apps would need patching.

I briefly considered doing a patch for that 1-2 years ago, but did not have energy for completing that.

I still have my notes about coreutils apps:

Default in busybox, but no conflict (in /bin)
cat chgrp chmod chown cp date dd echo kill ln ls mkdir mknod mktemp mv nice pwd rm rmdir sleep sync touch true uname

Default in busybox, conflict in /usr/bin:
basename cut dirname du env head id md5sum mkfifo readlink seq sort sha256sum tail tee test tr uniq uptime wc yes

Default in busybox, conflict in /usr/sbin:
chroot  

No conflict or not default in busybox
base64 chcon cksum comm expand factor false fold groups hostid install link logname nl nohup nproc od paste printenv printf realpath runcon sha1sum sha224sum sha384sum sha512sum shred shuf split stat stty sum tac timeout tty  unlink users truncate unexpand who whoami


Unevaluated:
COREUTILS_APPLETS := \
	csplit \
	dir dircolorsexpr 	\
	fmt join \
	pathchk pinky pr ptx 	\
	stdbuf  \
	tsort \
	vdir 

(That was just for coreutils. Findutils, diffutils, ... are in addition to that)

Possible long-term solutions are to

  • patch busybox sources so that the bb apps are installed into /bin instead of /usr/*bin
    Sources would need to be patched by app in style of changing bb definitions from BB_DIR_USR_BIN to BB_DIR_BIN for each app.
    Below are example definitions grepped from bb sources, which show that this approach would require patching dozens of files in busybox sources, increasing the maintenance work at version upgrades:
coreutils/basename.c://applet:IF_BASENAME(APPLET_NOFORK(basename, basename, BB_DIR_USR_BIN, BB_SUID_DROP, basename))
selinux/chcon.c://applet:IF_CHCON(APPLET(chcon, BB_DIR_USR_BIN, BB_SUID_DROP))
coreutils/cksum.c://applet:IF_CKSUM(APPLET_NOEXEC(cksum, cksum, BB_DIR_USR_BIN, BB_SUID_DROP, cksum))
coreutils/comm.c://applet:IF_COMM(APPLET(comm, BB_DIR_USR_BIN, BB_SUID_DROP))
  • other alternative would be to define ALTERNATIVES definitions for each app in both busybox and respective GNU utils Makefiles in Openwrt.
    This approach might be easier in the long run.
2 Likes