LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 11-25-2008, 12:23 PM   #1
linuxfia
Member
 
Registered: Apr 2008
Distribution: ubuntu 7.10, centos 4 & 5
Posts: 84

Rep: Reputation: 15
apt-get error dpkg: ... not found on PATH


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!
 
Old 11-25-2008, 10:03 PM   #2
handydan
Member
 
Registered: Mar 2005
Location: palmdale, california
Distribution: MEPIS 8; Debian (stable/testing)
Posts: 83

Rep: Reputation: 23
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?
 
Old 11-26-2008, 11:04 AM   #3
linuxfia
Member
 
Registered: Apr 2008
Distribution: ubuntu 7.10, centos 4 & 5
Posts: 84

Original Poster
Rep: Reputation: 15
I'm running:
Code:
apt-get -y update && apt-get -y upgrade
 
Old 11-27-2008, 09:21 AM   #4
handydan
Member
 
Registered: Mar 2005
Location: palmdale, california
Distribution: MEPIS 8; Debian (stable/testing)
Posts: 83

Rep: Reputation: 23
Sudo

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

Original Poster
Rep: Reputation: 15
I was already running the command as root. Would sudo make a difference?
 
Old 12-01-2008, 11:29 AM   #6
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
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
 
Old 12-02-2008, 11:22 AM   #7
linuxfia
Member
 
Registered: Apr 2008
Distribution: ubuntu 7.10, centos 4 & 5
Posts: 84

Original Poster
Rep: Reputation: 15
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
 
Old 12-02-2008, 02:41 PM   #8
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
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.
 
  


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 06:54 PM.

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
Open Source Consulting | Domain Registration