Fix “dpkg: warning: ‘ldconfig’ not found in PATH or not executable” in WSL

Fix “dpkg: warning: ‘ldconfig’ not found in PATH or not executable” in WSL

Windows Subsystem for Linux (WSL) is not short of problems, probably because it’s yet to be at its best. The errors FIXED in this article resulted from running a command to Fix Broken Packages both as NON-ROOT or ROOT and revolves around fixing a MISSING package, “ldconfig“;

sudo apt-get --fix-broken install
apt-get --fix-broken install

ldconfig-dpkg-warning-ldconfig-thetqweb

 

Error::

dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)

 

 

[SOLUTION]

FIRST step here was to download the package. However, the package “ldconfig” does not exist on its own as a package, but rather lives inside another package, namely “libc-bin“! Therefore we have to download “libc-bin” which can be done using the “apt-get” utility;

sudo apt-get download libc-bin

ldconfig-apt-get-download-libc-bin-thetqweb

 

NEXT step was to EXTRACT the contents of the Debian (.deb) package to the current working directory (and hence ./), then confirming the contents were in fact extracted (using “ls”);

sudo dpkg --extract ./libc-bin_2.34-4_amd64.deb ./
ls

ldconfig-dpkg-extract-thetqweb

 

NEXT step was to COPY the package “ldconfig” to its rightful location (using “cp“), then REINSTALL the “libc-bin” package;

sudo cp ./sbin/ldconfig /sbin/
sudo apt-get install --reinstall libc-bin

ldconfig-cp-apt-get-reinstall-thetqweb

 

NEXT step was to fix any broken dependencies (using “apt-get“);

sudo apt-get install -f

ldconfig-apt-get-install-f-thetqweb

 

[Proof of Concept (PoC)]

To confirm that the initial Error was successfully FIXED, run the command that threw the exception!

sudo apt-get --fix-broken install

ldconfig-error-fixed-thetqweb

 

Fix “dpkg: warning: ‘ldconfig’ not found in PATH or not executable” in WSL
WSL | thetqweb