0

I searched and read all possible pages here but I could not find the exact problem.

When I open my terminal I am getting:

bash: /usr/bin/lesspipe: /bin/sh: bad interpreter: No such file or directory

then when I use apt-get update I am getting following errors.

Fetched 39,9 MB in 53s (747 kB/s)                                              
Reading package lists. . .  Done
W: GPG error: http://archive. canonical.com/ubuntu xenial InRelease: Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: The repository 'http://archive.canonical.com/ubuntu xenial InRelease' is not signed. 
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use. 
N: See apt-secure(8) manpage for repository creation and user configuration details. 
W: GPG error: http://ppa.launchpad.net/nijel/phpmyadmin/ubuntu xenial InRelease: Could not execute 'apt-key' to verify signature (is gnupg installed?)
.......
W: The repository 'http://us.archive.ubuntu.com/ubuntu xenial-security InRelease' is not signed. 
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use. 
N: See apt-secure(8) manpage for repository creation and user configuration details. 
E: Problem executing scripts APT::Update::Post-Invoke-Success 'touch /var/lib/apt/periodic/update-success-stamp 2>/dev/null || true'
E: Sub-process returned an error code




$ namei -lx /bin/sh
f: /bin/sh
Drwxr-xr-x root root /
drwxr-xr-x root root bin
                     sh - No such file or directory

Does any one know why this error occurred and how can I solve it?

muru
  • 197,895
  • 55
  • 485
  • 740
melic
  • 390

2 Answers2

2

I solved my problem on Windows 10 Pro Bash for Windows. I selected Ubuntu 18.04 LTS.

Symptom: get the error message "bash: /usr/bin/lesspipe: /bin/sh: bad interpreter: No such file or directory" when opening an Ubuntu shell. This did not happen immediately when I installed it, but appeared after I rebooted my Windows (version 10.0.18363).

I tracked the problem down to /bin/dash which does not exist. I fixed the problem with:

# use bash as a temporary dash
cd /bin
sudo cp bash dash
# reinstall dash
sudo apt-get install --reinstall dash
Gerald
  • 21
2

For some reason, you don't have /bin/sh. This might mean a lot of things in your system could also be wrong, but just for this particular problem, you can recreate the symlink:

sudo ln -s /bin/dash /bin/sh

If /bin/sh exists, but something is wrong with it, do:

sudo ln -sf /bin/dash /bin/sh
muru
  • 197,895
  • 55
  • 485
  • 740
  • ok error type changed now I am getting errors like W: GPG error: http://ppa.launchpad.net/plushuang-tw/uget-stable/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8BE3EAB5EBE14A20 . – melic Apr 07 '17 at 08:12
  • @melic see http://askubuntu.com/a/386003/158442 – muru Apr 07 '17 at 08:15
  • I already tried that solution before my post here but it didn't work me; now I will re try and let you know – melic Apr 07 '17 at 08:18
  • Thank you @muru my problem fixed; also I think many people should also check \bin\sh who knows it may fix apt update issue as like as in my issue.best regards – melic Apr 07 '17 at 08:33