sudo apt-get -f install 出錯(找不到 ldconfig)

sudo apt-get -f install 出錯(找不到 ldconfig)

我正在使用 14.04 LTS。當我輸入sudo apt-get -f install終端時,我收到此錯誤:

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)

請幫忙,謝謝。


回應 Faizansudo dpkg-reconfigure -a在評論中說“嘗試執行”。當我嘗試時,我收到了這條訊息:

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

編輯:

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)

答案1

如果它適合您,請嘗試此解決方法。確保您尚未啟動不同版本或預發布更新的不穩定儲存庫,但對於 14.04 LTS,建議僅檢查 --> 系統設定/軟體和更新。

然後運行:

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

另一種方式:

下載libc-bin 這裡例如

然後你必須提取它:

dpkg -x libc-bin*.deb unpacked/

將文件複製到系統:

sudo cp unpacked/sbin/ldconfig /sbin/

或使用以下命令開啟 Nautilus:

gksudo nautilus

並執行此 GUI 方式,右鍵單擊.deb套件並選擇在此處提取並複製到目標位置。

進而:

sudo apt-get install --reinstall libc-bin

sudo apt-get install -f

相關內容