dpkg: warning: ‘ldconfig’ not found in PATH or not executable.

Error:

[[email protected] ~]$sudo apt-get autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  xaw3dg
0 upgraded, 0 newly installed, 1 to remove and 123 not upgraded.
After this operation, 460 kB disk space will be freed.
Do you want to continue [Y/n]? y
dpkg: warning: 'ldconfig' not found in PATH or not executable.
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable.
dpkg: warning: 'update-rc.d' not found in PATH or not executable.
dpkg: 3 expected programs not found in PATH or not executable.
NB: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.
E: Sub-process /usr/bin/dpkg returned an error code (2)

Try fix:

Edit /etc/sudoers with visudo and add the line:

Defaults        env_reset
Defaults    secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

The whole file now looks like this for me:

# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

Defaults        env_reset
Defaults    secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL) ALL

# Allow members of group sudo to execute any command
# (Note that later entries override this, so you might need to move
# it further down)
%sudo ALL=(ALL) ALL
#
#includedir /etc/sudoers.d

droidzone ALL=(ALL) ALL

 

Trying the command which failed earlier:

[[email protected] ~]$sudo apt-get install emacs
Reading package lists... Done
Building dependency tree
Reading state information... Done
emacs is already the newest version.
The following package was automatically installed and is no longer required:
xaw3dg
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 122 not upgraded.[/code]
It now works!


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Fix for missing apt-add-repository in Debian

Anant Shrivastava has created an excellent script to provide an equal functionality in Debian which is misssing this command.

I’ve taken the liberty to include the script below, however I’ll refer you to the original post for details and updates.

#!/bin/bash
if [ $# -eq 1 ]
NM=`uname -a && date`
NAME=`echo $NM | md5sum | cut -f1 -d" "`
then
	ppa_name=`echo "$1" | cut -d":" -f2 -s`
	if [ -z "$ppa_name" ]
	then
		echo "PPA name not found"
		echo "Utility to add PPA repositories in your debian machine"
		echo "$0 ppa:user/ppa-name"
	else
		echo "$ppa_name"
		echo "deb http://ppa.launchpad.net/$ppa_name/ubuntu lucid main" >> /etc/apt/sources.list
		apt-get update >> /dev/null 2> /tmp/${NAME}_apt_add_key.txt
		key=`cat /tmp/${NAME}_apt_add_key.txt | cut -d":" -f6 | cut -d" " -f3`
		apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key
		rm -rf /tmp/${NAME}_apt_add_key.txt
	fi
else
	echo "Utility to add PPA repositories in your debian machine"
	echo "$0 ppa:user/ppa-name"
fi

 


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Apt reference (In progress)

Completely remove (purge) a package

apt-get --purge remove <package>

 


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.