Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New install: /usr/bin/bash: Exit 126. Failed to run '/usr/bin/bash': No such file or directory #1661

Closed
sdbbs opened this issue May 28, 2019 · 12 comments
Labels
external Issues caused by external software or project

Comments

@sdbbs
Copy link

sdbbs commented May 28, 2019

Might be similar to #1491 - but different from there, this is about a new install on 64-bit Windows 7 Professional.

I just downloaded the latest installer, http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20190524.exe and run it. After the installer completes, I choose "Run MSYS2 now". As soon as the terminal opens, I am greeted with the message:

/usr/bin/bash: Exit 126. 
Failed to run '/usr/bin/bash': No such file or directory

MSYS2_failedrun

I close the terminal, reopen MSYS2 MSYS terminal, the same happens.

Tried to uninstall, reinstall - same happens.

Strange thing is, the folder exists - but indeed, there is no bash.exe there:

C:\msys64\usr\bin>dir *
...
25-04-2019  12:36            67.646 [.exe
             504 File(s)    149.482.946 bytes
               2 Dir(s)  73.340.100.608 bytes free

C:\msys64\usr\bin>dir bas*
 Volume in drive C has no label.
 Volume Serial Number is CE6A-1F8B

 Directory of C:\msys64\usr\bin

25-04-2019  12:36            37.598 base32.exe
25-04-2019  12:36            37.598 base64.exe
25-04-2019  12:36            32.159 basename.exe
25-04-2019  12:36            45.790 basenc.exe
30-10-2018  07:09             6.977 bashbug
               5 File(s)        160.122 bytes
               0 Dir(s)  73.339.695.104 bytes free

I'm kind of puzzled, since I've installed MSYS2 at least some 10 times in the past year, and never experienced this problem?! Is there a workaround for something like this?


EDIT: Just tried an earlier version of the installer, http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20190523.exe - and that one does install with bash.exe, but at first run after installation, it says:

bash: chmod: command not found
bash: chmod: command not found
bash: grep: command not found

user@PC MSYS ~
$

msys2_chmod

However, this is not much, as the very first pacman -Syu update cannot complete:

user@PC MSYS ~
$ pacman -Syu
warning: Public keyring not found; have you run 'pacman-key --init'?
error: GPGME error: Invalid crypto engine
warning: Public keyring not found; have you run 'pacman-key --init'?
error: GPGME error: Invalid crypto engine
warning: Public keyring not found; have you run 'pacman-key --init'?
error: GPGME error: Invalid crypto engine
:: Synchronizing package databases...
 mingw32                  549.1 KiB   967K/s 00:01 [#####################] 100%
 mingw32.sig              119.0   B   116K/s 00:00 [#####################] 100%
warning: Public keyring not found; have you run 'pacman-key --init'?
error: GPGME error: Invalid crypto engine
error: failed to update mingw32 (invalid or corrupted database (PGP signature))
 mingw64                  550.2 KiB  1944K/s 00:00 [#####################] 100%
 mingw64.sig              119.0   B  0.00B/s 00:00 [#####################] 100%
warning: Public keyring not found; have you run 'pacman-key --init'?
error: GPGME error: Invalid crypto engine
error: failed to update mingw64 (invalid or corrupted database (PGP signature))
 msys                     180.4 KiB  17.6M/s 00:00 [#####################] 100%
 msys.sig                 119.0   B  0.00B/s 00:00 [#####################] 100%
warning: Public keyring not found; have you run 'pacman-key --init'?
error: GPGME error: Invalid crypto engine
error: failed to update msys (invalid or corrupted database (PGP signature))
error: failed to synchronize all databases

user@PC MSYS ~
$ pacman-key --init
bash: /usr/bin/pacman-key: /usr/bin/env: bad interpreter: No such file or directory

EDIT: just tried an even earlier installer - http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20181211.exe ; on the surface, it installs fine - except that it gives me # as prompt (number/hash sign), not $ as usual (dollar sign) - and the first pacman -Syu update passes; but as soon as I reopen terminal, and try to run pacman -Syu again, it fails the same as it did previously:

user@PC MINGW64 ~
# pacman -Syu
error: GPGME error: Invalid crypto engine
error: GPGME error: Invalid crypto engine
error: GPGME error: Invalid crypto engine
:: Synchronizing package databases...
 mingw32                  549.1 KiB   884K/s 00:01 [#####################] 100%
 mingw32.sig              119.0   B  0.00B/s 00:00 [#####################] 100%
error: GPGME error: Invalid crypto engine
error: failed to update mingw32 (invalid or corrupted database (PGP signature))
 mingw64                  550.2 KiB  1965K/s 00:00 [#####################] 100%
 mingw64.sig              119.0   B   116K/s 00:00 [#####################] 100%
error: GPGME error: Invalid crypto engine
error: failed to update mingw64 (invalid or corrupted database (PGP signature))
 msys                     180.4 KiB  16.0M/s 00:00 [#####################] 100%
 msys.sig                 119.0   B   116K/s 00:00 [#####################] 100%
error: GPGME error: Invalid crypto engine
error: failed to update msys (invalid or corrupted database (PGP signature))
error: failed to synchronize all databases

Uninstalled this version - but now I can see C:\msys64 folder is still present, and when I double-click it to enter it in explorer, I'm told:

[Window Title]
Location is not available

[Content]
C:\msys64 is not accessible.

Access is denied.
[OK]
@sdbbs sdbbs changed the title New install: /usr/bin/bash: Exit 126. Failed to run '/usr/bin/bash': Exec format error New install: /usr/bin/bash: Exit 126. Failed to run '/usr/bin/bash': No such file or directory May 28, 2019
@oscarfv
Copy link

oscarfv commented May 28, 2019

Please check your antivirus log. And also the OS event viewer looking for filesystem failures. Maybe your HDD/SSD is failing.

@xinpeiguo
Copy link

Please check your antivirus log. And also the OS event viewer looking for filesystem failures. Maybe your HDD/SSD is failing.

Nothing to do with that

@cdqncn
Copy link

cdqncn commented Nov 6, 2020

怎么解决呢?答主有解决方法了吗

@C-Sharpener
Copy link

C-Sharpener commented Nov 13, 2020

The same here.
Also, during the installation, I almost got a virus.
Who the hxxx is maintaining MSYS2???
|
v
Sorry, I was wrong.
The cause of this issue was that Avast antivirus wrongly detected bash as a virus (false-positive).
Stop Avast antivirus (or similar) for 10 minutes and reinstall MSYS2.
It should work.
You might want to read this.

@code-cody-418
Copy link

Same Avast antivirus put my bash file into quarantine. Thank you

@nardo1285
Copy link

Same here! But luckily, I checked de quarantine files from Avast, and there was my Bash file. So I re-established the file, with an exception from the antivirus console, and it's working just fine! :)

@Pleizz
Copy link

Pleizz commented Feb 8, 2022

Same here! But luckily, I checked de quarantine files from Avast, and there was my Bash file. So I re-established the file, with an exception from the antivirus console, and it's working just fine! :)

Thank You So Much!!
Avast isolated bash.exe!!

@Biswa96
Copy link
Member

Biswa96 commented Feb 8, 2022

So, the cause of this issue is antivirus software. Can this issue be closed now?

@Biswa96 Biswa96 added the external Issues caused by external software or project label Feb 8, 2022
@Pleizz
Copy link

Pleizz commented Feb 8, 2022

So, the cause of this issue is antivirus software. Can this issue be closed now?

Exactly.

@Biswa96 Biswa96 closed this as completed Feb 8, 2022
@AashiqMd
Copy link

Yeah, I had the same issue with mine. AVG put it in quarantine. I restored it and added it as an exception.

@noob261
Copy link

noob261 commented Jun 19, 2023

I try to remove my original installation folder and reinstall in a different folder. It works.

@VerzatileDev
Copy link

VerzatileDev commented Jan 14, 2024

My opinion on the take is that, you should uninstall Avast as the free version would not benefit you more than the default Anti-virus system " windows protection ", though if there is a segnificant need to keep it.

Steps:

  1. Open Avast anti virus software
  2. Locate Menu -> click
  3. Locate tools -> under tools there is a section (Quarantine)
  4. The Bash file will be there, right click on it and " Add exception and allow "

You can now Retry the installation and it should work as intended and setup will be done properly.

Note if it did not fix the issue on the first time, locate your msys64 folder, should be under your C:// drive as a folder open the folder and locate uninstall, which removes the entire installation, and then redo the installer, upon which if it fails to install with the pop up of retry follow the steps on anti virus, and then click retry.

No need to disable the Virus protection.

Best of luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external Issues caused by external software or project
Projects
None yet
Development

No branches or pull requests