I'm building a custom linux for an embedded device. For development purposes I added apt to my filesystem. The command works fine, I was able to install some package on the fly like curl, the problem comes when I try to install python3-pip with the command:

apt install python3-pip

I got the following err:

stat: unrecognized option '--dereference'

I print the help for the stat command but I see that there's no such option --dereference:

root@imx93-11x11-lpddr4x-evk:/usr/sbin# stat --help
BusyBox v1.35.0 () multi-call binary.

Usage: stat [-ltf] [-c FMT] FILE...

The line (348) that causes apt to crash is (/usr/lib/usrmerge/convert-usrmerge):

open($fh, '-|', 'stat --dereference --file-system --format="%i" /'); 

I checked for the man page for stat command and there's the option --dereference: https://man7.org/linux/man-pages/man1/stat.1.html

The following is my full err output:

Setting up usrmerge (35) ...
stat: unrecognized option '--dereference'
BusyBox v1.35.0 () multi-call binary.

Usage: stat [-ltf] [-c FMT] FILE...
stat / failed at /usr/lib/usrmerge/convert-usrmerge line 348.
E: usrmerge failed.
dpkg: error processing package usrmerge (--configure):
 installed usrmerge package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Any idea to work around?

Thanks in advanced.

  • Use a different package manager. Alpine Linux, which makes extensive use of busybox on the base system, uses their own apk package manager which presumably does not require the non-busybox versions of commands.
    – larsks
    Jan 22 at 3:39

1 Answer 1

  1. Install bash via apt
  2. Use the update-alternatives command to make bash the provider for sh
  3. Install pip
  4. Optional but desirable: File a bug report against usrmerge in debian. This should either work or explicitly demand bash
  • The error in question has nothing to do with bash. The expected stat command is the one from coreutils, which is an essential package, and so other packages need not even list a dependency on it.
    – muru
    Jan 22 at 8:06
  • @muru it does. Because BusyBox is what implements sh on this machine, the built-in stat instead of the coreutils stat is used. Hence the need to switch shells. Jan 22 at 10:34
  • If that's the reason, there's no need for bash. Dash would work just as fine. However, both are again essential packages, and other packages do not need to declare a dependency on either of them. (However, we don't know if Busybox is indeed set as sh, or if something else is, and OP simply doesn't have coreutils installed and is relying on Busybox for everything else.)
    – muru
    Jan 22 at 11:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .