Error with sudo apt-get -f install (ldconfig not found)

17,056

Try this workaround if it works for you. Make sure you have not activated unstable repos for different releases or pre-released updates but for 14.04 LTS recommended only check in --> system settings/software & updates.

then run:

sudo apt-get -f install

sudo dpkg-reconfigure libc6

sudo dpkg-reconfigure libc-bin

sudo apt-get install --reinstall libc6

sudo apt-get install --reinstall libc-bin

sudo apt-get dist-upgrade

Other way:

Download libc-bin here e.g.

Then you'll have to extract it:

dpkg -x libc-bin*.deb unpacked/

copy the files to system:

sudo cp unpacked/sbin/ldconfig /sbin/

Or open Nautilus with:

gksudo nautilus

and do this GUI way, right click on a .deb package and choose extract here and copy to destination place.

And then:

sudo apt-get install --reinstall libc-bin

sudo apt-get install -f
Share:
17,056

Related videos on Youtube

enduser
Author by

enduser

Askin' questions.

Updated on September 18, 2022

Comments

  • enduser
    enduser over 1 year

    I am using 14.04 LTS. When I type sudo apt-get -f install into the terminal I get this error:

    Can't exec "locale": No such file or directory at /usr/share/perl5/Debconf/Encoding.pm line 16.
    Use of uninitialized value $Debconf::Encoding::charmap in scalar chomp at /usr/share/perl5/Debconf/Encoding.pm line 17.
    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)
    

    Please help, thanks.


    In response to Faizan who said "try executing sudo dpkg-reconfigure -a" in comments. When I tried that I got this message:

    Can't exec "locale": No such file or directory at /usr/share/perl5/Debconf/Encoding.pm line 16.
    Use of uninitialized value $Debconf::Encoding::charmap in scalar chomp at /usr/share/perl5/Debconf/Encoding.pm line 17.
    acpid stop/waiting
    acpid start/running, process 11426
    /var/lib/dpkg/info/activity-log-manager.postinst: 5: /var/lib/dpkg/info/activity-log-manager.postinst: ldconfig: not found
    

    Edit:

    Can't exec "locale": No such file or directory at /usr/share/perl5/Debconf/Encoding.pm line 16.
    Use of uninitialized value $Debconf::Encoding::charmap in scalar chomp at /usr/share/perl5/Debconf/Encoding.pm line 17.
    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)
    
    • Jos
      Jos about 9 years
      I found a couple of related questions e.g. here. Could you try sudo su and then apt-get -f install as root?
    • enduser
      enduser about 9 years
      Still doesn't work, sorry.
    • Faizan Akram Dar
      Faizan Akram Dar about 9 years
      try executing sudo dpkg-reconfigure -a
    • enduser
      enduser about 9 years
      Didn't work either, message returned in edit above.
    • JoKeR
      JoKeR about 9 years
      when this started to happen? it seems like you got unstable repos activated or from other uncompatible release.
    • enduser
      enduser about 9 years
      I am not sure when this stated to happen. I foolishly downloaded multiple packages without really thinking. Is there a way I can have a look at all the repos I disable the latest one or something like that?
  • enduser
    enduser about 9 years
    Still won't work, sorry.
  • enduser
    enduser about 9 years
    It's saying the files don't exist.
  • JoKeR
    JoKeR about 9 years
    can you show me the output for apt-cache policy libc-bin
  • enduser
    enduser about 9 years
    Sorry it's an image, I couldn't format it on the site. imgur.com/kpipX5d
  • JoKeR
    JoKeR about 9 years
    ok and you have to install it like it says in my answer if you don't have it at all. Did you do so? And when you have installed it also do apt-cache policy libc6 it has to be installed also.
  • enduser
    enduser about 9 years
    when I do sudo apt-get -f install it comes up with the first error in the my question. When I try to reconfigure the files in step 2 & 3 it says those files do not exist.
  • JoKeR
    JoKeR about 9 years
    run sudo apt-get install libc-bin and show me the output please
  • enduser
    enduser about 9 years
    E: Sub-process /usr/bin/dpkg returned an error code (2)
  • enduser
    enduser about 9 years
    Full message in EDIT 2.
  • enduser
    enduser about 9 years
    I can't install a package installer because each time I try to install something it comes up with the unmet dependencies error. When I just open it Ubuntu Software Centre it says it cannot install because of a problem with software currently installed. It tries, and fails, to repair the current software.
  • JoKeR
    JoKeR about 9 years
    check my updated answer
  • JoKeR
    JoKeR about 9 years
    I'm glad we solved this. Good luck!