终端开始给出错误bash:/ usr / bin / lesspipe

我搜索并阅读了所有可能的页面,但我找不到确切的问题。

当我打开终端时,我得到:

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

然后当我使用apt-get update我遇到了以下错误。

 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 

有没有人知道为什么会发生这个错误,我该如何解决?

出于某种原因,你没有/bin/sh 。 这可能意味着系统中的许多内容也可能是错误的,但只是针对此特定问题,您可以重新创建符号链接:

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

如果/bin/sh存在,但是它有问题,请执行以下操作:

 sudo ln -sf /bin/dash /bin/sh