sh: rar: not found
by admin on Mar.02, 2023, under News
If you get this error message in a Docker or Kubernetes setup even though you made sure that rar is in the PATH and executable (chmod +x) it’s probably a libc related issue.
We may use the command ldd to get the shared objects (shared libraries) required by each program or shared object specified on the command line:
ldd rar
The command will print something similar to:
linux-vdso.so.1 (0x00007ffcd9b68000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f8f83899000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8f83755000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f8f8373b000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8f83719000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8f83544000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8f83a77000)
If your container image is based on alpine:latest or similar, the easiest fix is to switch to another distribution containing the gnu libgcc / libstdc++
FROM debian:latest
Alternatively, if you’d like to stick with alpine, update your Dockerfile to install libstdc++
apk add –no-cache libstdc++