LinuxQuestions.org
Social Bookmarking all things Linux and Open Source
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices

Reply
 
Thread Tools
Old 11-25-2008, 01:23 PM   #1
linuxfia
Member
 
Registered: Apr 2008
Distribution: ubuntu 7.10, centos 4 & 5
Posts: 84
Thanked: 0
apt-get error dpkg: ... not found on PATH


[Log in to get rid of this advertisement]
I get dpkg: .... not found on PATH error every few days.
I would just run apt-get -y update && apt-get -y upgrade manually and it eventually goes through but was wondering if there's a way to fix this so I wouldn't need to do this everytime.

Code:
Get:1 http://us.archive.ubuntu.com gutsy-updates/main libpq5 8.2.11-0ubuntu0.7.10 [253kB]
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin: 
Fetched 253kB in 1s (160kB/s)
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)
A package failed to install.  Trying to recover:
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.
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...
Building tag database...
The root's path:
Code:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
My Ubuntu distribution is:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=7.10
DISTRIB_CODENAME=gutsy
DISTRIB_DESCRIPTION="Ubuntu 7.10


This is the apt's source.list:
Code:
deb http://us.archive.ubuntu.com/ubuntu/ gutsy main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy main restricted

deb http://us.archive.ubuntu.com/ubuntu/ gutsy-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy-updates main restricted


deb http://us.archive.ubuntu.com/ubuntu/ gutsy universe
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy universe
deb http://us.archive.ubuntu.com/ubuntu/ gutsy-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy-updates universe


deb http://us.archive.ubuntu.com/ubuntu/ gutsy multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy multiverse
deb http://us.archive.ubuntu.com/ubuntu/ gutsy-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy-updates multiverse


deb http://security.ubuntu.com/ubuntu gutsy-security main restricted
deb-src http://security.ubuntu.com/ubuntu gutsy-security main restricted
deb http://security.ubuntu.com/ubuntu gutsy-security universe
deb-src http://security.ubuntu.com/ubuntu gutsy-security universe
deb http://security.ubuntu.com/ubuntu gutsy-security multiverse
deb-src http://security.ubuntu.com/ubuntu gutsy-security multiverse
Thanks!
linuxfia is offline     Reply With Quote
Old 11-25-2008, 11:03 PM   #2
handydan
Member
 
Registered: Mar 2005
Location: palmdale, california
Distribution: MEPIS 8; Debian (stable/testing)
Posts: 75
Thanked: 1
What command are you running?

Quote:
Originally Posted by linuxfia View Post
I get dpkg: .... not found on PATH error every few days.
I would just run apt-get -y update && apt-get -y upgrade manually and it eventually goes through but was wondering if there's a way to fix this so I wouldn't need to do this everytime.

Code:
Get:1 http://us.archive.ubuntu.com gutsy-updates/main libpq5 8.2.11-0ubuntu0.7.10 [253kB]
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin: 
Fetched 253kB in 1s (160kB/s)
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)
A package failed to install.  Trying to recover:
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.
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...
Building tag database...
The root's path:
Code:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
My Ubuntu distribution is:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=7.10
DISTRIB_CODENAME=gutsy
DISTRIB_DESCRIPTION="Ubuntu 7.10


This is the apt's source.list:
Code:
deb http://us.archive.ubuntu.com/ubuntu/ gutsy main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy main restricted

deb http://us.archive.ubuntu.com/ubuntu/ gutsy-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy-updates main restricted


deb http://us.archive.ubuntu.com/ubuntu/ gutsy universe
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy universe
deb http://us.archive.ubuntu.com/ubuntu/ gutsy-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy-updates universe


deb http://us.archive.ubuntu.com/ubuntu/ gutsy multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy multiverse
deb http://us.archive.ubuntu.com/ubuntu/ gutsy-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy-updates multiverse


deb http://security.ubuntu.com/ubuntu gutsy-security main restricted
deb-src http://security.ubuntu.com/ubuntu gutsy-security main restricted
deb http://security.ubuntu.com/ubuntu gutsy-security universe
deb-src http://security.ubuntu.com/ubuntu gutsy-security universe
deb http://security.ubuntu.com/ubuntu gutsy-security multiverse
deb-src http://security.ubuntu.com/ubuntu gutsy-security multiverse
Thanks!
What command are you running?
handydan is offline     Reply With Quote
Old 11-26-2008, 12:04 PM   #3
linuxfia
Member
 
Registered: Apr 2008
Distribution: ubuntu 7.10, centos 4 & 5
Posts: 84
Thanked: 0

Original Poster
I'm running:
Code:
apt-get -y update && apt-get -y upgrade
linuxfia is offline     Reply With Quote
Old 11-27-2008, 10:21 AM   #4
handydan
Member
 
Registered: Mar 2005
Location: palmdale, california
Distribution: MEPIS 8; Debian (stable/testing)
Posts: 75
Thanked: 1
Sudo

Quote:
Originally Posted by linuxfia View Post
I'm running:
Code:
apt-get -y update && apt-get -y upgrade
Try sudo
handydan is offline     Reply With Quote
Old 12-01-2008, 12:21 PM   #5
linuxfia
Member
 
Registered: Apr 2008
Distribution: ubuntu 7.10, centos 4 & 5
Posts: 84
Thanked: 0

Original Poster
I was already running the command as root. Would sudo make a difference?
linuxfia is offline     Reply With Quote
Old 12-01-2008, 12:29 PM   #6
tredegar
Senior Member
 
Registered: May 2003
Location: London, UK
Distribution: Kubuntu6.06.1LTS (still excellent!). Kubuntu 8.04.1
Posts: 4,308
Thanked: 133
Quote:
I was already running the command as root.
Threre's "running as root" and "running as root, with root's environment"
Try running these commands & you'll understand. Start as a normal user, then:
Code:
echo $PATH
sudo whoami; echo $PATH
sudo -i
whoami; echo $PATH
tredegar is offline     Reply With Quote
Old 12-02-2008, 12:22 PM   #7
linuxfia
Member
 
Registered: Apr 2008
Distribution: ubuntu 7.10, centos 4 & 5
Posts: 84
Thanked: 0

Original Poster
I ran the commands and it's slightly different.


Code:
echo $PATH
sudo whoami; echo $PATH
output:
Code:
root
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games


Code:
sudo -i
whoami; echo $PATH
output:
Code:
root
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin

I use a root cron. This is what I have:
Code:
0 0    * * *   aptitude -y update && aptitude -y upgrade
Should I use a generic user cron and try changing it to this? I'll need to configure the sudoers to allow the command to run without authentification though:
Code:
0 0    * * *   sudo aptitude -y update && sudo aptitude -y upgrade
linuxfia is offline     Reply With Quote
Old 12-02-2008, 03:41 PM   #8
tredegar
Senior Member
 
Registered: May 2003
Location: London, UK
Distribution: Kubuntu6.06.1LTS (still excellent!). Kubuntu 8.04.1
Posts: 4,308
Thanked: 133
Quote:
I ran the commands and it's slightly different.
In linux, or indeed any OS, "slightly different" can mean a BIG difference.

You need to think about why they are "slightly different" (and read the manpages for sudo and crontab) and also learn more about how $PATH is set under different circumstances. This is very basic stuff if you want to write scripts to automate things (linux is excellent at this sort of thing).

It may not be a good idea to run aptitude updates as a cron job.
There are several reasons but here are two:
  • You might not want to apply an update
  • The update may stall at some point asking, for example, "Do you really want to do this? There's a nasty conflict with version numbers. What do you want to do...?
But, when run as a cron job, there is no terminal to display this output on. So you will be none the wiser, and come back here complaining that "linux isn't working anymore" and you'll have forgotten about running aptitude as a cronjob, and we'll never guess, and you'll be cross.

My 8.04.1 kubuntu install puts an "Updates available" on my panel when updates are ready. Then I can click it, and see what is going to happen, and then decide for myself what to do about it. I much prefer this to linux deciding "automagically" to mess things up completely (like windows did when I used to use it).

If you really want to use cron to run this as a cron job, don't put the aptitude command in the crontab, have the crontab call a script instead.
In that script, make sure the $PATH is set correctly, then let it fire up aptitude, and log any error messages to a file that you will of course, remember to check when it all goes horribly wrong.
tredegar is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
dpkg: `file' not found on PATH. utw-mephisto Debian 10 08-07-2008 10:22 AM
dpkg: dpkg - error: PATH is not set basis1980 Linux - Software 1 12-07-2007 05:53 PM
apt-get / dpkg error caused by aspell amon Debian 1 04-14-2005 04:09 PM
apt-get upgrade error in dpkg (--unpack) for gcc,g++ forgox Debian 4 08-29-2004 05:22 PM
apt-get upgrade error in dpkg (--unpack) for gcc,g++ forgox Linux - Newbie 0 08-28-2004 03:23 PM


All times are GMT -5. The time now is 10:22 PM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration