5

I've got a feeling something bad just happened to this machine.

faheem@bulldog:/usr/local/src/mercurial$ sudo dpkg -i 
mercurial_3.0-1_amd64.deb mercurial-common_3.0-1_all.deb    
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

This is an old unmaintained machine I've been using for a while. Assuming it was going to die some day. Looks like this might be the day. It starting throwing errors a bit earlier, and it looks like someone just rebooted it.

UPDATE: After running

sudo -s

I checked the value of path

echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/games

So some stuff is missing from here, e.g. sbin, and /usr/sbin.

UPDATE 2:

As it turns out, person or persons unknown deleted the following lines from /etc/sudoers.

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

Thanks to Anthony for explaining.

1 Answer 1

11

As the 'Note:' at the bottom of your sudo dpkg -i output hints at, this is usually caused by $PATH being set wrong. One way that happens is when you run dpkg -i without root; but that isn't the case here.

An easy way to confirm the path is to run sudo -s, which tells sudo to run a shell instead of some other program. So you'll be landed at a root shell prompt. If you echo "$PATH", you'll likely find /sbin and/or /usr/sbin missing.

sudo's default behavior is to keep your user's $PATH variable intact. That default is normally changed by Debian's default /etc/sudoers, which contains:

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

If you're missing the secure_path line, that'd explain the problem.

Two options are to add that line back (but someone may have removed it because he/she wanted the user path to be carried over, e.g., because it contains extra elements in /opt, for example) or to add /sbin:/usr/sbin to your user's $PATH.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .