dev-resources.site
for different kinds of informations.
bash: No such file or directory
I am using KDE Neon as my daily driver on my laptop. Recently due to KDE Neon update 6.0, there have been many bugs, but one as annoying as the one I faced the other day.
After system update, my bash stopped working completely. Granted I use zsh as my shell, bash is required by many programs on Linux. But everytime, I opened any such program, say pyenv, it just wouldn't work and give following error
/usr/bin/env: ‘bash’: No such file or directory linux
I looked into /usr/bin and couldn't find bash there. I couldn't install bash using dpkg or apt. This was pretty perplexing for me. Here is how I resolved the error with bash.
First of all, I edited the file /var/lib/dpkg/info/bash.prerm and changed first line to #! /bin/sh
from #! /bin/bash
#! /bin/sh
set -e
case "$1" in
   upgrade)
       update-alternatives --remove builtins.7.gz \
           /usr/share/man/man7/bash-builtins.7.gz
       ;;
   remove|deconfigure)
       ;;
   failed-upgrade)
       ;;
   *)
       echo "prerm called with unknown argument \`$1'" >&2
       exit 1
       ;;
esac
Next I looked into /var/cache/apt/archives/ and found the file bash_5.1-6ubuntu1.1_amd64.deb
. If you cannot find this file, you can download from here
Next I ran the command
sudo dpkg --force-remove-reinstreq -i /var/cache/apt/archives/bash_5.1-6ubuntu1.1_amd64.deb
This helped me restore the bash and helped me run programs again.
Featured ones: