I deleted the /bin/bash file on my manjaro instalation

luckily my login shell is zsh so i can still use the system, and i can still use most of manjaros features and apps, but pacman is’nt working, and neither is yay on snapd. How do get /bin/bash back? will i have to compile it from source or something

this got way more traction than i was expecting, and it is very embarrasing lmao! thanks for everyone who helped solve-!
the solution was

(look in the pacman cache to see if the package containing bash is still present)
`ls -al /var/cache/pacman/pkg/bash*.zst

(then use this to unpack the archive)
tar -xzf /var/cache/pacman/pkg/bash-5.2.026-2-x86_64.pkg.tar.zst

thank you to Nachlese for helping me, and giving me the solution i ended up using,
even though it was supposed to be as easy as “sudo pacman -S bash”

this was a very humbling experience lmao

sudo pacman -S bash

I presume you mean /bin/bash; Uninstall bash and reinstall it:

sudo pacman -R bash
sudo pacman -S bash

It’s likely that simple. Cheers.

Restore it from your last backup. Simple as that.

Look in the pacman cache whether the package containing it is still there:

ls -al /var/cache/pacman/pkg/bash*.zst

unpack the archive
tar -xvf bash-5.2.026-2-x86_64.pkg.tar.zst

find in resulting structure /usr/bin/bash and copy it where it belongs

It’s easy to do when you boot from USB.
No need to chroot.

i typed /bin/bin by mistake, but when i tried to edit it it gave an error so i gave up

and sadly, pacman doesnt work without bash so that doesnt work :frowning:
neither does yay or snapd or pamac.

but thanks thoughhh!

   /usr/bin  ls -al /var/cache/pacman/pkg/bash*.zst
-rw-r–r-- 1 root root 2364392 Jan 23 23:27 /var/cache/pacman/pkg/bash-5.2.026-2-x86_64.pkg.tar.zst

   /usr/bin  tar -xvf bash-5.2.026-2-x86_64.pkg.tar.zst
tar: bash-5.2.026-2-x86_64.pkg.tar.zst: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

funnily enough, i think unpacking bash may rely on bash :frowning:
thanks for helping thoughh!

Use a zsh shell, perhaps; though from your description you have done more than delete /bin/bash – How did you delete it?

zsh
sudo pacman -R bash
sudo pacman -S bash

Pacman does not rely on bash.

A possible workaround is to install a Terminal emulator that defaults to zsh, via Pamac-Manager (GUI) (Add/Remove Software), and then perform the previous pacman commands.

Yakuaka comes to mind, if you’re using KDE.

You don’t need to be sosmorttt to follow the logic.

and when i deleted it i was trying to delete /usr/bin/ssh because i don’t really have any use for ssh, but out of habit, after typing /bin i switched around ssh and bash :frowning:

about that…

no.
You have the file - but the command to unpack it was without the full path.
Think!

tar -xzf /var/cache/pacman/pkg/bash-5.2.026-2-x86_64.pkg.tar.zst
for example - then you’ll find your bash in /var/cache/pacman/pkg/usr/bin/bash
the command will unpack the file into the current directory - be aware which directory you are in when you run it
I’d copy it to a directory in my $HOME and then unpack it there.

The easiest way is:
cd /
tar -xzf /var/cache/pacman/pkg/bash-5.2.026-2-x86_64.pkg.tar.zst
but this will then replace a lot more, not just /usr/bin/bash

The other possibility is: boot from USB and do it using the tools you know - the graphical file manager

Note the addition to my previous post.

or download the bash install file, or extract what you need from one of the Manjaro mirrors (core) and install it?

List of Manjaro mirrors:

https://repo.manjaro.org/

Is /usr/bin/bash available?

if yes, you can copy it to /bin/bash

Unfortunately for OP, /bin is installed as a symlink to /usr/bin in Manjaro.

If nothing else works, i guess he can just copy it from a live CD?

/bin is a symlink to /usr/bin

ls -al /bin
lrwxrwxrwx 1 root root 7 Jan 19 19:16 /bin -> usr/bin

bash exists in only one place …

Oh yes, I forgot that

You should NEVER manually remove a file owned by a package. Remove the package using pacman/pamac ONLY IF nothing else depends on it.

I sometimes wonder how such people survive in real life.
“I do not know what this wire in the engine bay of my car does, i “do not use it”…let’s cut it out! Probably not important…”