How to solve “dpkg: error: 1 expected program not found in PATH or not executable”?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







3















I have installed the LAMP Server using the command sudo apt-get install lamp-server^. Thereafter, whenever I open the terminal the following error started to appear:



 bash: /home/gaja/.bashrccu: No such file or directory 
bash: /home/gaja/.bashrc: line 4: syntax error near unexpected token ('
bash: /home/gaja/.bashrc: line 4: see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)'


I could get rid of this problem using the answer given here.



However, now the problem is that I cannot install any thing using the sudo apt-get command.



I am trying to become root and then re-run the sudo apt-get install lamp-server^ command which gives the following error output:



dpkg: warning: 'tar' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)


Following is the complete output of running the commands:



gaja@gaja-System-Product-Name:~$ sudo su
[sudo] password for gaja:

root@gaja-System-Product-Name:/home/gaja# sudo apt-get install lamp-server^
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libdbi-perl' for task 'lamp-server'
Note, selecting 'perl-modules' for task 'lamp-server'
Note, selecting 'libaprutil1-dbd-sqlite3' for task 'lamp-server'
Note, selecting 'perl' for task 'lamp-server'
Note, selecting 'apache2-bin' for task 'lamp-server'
Note, selecting 'libapache2-mod-php5' for task 'lamp-server'
Note, selecting 'ssl-cert' for task 'lamp-server'
Note, selecting 'mysql-server-5.5' for task 'lamp-server'
Note, selecting 'mysql-client-core-5.5' for task 'lamp-server'
Note, selecting 'libclass-isa-perl' for task 'lamp-server'
Note, selecting 'mysql-server' for task 'lamp-server'
Note, selecting 'libapr1' for task 'lamp-server'
Note, selecting 'php5-readline' for task 'lamp-server'
Note, selecting 'libaprutil1' for task 'lamp-server'
Note, selecting 'libwrap0' for task 'lamp-server'
Note, selecting 'libdbd-mysql-perl' for task 'lamp-server'
Note, selecting 'apache2-mpm-prefork' for task 'lamp-server'
Note, selecting 'libhtml-template-perl' for task 'lamp-server'
Note, selecting 'mysql-client-5.5' for task 'lamp-server'
Note, selecting 'libaio1' for task 'lamp-server'
Note, selecting 'mysql-common' for task 'lamp-server'
Note, selecting 'libmysqlclient18' for task 'lamp-server'
Note, selecting 'mysql-server-core-5.5' for task 'lamp-server'
Note, selecting 'libterm-readkey-perl' for task 'lamp-server'
Note, selecting 'php5-mysql' for task 'lamp-server'
Note, selecting 'apache2-data' for task 'lamp-server'
Note, selecting 'apache2' for task 'lamp-server'
Note, selecting 'php5-common' for task 'lamp-server'
Note, selecting 'php5-cli' for task 'lamp-server'
Note, selecting 'libswitch-perl' for task 'lamp-server'
Note, selecting 'libaprutil1-ldap' for task 'lamp-server'
Note, selecting 'tcpd' for task 'lamp-server'
libaio1 is already the newest version.
libapr1 is already the newest version.
libaprutil1 is already the newest version.
libaprutil1-dbd-sqlite3 is already the newest version.
libaprutil1-ldap is already the newest version.
libclass-isa-perl is already the newest version.
libdbd-mysql-perl is already the newest version.
libdbi-perl is already the newest version.
libhtml-template-perl is already the newest version.
libswitch-perl is already the newest version.
libterm-readkey-perl is already the newest version.
libwrap0 is already the newest version.
perl is already the newest version.
perl-modules is already the newest version.
ssl-cert is already the newest version.
tcpd is already the newest version.
apache2 is already the newest version.
apache2-bin is already the newest version.
apache2-data is already the newest version.
apache2-mpm-prefork is already the newest version.
libapache2-mod-php5 is already the newest version.
libmysqlclient18 is already the newest version.
mysql-client-5.5 is already the newest version.
mysql-client-core-5.5 is already the newest version.
mysql-common is already the newest version.
mysql-server is already the newest version.
mysql-server-5.5 is already the newest version.
mysql-server-core-5.5 is already the newest version.
php5-cli is already the newest version.
php5-common is already the newest version.
php5-mysql is already the newest version.
php5-readline is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 230 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: warning: 'tar' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)

root@gaja-System-Product-Name:/home/gaja# sudo apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
apache2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 230 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: warning: 'tar' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)
root@gaja-System-Product-Name:/home/gaja#


Some of the troubleshooting steps that I have taken on suggestion of other members:



$ ls -l /bin/tar
ls: cannot access /bin/tar: No such file or directory

$ apt-cache policy tar
tar: Installed: 1.26+dfsg-8 Candidate: 1.26+dfsg-8 Version table: *** 1.26+dfsg-8 0 500 in.archive.ubuntu.com/ubuntu saucy/main i386 Packages 100 /var/lib/dpkg/status


I have also tried running the following command after switching to root, but that doesn't help either:



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









share|improve this question
















bumped to the homepage by Community 1 min ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • We have consolidated all the information which was scattered around for the problem that you are facing. From now onwards, please comment below the answers to which you are replying... If it involves code then it would be better if you edit your question and format it properly.. See editing-help for more information.. AND PLEASE DO NOT OPEN ANOTHER QUESTION ON THE SAME TOPIC, AS I SAID EARLIER Edit THIS QUESTION...

    – Aditya
    Jan 6 '14 at 13:21













  • Edit the question and include sudo -i sh -c 'echo $PATH' output.

    – Braiam
    Jan 6 '14 at 13:29


















3















I have installed the LAMP Server using the command sudo apt-get install lamp-server^. Thereafter, whenever I open the terminal the following error started to appear:



 bash: /home/gaja/.bashrccu: No such file or directory 
bash: /home/gaja/.bashrc: line 4: syntax error near unexpected token ('
bash: /home/gaja/.bashrc: line 4: see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)'


I could get rid of this problem using the answer given here.



However, now the problem is that I cannot install any thing using the sudo apt-get command.



I am trying to become root and then re-run the sudo apt-get install lamp-server^ command which gives the following error output:



dpkg: warning: 'tar' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)


Following is the complete output of running the commands:



gaja@gaja-System-Product-Name:~$ sudo su
[sudo] password for gaja:

root@gaja-System-Product-Name:/home/gaja# sudo apt-get install lamp-server^
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libdbi-perl' for task 'lamp-server'
Note, selecting 'perl-modules' for task 'lamp-server'
Note, selecting 'libaprutil1-dbd-sqlite3' for task 'lamp-server'
Note, selecting 'perl' for task 'lamp-server'
Note, selecting 'apache2-bin' for task 'lamp-server'
Note, selecting 'libapache2-mod-php5' for task 'lamp-server'
Note, selecting 'ssl-cert' for task 'lamp-server'
Note, selecting 'mysql-server-5.5' for task 'lamp-server'
Note, selecting 'mysql-client-core-5.5' for task 'lamp-server'
Note, selecting 'libclass-isa-perl' for task 'lamp-server'
Note, selecting 'mysql-server' for task 'lamp-server'
Note, selecting 'libapr1' for task 'lamp-server'
Note, selecting 'php5-readline' for task 'lamp-server'
Note, selecting 'libaprutil1' for task 'lamp-server'
Note, selecting 'libwrap0' for task 'lamp-server'
Note, selecting 'libdbd-mysql-perl' for task 'lamp-server'
Note, selecting 'apache2-mpm-prefork' for task 'lamp-server'
Note, selecting 'libhtml-template-perl' for task 'lamp-server'
Note, selecting 'mysql-client-5.5' for task 'lamp-server'
Note, selecting 'libaio1' for task 'lamp-server'
Note, selecting 'mysql-common' for task 'lamp-server'
Note, selecting 'libmysqlclient18' for task 'lamp-server'
Note, selecting 'mysql-server-core-5.5' for task 'lamp-server'
Note, selecting 'libterm-readkey-perl' for task 'lamp-server'
Note, selecting 'php5-mysql' for task 'lamp-server'
Note, selecting 'apache2-data' for task 'lamp-server'
Note, selecting 'apache2' for task 'lamp-server'
Note, selecting 'php5-common' for task 'lamp-server'
Note, selecting 'php5-cli' for task 'lamp-server'
Note, selecting 'libswitch-perl' for task 'lamp-server'
Note, selecting 'libaprutil1-ldap' for task 'lamp-server'
Note, selecting 'tcpd' for task 'lamp-server'
libaio1 is already the newest version.
libapr1 is already the newest version.
libaprutil1 is already the newest version.
libaprutil1-dbd-sqlite3 is already the newest version.
libaprutil1-ldap is already the newest version.
libclass-isa-perl is already the newest version.
libdbd-mysql-perl is already the newest version.
libdbi-perl is already the newest version.
libhtml-template-perl is already the newest version.
libswitch-perl is already the newest version.
libterm-readkey-perl is already the newest version.
libwrap0 is already the newest version.
perl is already the newest version.
perl-modules is already the newest version.
ssl-cert is already the newest version.
tcpd is already the newest version.
apache2 is already the newest version.
apache2-bin is already the newest version.
apache2-data is already the newest version.
apache2-mpm-prefork is already the newest version.
libapache2-mod-php5 is already the newest version.
libmysqlclient18 is already the newest version.
mysql-client-5.5 is already the newest version.
mysql-client-core-5.5 is already the newest version.
mysql-common is already the newest version.
mysql-server is already the newest version.
mysql-server-5.5 is already the newest version.
mysql-server-core-5.5 is already the newest version.
php5-cli is already the newest version.
php5-common is already the newest version.
php5-mysql is already the newest version.
php5-readline is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 230 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: warning: 'tar' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)

root@gaja-System-Product-Name:/home/gaja# sudo apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
apache2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 230 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: warning: 'tar' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)
root@gaja-System-Product-Name:/home/gaja#


Some of the troubleshooting steps that I have taken on suggestion of other members:



$ ls -l /bin/tar
ls: cannot access /bin/tar: No such file or directory

$ apt-cache policy tar
tar: Installed: 1.26+dfsg-8 Candidate: 1.26+dfsg-8 Version table: *** 1.26+dfsg-8 0 500 in.archive.ubuntu.com/ubuntu saucy/main i386 Packages 100 /var/lib/dpkg/status


I have also tried running the following command after switching to root, but that doesn't help either:



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









share|improve this question
















bumped to the homepage by Community 1 min ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • We have consolidated all the information which was scattered around for the problem that you are facing. From now onwards, please comment below the answers to which you are replying... If it involves code then it would be better if you edit your question and format it properly.. See editing-help for more information.. AND PLEASE DO NOT OPEN ANOTHER QUESTION ON THE SAME TOPIC, AS I SAID EARLIER Edit THIS QUESTION...

    – Aditya
    Jan 6 '14 at 13:21













  • Edit the question and include sudo -i sh -c 'echo $PATH' output.

    – Braiam
    Jan 6 '14 at 13:29














3












3








3


1






I have installed the LAMP Server using the command sudo apt-get install lamp-server^. Thereafter, whenever I open the terminal the following error started to appear:



 bash: /home/gaja/.bashrccu: No such file or directory 
bash: /home/gaja/.bashrc: line 4: syntax error near unexpected token ('
bash: /home/gaja/.bashrc: line 4: see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)'


I could get rid of this problem using the answer given here.



However, now the problem is that I cannot install any thing using the sudo apt-get command.



I am trying to become root and then re-run the sudo apt-get install lamp-server^ command which gives the following error output:



dpkg: warning: 'tar' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)


Following is the complete output of running the commands:



gaja@gaja-System-Product-Name:~$ sudo su
[sudo] password for gaja:

root@gaja-System-Product-Name:/home/gaja# sudo apt-get install lamp-server^
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libdbi-perl' for task 'lamp-server'
Note, selecting 'perl-modules' for task 'lamp-server'
Note, selecting 'libaprutil1-dbd-sqlite3' for task 'lamp-server'
Note, selecting 'perl' for task 'lamp-server'
Note, selecting 'apache2-bin' for task 'lamp-server'
Note, selecting 'libapache2-mod-php5' for task 'lamp-server'
Note, selecting 'ssl-cert' for task 'lamp-server'
Note, selecting 'mysql-server-5.5' for task 'lamp-server'
Note, selecting 'mysql-client-core-5.5' for task 'lamp-server'
Note, selecting 'libclass-isa-perl' for task 'lamp-server'
Note, selecting 'mysql-server' for task 'lamp-server'
Note, selecting 'libapr1' for task 'lamp-server'
Note, selecting 'php5-readline' for task 'lamp-server'
Note, selecting 'libaprutil1' for task 'lamp-server'
Note, selecting 'libwrap0' for task 'lamp-server'
Note, selecting 'libdbd-mysql-perl' for task 'lamp-server'
Note, selecting 'apache2-mpm-prefork' for task 'lamp-server'
Note, selecting 'libhtml-template-perl' for task 'lamp-server'
Note, selecting 'mysql-client-5.5' for task 'lamp-server'
Note, selecting 'libaio1' for task 'lamp-server'
Note, selecting 'mysql-common' for task 'lamp-server'
Note, selecting 'libmysqlclient18' for task 'lamp-server'
Note, selecting 'mysql-server-core-5.5' for task 'lamp-server'
Note, selecting 'libterm-readkey-perl' for task 'lamp-server'
Note, selecting 'php5-mysql' for task 'lamp-server'
Note, selecting 'apache2-data' for task 'lamp-server'
Note, selecting 'apache2' for task 'lamp-server'
Note, selecting 'php5-common' for task 'lamp-server'
Note, selecting 'php5-cli' for task 'lamp-server'
Note, selecting 'libswitch-perl' for task 'lamp-server'
Note, selecting 'libaprutil1-ldap' for task 'lamp-server'
Note, selecting 'tcpd' for task 'lamp-server'
libaio1 is already the newest version.
libapr1 is already the newest version.
libaprutil1 is already the newest version.
libaprutil1-dbd-sqlite3 is already the newest version.
libaprutil1-ldap is already the newest version.
libclass-isa-perl is already the newest version.
libdbd-mysql-perl is already the newest version.
libdbi-perl is already the newest version.
libhtml-template-perl is already the newest version.
libswitch-perl is already the newest version.
libterm-readkey-perl is already the newest version.
libwrap0 is already the newest version.
perl is already the newest version.
perl-modules is already the newest version.
ssl-cert is already the newest version.
tcpd is already the newest version.
apache2 is already the newest version.
apache2-bin is already the newest version.
apache2-data is already the newest version.
apache2-mpm-prefork is already the newest version.
libapache2-mod-php5 is already the newest version.
libmysqlclient18 is already the newest version.
mysql-client-5.5 is already the newest version.
mysql-client-core-5.5 is already the newest version.
mysql-common is already the newest version.
mysql-server is already the newest version.
mysql-server-5.5 is already the newest version.
mysql-server-core-5.5 is already the newest version.
php5-cli is already the newest version.
php5-common is already the newest version.
php5-mysql is already the newest version.
php5-readline is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 230 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: warning: 'tar' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)

root@gaja-System-Product-Name:/home/gaja# sudo apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
apache2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 230 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: warning: 'tar' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)
root@gaja-System-Product-Name:/home/gaja#


Some of the troubleshooting steps that I have taken on suggestion of other members:



$ ls -l /bin/tar
ls: cannot access /bin/tar: No such file or directory

$ apt-cache policy tar
tar: Installed: 1.26+dfsg-8 Candidate: 1.26+dfsg-8 Version table: *** 1.26+dfsg-8 0 500 in.archive.ubuntu.com/ubuntu saucy/main i386 Packages 100 /var/lib/dpkg/status


I have also tried running the following command after switching to root, but that doesn't help either:



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









share|improve this question
















I have installed the LAMP Server using the command sudo apt-get install lamp-server^. Thereafter, whenever I open the terminal the following error started to appear:



 bash: /home/gaja/.bashrccu: No such file or directory 
bash: /home/gaja/.bashrc: line 4: syntax error near unexpected token ('
bash: /home/gaja/.bashrc: line 4: see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)'


I could get rid of this problem using the answer given here.



However, now the problem is that I cannot install any thing using the sudo apt-get command.



I am trying to become root and then re-run the sudo apt-get install lamp-server^ command which gives the following error output:



dpkg: warning: 'tar' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)


Following is the complete output of running the commands:



gaja@gaja-System-Product-Name:~$ sudo su
[sudo] password for gaja:

root@gaja-System-Product-Name:/home/gaja# sudo apt-get install lamp-server^
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libdbi-perl' for task 'lamp-server'
Note, selecting 'perl-modules' for task 'lamp-server'
Note, selecting 'libaprutil1-dbd-sqlite3' for task 'lamp-server'
Note, selecting 'perl' for task 'lamp-server'
Note, selecting 'apache2-bin' for task 'lamp-server'
Note, selecting 'libapache2-mod-php5' for task 'lamp-server'
Note, selecting 'ssl-cert' for task 'lamp-server'
Note, selecting 'mysql-server-5.5' for task 'lamp-server'
Note, selecting 'mysql-client-core-5.5' for task 'lamp-server'
Note, selecting 'libclass-isa-perl' for task 'lamp-server'
Note, selecting 'mysql-server' for task 'lamp-server'
Note, selecting 'libapr1' for task 'lamp-server'
Note, selecting 'php5-readline' for task 'lamp-server'
Note, selecting 'libaprutil1' for task 'lamp-server'
Note, selecting 'libwrap0' for task 'lamp-server'
Note, selecting 'libdbd-mysql-perl' for task 'lamp-server'
Note, selecting 'apache2-mpm-prefork' for task 'lamp-server'
Note, selecting 'libhtml-template-perl' for task 'lamp-server'
Note, selecting 'mysql-client-5.5' for task 'lamp-server'
Note, selecting 'libaio1' for task 'lamp-server'
Note, selecting 'mysql-common' for task 'lamp-server'
Note, selecting 'libmysqlclient18' for task 'lamp-server'
Note, selecting 'mysql-server-core-5.5' for task 'lamp-server'
Note, selecting 'libterm-readkey-perl' for task 'lamp-server'
Note, selecting 'php5-mysql' for task 'lamp-server'
Note, selecting 'apache2-data' for task 'lamp-server'
Note, selecting 'apache2' for task 'lamp-server'
Note, selecting 'php5-common' for task 'lamp-server'
Note, selecting 'php5-cli' for task 'lamp-server'
Note, selecting 'libswitch-perl' for task 'lamp-server'
Note, selecting 'libaprutil1-ldap' for task 'lamp-server'
Note, selecting 'tcpd' for task 'lamp-server'
libaio1 is already the newest version.
libapr1 is already the newest version.
libaprutil1 is already the newest version.
libaprutil1-dbd-sqlite3 is already the newest version.
libaprutil1-ldap is already the newest version.
libclass-isa-perl is already the newest version.
libdbd-mysql-perl is already the newest version.
libdbi-perl is already the newest version.
libhtml-template-perl is already the newest version.
libswitch-perl is already the newest version.
libterm-readkey-perl is already the newest version.
libwrap0 is already the newest version.
perl is already the newest version.
perl-modules is already the newest version.
ssl-cert is already the newest version.
tcpd is already the newest version.
apache2 is already the newest version.
apache2-bin is already the newest version.
apache2-data is already the newest version.
apache2-mpm-prefork is already the newest version.
libapache2-mod-php5 is already the newest version.
libmysqlclient18 is already the newest version.
mysql-client-5.5 is already the newest version.
mysql-client-core-5.5 is already the newest version.
mysql-common is already the newest version.
mysql-server is already the newest version.
mysql-server-5.5 is already the newest version.
mysql-server-core-5.5 is already the newest version.
php5-cli is already the newest version.
php5-common is already the newest version.
php5-mysql is already the newest version.
php5-readline is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 230 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: warning: 'tar' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)

root@gaja-System-Product-Name:/home/gaja# sudo apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
apache2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 230 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: warning: 'tar' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)
root@gaja-System-Product-Name:/home/gaja#


Some of the troubleshooting steps that I have taken on suggestion of other members:



$ ls -l /bin/tar
ls: cannot access /bin/tar: No such file or directory

$ apt-cache policy tar
tar: Installed: 1.26+dfsg-8 Candidate: 1.26+dfsg-8 Version table: *** 1.26+dfsg-8 0 500 in.archive.ubuntu.com/ubuntu saucy/main i386 Packages 100 /var/lib/dpkg/status


I have also tried running the following command after switching to root, but that doesn't help either:



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






dpkg






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 13 '17 at 12:25









Community

1




1










asked Jan 3 '14 at 11:58









rajaraja

35248




35248





bumped to the homepage by Community 1 min ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 1 min ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • We have consolidated all the information which was scattered around for the problem that you are facing. From now onwards, please comment below the answers to which you are replying... If it involves code then it would be better if you edit your question and format it properly.. See editing-help for more information.. AND PLEASE DO NOT OPEN ANOTHER QUESTION ON THE SAME TOPIC, AS I SAID EARLIER Edit THIS QUESTION...

    – Aditya
    Jan 6 '14 at 13:21













  • Edit the question and include sudo -i sh -c 'echo $PATH' output.

    – Braiam
    Jan 6 '14 at 13:29



















  • We have consolidated all the information which was scattered around for the problem that you are facing. From now onwards, please comment below the answers to which you are replying... If it involves code then it would be better if you edit your question and format it properly.. See editing-help for more information.. AND PLEASE DO NOT OPEN ANOTHER QUESTION ON THE SAME TOPIC, AS I SAID EARLIER Edit THIS QUESTION...

    – Aditya
    Jan 6 '14 at 13:21













  • Edit the question and include sudo -i sh -c 'echo $PATH' output.

    – Braiam
    Jan 6 '14 at 13:29

















We have consolidated all the information which was scattered around for the problem that you are facing. From now onwards, please comment below the answers to which you are replying... If it involves code then it would be better if you edit your question and format it properly.. See editing-help for more information.. AND PLEASE DO NOT OPEN ANOTHER QUESTION ON THE SAME TOPIC, AS I SAID EARLIER Edit THIS QUESTION...

– Aditya
Jan 6 '14 at 13:21







We have consolidated all the information which was scattered around for the problem that you are facing. From now onwards, please comment below the answers to which you are replying... If it involves code then it would be better if you edit your question and format it properly.. See editing-help for more information.. AND PLEASE DO NOT OPEN ANOTHER QUESTION ON THE SAME TOPIC, AS I SAID EARLIER Edit THIS QUESTION...

– Aditya
Jan 6 '14 at 13:21















Edit the question and include sudo -i sh -c 'echo $PATH' output.

– Braiam
Jan 6 '14 at 13:29





Edit the question and include sudo -i sh -c 'echo $PATH' output.

– Braiam
Jan 6 '14 at 13:29










3 Answers
3






active

oldest

votes


















0














The root's $PATH environment variable is not set properly, so dpkg cannot find tar to extract the packages.



Try the following after switchung to root:



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


And then run the apt-get command again.






share|improve this answer



















  • 1





    I tried your solution but still the same problem exist

    – raja
    Jan 4 '14 at 9:10



















0














From your question and the following comments it is clear that tar is installed but the executable /bin/tar is missing. You need to add it manually as your dpkg will not work without tar.



First check the following files are already there,



ls -l /etc/rmt
ls -l /usr/lib/mime/packages/tar
ls -l /usr/sbin/rmt-tar
ls -l /usr/sbin/tarcat


I am not listing doc and man files. A complete list can be found here.



You can download the .deb package for tar manually from packages.ubuntu.com. Download the exact package for your architecture.



Next extract the .deb file in a system where archive manager is available. If you extract the .deb file there will be a directory named bin under the main directory. you need to Copy the executable tar from extracted bin directory to /bin/.



You can first put the executable tar to your home directory. Next use the following in terminal to copy it to /bin,



sudo cp tar /bin/
sudo chmod 755 /bin/tar


just check the owner of /bin/tar is root. and it must have execution permission for all. The output of ls -l /bin/tar should look like,



-rwxr-xr-x 1 root root ...


This should work. you may need to install the suggested packages if not installed already.






share|improve this answer
























  • Sorry, I Couldn't extract the deb file into tar file.

    – raja
    Jan 7 '14 at 6:42











  • try to extract the deb file on another computer. then bring the expanded folder to your computer using a flash drive or sftp.

    – souravc
    Jan 7 '14 at 7:03





















0














I had a similar error while trying to do a distribution upgrade from Debian Squeeze to Wheezy (I know this is a Ubuntu Stack Exchange, but my solution may work for you). Here is the command I executed when I received the error:



sudo apt-get dist-upgrade


Here is part of the error:



dpkg: 3 expected programs not found in PATH or not executable.


I changed to the root user with the following command and tried again:



su root
apt-get dist-upgrade


And the installation succeeded without error.






share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f399438%2fhow-to-solve-dpkg-error-1-expected-program-not-found-in-path-or-not-executabl%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The root's $PATH environment variable is not set properly, so dpkg cannot find tar to extract the packages.



    Try the following after switchung to root:



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


    And then run the apt-get command again.






    share|improve this answer



















    • 1





      I tried your solution but still the same problem exist

      – raja
      Jan 4 '14 at 9:10
















    0














    The root's $PATH environment variable is not set properly, so dpkg cannot find tar to extract the packages.



    Try the following after switchung to root:



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


    And then run the apt-get command again.






    share|improve this answer



















    • 1





      I tried your solution but still the same problem exist

      – raja
      Jan 4 '14 at 9:10














    0












    0








    0







    The root's $PATH environment variable is not set properly, so dpkg cannot find tar to extract the packages.



    Try the following after switchung to root:



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


    And then run the apt-get command again.






    share|improve this answer













    The root's $PATH environment variable is not set properly, so dpkg cannot find tar to extract the packages.



    Try the following after switchung to root:



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


    And then run the apt-get command again.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jan 3 '14 at 12:10









    chaoschaos

    19.9k86068




    19.9k86068








    • 1





      I tried your solution but still the same problem exist

      – raja
      Jan 4 '14 at 9:10














    • 1





      I tried your solution but still the same problem exist

      – raja
      Jan 4 '14 at 9:10








    1




    1





    I tried your solution but still the same problem exist

    – raja
    Jan 4 '14 at 9:10





    I tried your solution but still the same problem exist

    – raja
    Jan 4 '14 at 9:10













    0














    From your question and the following comments it is clear that tar is installed but the executable /bin/tar is missing. You need to add it manually as your dpkg will not work without tar.



    First check the following files are already there,



    ls -l /etc/rmt
    ls -l /usr/lib/mime/packages/tar
    ls -l /usr/sbin/rmt-tar
    ls -l /usr/sbin/tarcat


    I am not listing doc and man files. A complete list can be found here.



    You can download the .deb package for tar manually from packages.ubuntu.com. Download the exact package for your architecture.



    Next extract the .deb file in a system where archive manager is available. If you extract the .deb file there will be a directory named bin under the main directory. you need to Copy the executable tar from extracted bin directory to /bin/.



    You can first put the executable tar to your home directory. Next use the following in terminal to copy it to /bin,



    sudo cp tar /bin/
    sudo chmod 755 /bin/tar


    just check the owner of /bin/tar is root. and it must have execution permission for all. The output of ls -l /bin/tar should look like,



    -rwxr-xr-x 1 root root ...


    This should work. you may need to install the suggested packages if not installed already.






    share|improve this answer
























    • Sorry, I Couldn't extract the deb file into tar file.

      – raja
      Jan 7 '14 at 6:42











    • try to extract the deb file on another computer. then bring the expanded folder to your computer using a flash drive or sftp.

      – souravc
      Jan 7 '14 at 7:03


















    0














    From your question and the following comments it is clear that tar is installed but the executable /bin/tar is missing. You need to add it manually as your dpkg will not work without tar.



    First check the following files are already there,



    ls -l /etc/rmt
    ls -l /usr/lib/mime/packages/tar
    ls -l /usr/sbin/rmt-tar
    ls -l /usr/sbin/tarcat


    I am not listing doc and man files. A complete list can be found here.



    You can download the .deb package for tar manually from packages.ubuntu.com. Download the exact package for your architecture.



    Next extract the .deb file in a system where archive manager is available. If you extract the .deb file there will be a directory named bin under the main directory. you need to Copy the executable tar from extracted bin directory to /bin/.



    You can first put the executable tar to your home directory. Next use the following in terminal to copy it to /bin,



    sudo cp tar /bin/
    sudo chmod 755 /bin/tar


    just check the owner of /bin/tar is root. and it must have execution permission for all. The output of ls -l /bin/tar should look like,



    -rwxr-xr-x 1 root root ...


    This should work. you may need to install the suggested packages if not installed already.






    share|improve this answer
























    • Sorry, I Couldn't extract the deb file into tar file.

      – raja
      Jan 7 '14 at 6:42











    • try to extract the deb file on another computer. then bring the expanded folder to your computer using a flash drive or sftp.

      – souravc
      Jan 7 '14 at 7:03
















    0












    0








    0







    From your question and the following comments it is clear that tar is installed but the executable /bin/tar is missing. You need to add it manually as your dpkg will not work without tar.



    First check the following files are already there,



    ls -l /etc/rmt
    ls -l /usr/lib/mime/packages/tar
    ls -l /usr/sbin/rmt-tar
    ls -l /usr/sbin/tarcat


    I am not listing doc and man files. A complete list can be found here.



    You can download the .deb package for tar manually from packages.ubuntu.com. Download the exact package for your architecture.



    Next extract the .deb file in a system where archive manager is available. If you extract the .deb file there will be a directory named bin under the main directory. you need to Copy the executable tar from extracted bin directory to /bin/.



    You can first put the executable tar to your home directory. Next use the following in terminal to copy it to /bin,



    sudo cp tar /bin/
    sudo chmod 755 /bin/tar


    just check the owner of /bin/tar is root. and it must have execution permission for all. The output of ls -l /bin/tar should look like,



    -rwxr-xr-x 1 root root ...


    This should work. you may need to install the suggested packages if not installed already.






    share|improve this answer













    From your question and the following comments it is clear that tar is installed but the executable /bin/tar is missing. You need to add it manually as your dpkg will not work without tar.



    First check the following files are already there,



    ls -l /etc/rmt
    ls -l /usr/lib/mime/packages/tar
    ls -l /usr/sbin/rmt-tar
    ls -l /usr/sbin/tarcat


    I am not listing doc and man files. A complete list can be found here.



    You can download the .deb package for tar manually from packages.ubuntu.com. Download the exact package for your architecture.



    Next extract the .deb file in a system where archive manager is available. If you extract the .deb file there will be a directory named bin under the main directory. you need to Copy the executable tar from extracted bin directory to /bin/.



    You can first put the executable tar to your home directory. Next use the following in terminal to copy it to /bin,



    sudo cp tar /bin/
    sudo chmod 755 /bin/tar


    just check the owner of /bin/tar is root. and it must have execution permission for all. The output of ls -l /bin/tar should look like,



    -rwxr-xr-x 1 root root ...


    This should work. you may need to install the suggested packages if not installed already.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jan 6 '14 at 10:11









    souravcsouravc

    28.1k1378109




    28.1k1378109













    • Sorry, I Couldn't extract the deb file into tar file.

      – raja
      Jan 7 '14 at 6:42











    • try to extract the deb file on another computer. then bring the expanded folder to your computer using a flash drive or sftp.

      – souravc
      Jan 7 '14 at 7:03





















    • Sorry, I Couldn't extract the deb file into tar file.

      – raja
      Jan 7 '14 at 6:42











    • try to extract the deb file on another computer. then bring the expanded folder to your computer using a flash drive or sftp.

      – souravc
      Jan 7 '14 at 7:03



















    Sorry, I Couldn't extract the deb file into tar file.

    – raja
    Jan 7 '14 at 6:42





    Sorry, I Couldn't extract the deb file into tar file.

    – raja
    Jan 7 '14 at 6:42













    try to extract the deb file on another computer. then bring the expanded folder to your computer using a flash drive or sftp.

    – souravc
    Jan 7 '14 at 7:03







    try to extract the deb file on another computer. then bring the expanded folder to your computer using a flash drive or sftp.

    – souravc
    Jan 7 '14 at 7:03













    0














    I had a similar error while trying to do a distribution upgrade from Debian Squeeze to Wheezy (I know this is a Ubuntu Stack Exchange, but my solution may work for you). Here is the command I executed when I received the error:



    sudo apt-get dist-upgrade


    Here is part of the error:



    dpkg: 3 expected programs not found in PATH or not executable.


    I changed to the root user with the following command and tried again:



    su root
    apt-get dist-upgrade


    And the installation succeeded without error.






    share|improve this answer




























      0














      I had a similar error while trying to do a distribution upgrade from Debian Squeeze to Wheezy (I know this is a Ubuntu Stack Exchange, but my solution may work for you). Here is the command I executed when I received the error:



      sudo apt-get dist-upgrade


      Here is part of the error:



      dpkg: 3 expected programs not found in PATH or not executable.


      I changed to the root user with the following command and tried again:



      su root
      apt-get dist-upgrade


      And the installation succeeded without error.






      share|improve this answer


























        0












        0








        0







        I had a similar error while trying to do a distribution upgrade from Debian Squeeze to Wheezy (I know this is a Ubuntu Stack Exchange, but my solution may work for you). Here is the command I executed when I received the error:



        sudo apt-get dist-upgrade


        Here is part of the error:



        dpkg: 3 expected programs not found in PATH or not executable.


        I changed to the root user with the following command and tried again:



        su root
        apt-get dist-upgrade


        And the installation succeeded without error.






        share|improve this answer













        I had a similar error while trying to do a distribution upgrade from Debian Squeeze to Wheezy (I know this is a Ubuntu Stack Exchange, but my solution may work for you). Here is the command I executed when I received the error:



        sudo apt-get dist-upgrade


        Here is part of the error:



        dpkg: 3 expected programs not found in PATH or not executable.


        I changed to the root user with the following command and tried again:



        su root
        apt-get dist-upgrade


        And the installation succeeded without error.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 30 '14 at 12:37









        thohlthohl

        1012




        1012






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f399438%2fhow-to-solve-dpkg-error-1-expected-program-not-found-in-path-or-not-executabl%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            香粉寮

            GameSpot