Friday, January 26, 2018

dpkg cannot find ldconfig/start-stop-daemon in the PATH variable


I have this problem in my ubuntu server 11.04,

Preconfiguring packages ...
dpkg: warning: 'ldconfig' not found in PATH or not executable.
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable.
dpkg: error: 2 expected programs 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)

And I found the solution from  https://ubuntuforums.org/showthread.php?t=1266104, I adjust it to my ubuntu version.

1. sudo apt-get download libc-bin    // download the library
2. sudo dpkg-deb -x libc-bin*.deb libc-bin-unpacked/              // unpack it
3. sudo cp libc-bin-unpacked/sbin/ldconfig* /sbin/    // copy to sbin folder
--- sometimes, you need to remove old one, I did it using sudo rm -rf /sbin/ldconfig*

4. sudo apt-get -f install
5. sudo dpkg-reconfigure libc-bin
6. sudo apt-get install --reinstall libc-bin

One error now is gone. Another one is solved using guide from https://ubuntuforums.org/showthread.php?t=1919127, Below is the guide:

1. Download the dpkg package from http://launchpadlibrarian.net/63806751/dpkg_1.15.8.10ubuntu1_amd64.deb


2. Copy the file into a temporary location:
mkdir ~/dpgk_temp
cp ~/Downloads/dpgk*.deb ~/dpkg_temp
cd ~/dpgk_temp


3. Extract the files from the archive:
ar x dpkg*.deb
tar xfvz data.tar.gz


4. Copy the file to /sbin:
sudo cp ./sbin/start-stop-daemon /sbin


5. Try update the apt information:
sudo apt-get update
sudo apt-get upgrade



Thank you to those who gives us solution, I just put this in here as my reference.


No comments: