LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices



Reply
 
Search this Thread
Old 04-30-2005, 04:02 PM   #1
utw-mephisto
Member
 
Registered: Apr 2005
Posts: 93

Rep: Reputation: 16
dpkg: `file' not found on PATH.


Hi,

I am quite new in Debian and a "professional" friend tried to help me with something. The result : A messed up system.

When installing packages with apt-get I get the following errors :

Code:
.
.
Fetched 619kB in 1s (354kB/s)
.
.
Preconfiguring packages ...
dpkg: `ldconfig' not found on PATH.
dpkg: `start-stop-daemon' not found on PATH.
dpkg: `install-info' not found on PATH.
dpkg: `update-rc.d' not found on PATH.
dpkg: 4 expected program(s) not found on PATH.
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)
When executing the following commands, I can install the programs with apt-get again:

Code:
root@debian:~# export PATH=$PATH:/usr/local/sbin/
root@debian:~# export PATH=$PATH:/usr/sbin/
root@debian:~# export PATH=$PATH:/sbin
However, this is working only once.

I checked the file /root/.profile which contains the following :

Code:
# ~/.profile: executed by Bourne-compatible login shells.

if [ -f ~/.bashrc ]; then
  . ~/.bashrc
fi

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
export PATH

mesg n
It looks actually fine, doesn't it ? I am really lost, any help is highly appreciated ...
 
Old 04-30-2005, 10:27 PM   #2
Dead Parrot
Senior Member
 
Registered: Mar 2004
Distribution: Debian GNU/kFreeBSD
Posts: 1,597

Rep: Reputation: 46
I haven't had any PATH related problems using Debian. Then again, I've never logged in as root -- I always login as normal user and then use "su" to become "superuser" that has root privileges.

If that doesn't help, you should perhaps check /etc/login.defs. In my login.defs there are these lines that appear to be important in defining PATH:
Code:
#
# *REQUIRED*  The default PATH settings, for superuser and normal users.
#
# (they are minimal, add the rest in the shell startup files)
ENV_SUPATH      PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/bin/X11:/usr/local/sbin:/usr/local/bin
ENV_PATH        PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
 
Old 04-30-2005, 10:34 PM   #3
utw-mephisto
Member
 
Registered: Apr 2005
Posts: 93

Original Poster
Rep: Reputation: 16
Mmm.... login.defs looks good actually
 
Old 04-30-2005, 11:43 PM   #4
Dead Parrot
Senior Member
 
Registered: Mar 2004
Distribution: Debian GNU/kFreeBSD
Posts: 1,597

Rep: Reputation: 46
Maybe you should try "echo $PATH" both as normal user and as superuser to find out if the problem only exists when you "su" to root.

Also, ~/.bash_profile (or ~/.profile) defines only login shell while ~/.bashrc defines other (non-login) shells that you open afterwards. So, if the problem only appears in non-login shells (like in terminal window), then you could try to add PATH in ~/.bashrc to see if that helps.
 
Old 05-01-2005, 12:09 AM   #5
utw-mephisto
Member
 
Registered: Apr 2005
Posts: 93

Original Poster
Rep: Reputation: 16
Quote:
Originally posted by Dead Parrot
Maybe you should try "echo $PATH" both as normal user and as superuser to find out if the problem only exists when you "su" to root.

Also, ~/.bash_profile (or ~/.profile) defines only login shell while ~/.bashrc defines other (non-login) shells that you open afterwards. So, if the problem only appears in non-login shells (like in terminal window), then you could try to add PATH in ~/.bashrc to see if that helps.
Ok, echo $PATH gives me

Code:
root@debian:~# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
Which means sbin is indeed missing. Where else can I set these ? It is correctly set in /etc/login.defs
 
Old 05-01-2005, 12:51 AM   #6
Dead Parrot
Senior Member
 
Registered: Mar 2004
Distribution: Debian GNU/kFreeBSD
Posts: 1,597

Rep: Reputation: 46
This probably depends on your login method. If you use a "display manager" (kdm, gdm, wdm, or xdm), then it's possible that PATH is defined in the display manager's config file. I use wdm and PATH for both normal users and the superuser is defined in /etc/X11/wdm/wdm-config. (I think that for gdm the config file is /etc/gdm/gdm.conf but I don't know about the other display managers.) If you use the command line to login, then such files as /etc/login.defs, /etc/profile, and /etc/bash.bashrc should define system-wide login settings that can be changed with the login files (.profile, .bash_profile, and .bashrc) in user's home directory.

If your problem appears during X session (in terminal window) after starting the session with "startx", then adding /sbin to PATH in .bashrc may help. Make it something like this:
Code:
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/bin/X11:/usr/local/sbin:/usr/local/bin"
export PATH
Or, alternatively, you could try to make root user's .bashrc to read .profile (where /sbin apparently is mentioned) by adding this to root's .bashrc:
Code:
if [ -f ~/.profile ]; then
  . ~/.profile
fi

Last edited by Dead Parrot; 05-01-2005 at 12:57 AM.
 
Old 05-01-2005, 01:00 AM   #7
utw-mephisto
Member
 
Registered: Apr 2005
Posts: 93

Original Poster
Rep: Reputation: 16
I am using only Putty to connect to the server ..

I have tried both and still :

root@debian:~# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
 
Old 05-01-2005, 02:05 AM   #8
Dead Parrot
Senior Member
 
Registered: Mar 2004
Distribution: Debian GNU/kFreeBSD
Posts: 1,597

Rep: Reputation: 46
Hmm... I don't know the reason, but your problem seems to be that you're getting normal user's PATH while you're the root user. So maybe you should edit normal user's login files and make their PATH identical with root user's. In /etc/login.defs, you can change ENV_PATH to be identical with ENV_SUPATH. If you have made a normal user, you can also edit .bash_profile and .bashrc in the normal user's home directory to contain the same PATH that is set in root user's .profile. Then logout and login again to see if "echo $PATH" now has /sbin. If this still doesn't help, then I'm afraid that I'm running out of suggestions.
 
Old 05-01-2005, 02:47 AM   #9
utw-mephisto
Member
 
Registered: Apr 2005
Posts: 93

Original Poster
Rep: Reputation: 16
Thanks a lot guys,

what I did now is :

/root/.bash_profile
export ISU_HOME="/var/www/isu"
export PATH=$PATH:/sbin/
export PATH=$PATH:/usr/sbin/
export PATH=$PATH:/usr/local/sbin/
export PATH=$PATH:/sbin
export PATH=$PATH:/usr/sbin
export PATH=$PATH:/usr/local/sbin
[/b]

And :

Code:
root@debian:~# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/sbin/:/usr/sbin/:/usr/local/sbin/:/sbin:/usr/sbin:/usr/local/sbin


One question though :

Do I put the path with [/ {slash}] at the end or without ?
 
Old 05-01-2005, 08:08 AM   #10
Dead Parrot
Senior Member
 
Registered: Mar 2004
Distribution: Debian GNU/kFreeBSD
Posts: 1,597

Rep: Reputation: 46
It's great that you found a working solution at last.
AFAIK, the slash at the end of the export command is not necessary -- it shouldn't have any effect on the actual command if you add the slash mark or if you leave it out.
 
Old 08-07-2008, 10:22 AM   #11
mkenyon2
Member
 
Registered: Dec 2007
Posts: 32

Rep: Reputation: 15
Question

I know I'm late to the game, but I'm having a similar problem.

However, all my paths are correct, so I don't know what the issue is.

I think it's how dpkg was installed.

I'm using DSL-N, and got dpkg on the system with a myDSL extension that was written for DSL.

Any experience with this?
 
Old 10-21-2011, 08:53 AM   #12
smund3
LQ Newbie
 
Registered: Oct 2011
Posts: 1

Rep: Reputation: Disabled
Lightbulb

I am fully aware that this is an old thread, but as this thread is the first hit I got while Googleing this issue, I will provide a sollution for users who have disabled login as root:

Add this line to your /home/[user]/.bashrc file:
Code:
export PATH=$PATH:/sbin:/usr/sbin/:/usr/local/sbin/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
APT/dpkg errors! /var/lib/dpkg/status bassclarinet Debian 16 12-01-2011 10:24 AM
dpkg is dead! error in /var/lib/dpkg/available dezert_fox Debian 4 11-22-2011 11:28 AM
Is there any script to reverse the process of dpkg -i file-1.1.1.deb? sunzaifa Debian 2 08-03-2004 10:01 AM
During 2.6.6 kernel compile, make-dpkg not found? R00ts Debian 5 07-07-2004 12:56 AM
make-dpkg: command not found kadalz Linux - Newbie 5 10-02-2003 06:15 AM


All times are GMT -5. The time now is 09:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration