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

Could not execute process - Access is denied #10715

Closed
robins opened this issue May 29, 2022 · 5 comments
Closed

Could not execute process - Access is denied #10715

robins opened this issue May 29, 2022 · 5 comments
Labels
C-bug Category: bug

Comments

@robins
Copy link

robins commented May 29, 2022

Problem

This is a re-open for #2306 . Opening a new report as indicated therein.

I can reproduce the error and have pasted the last few lines of the backtrace here... but basically I recently started learning rust and cargo run did work pretty okay till last week and since then I get this persistent access is denied is putting me off. A few things that may help:

  • Windows 10 - 19042.1706
  • OS not restarted for a few weeks
  • Tried crashing / restarting Explorer as indicated in a comment in the above Issue, but that didn't help.
  • I see that it could not execute the EXE file, but I can confirm that it doesn't even create the exe file
  • I tried this on two different projects and both showed the (exact) same error.
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
[2022-05-29T13:15:59Z TRACE cargo::util::config] get cv ConfigKey { env: "CARGO_FUTURE_INCOMPAT_REPORT", parts: [("future-incompat-report", 5)] }
[2022-05-29T13:15:59Z TRACE cargo::util::config] get cv ConfigKey { env: "CARGO_ENV", parts: [("env", 5)] }
     Running `target\debug\t.exe`
[2022-05-29T13:15:59Z DEBUG cargo] exit_with_error; err=CliError { error: Some(could not execute process `target\debug\t.exe` (never executed)
    
    Caused by:
        Access is denied. (os error 5)
    
    Stack backtrace:
       0: git_midx_writer_dump
       1: git_midx_writer_dump
       2: git_midx_writer_dump
       3: git_midx_writer_dump
       4: git_filter_source_path
       5: <unknown>
       6: <unknown>
       7: <unknown>
       8: <unknown>
       9: <unknown>
      10: git_midx_writer_dump
      11: <unknown>
      12: git_midx_writer_dump
      13: BaseThreadInitThunk
      14: RtlUserThreadStart), exit_code: 101 }
[2022-05-29T13:15:59Z DEBUG cargo] display_error; err=could not execute process `target\debug\t.exe` (never executed)
    
    Caused by:
        Access is denied. (os error 5)
    
    Stack backtrace:
       0: git_midx_writer_dump
       1: git_midx_writer_dump
       2: git_midx_writer_dump
       3: git_midx_writer_dump
       4: git_filter_source_path
       5: <unknown>
       6: <unknown>
       7: <unknown>
       8: <unknown>
       9: <unknown>
      10: git_midx_writer_dump
      11: <unknown>
      12: git_midx_writer_dump
      13: BaseThreadInitThunk
      14: RtlUserThreadStart
error: could not execute process `target\debug\t.exe` (never executed)

Caused by:
  Access is denied. (os error 5)

Original Error

c:\proj\rust1\t>cat src\main.rs
fn main() {
    println!("Hello, world!");
}

c:\proj\rust1\t>cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
     Running `target\debug\t.exe`
error: could not execute process `target\debug\t.exe` (never executed)

Caused by:
  Access is denied. (os error 5)

Steps

  • Basic Hello World program (see issue Description)
  • Cargo run

Possible Solution(s)

No response

Notes

No response

Version

No response

@robins robins added the C-bug Category: bug label May 29, 2022
@ehuss
Copy link
Contributor

ehuss commented May 29, 2022

Do you have any sort of anti-virus installed? That is a usual culprit. You may want to check if the executable has been quarantined if it doesn't even appear to exist.

@John15321
Copy link

@robins are you using powershell? That may be the problem. I think you need to configure it to run certain things

@ehuss
Copy link
Contributor

ehuss commented Jul 4, 2022

I'm going to close as I do not think this is an issue specific to cargo, and there isn't enough information here to know more about what might be causing your issue. I'm sorry you're having a difficult experience, I know it can be frustrating. I suspect this is related to some background process like Defender or an anti-virus system.

Unfortunately I do not believe Windows provides any more information about "access denied" errors, so I don't think there is much more cargo can display here.

If you continue to have problems and can't diagnose it, I recommend trying one of the user forums (like https://users.rust-lang.org/) for more help.

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale Jul 4, 2022
@glaucomorais
Copy link

Do you have any sort of anti-virus installed? That is a usual culprit. You may want to check if the executable has been quarantined if it doesn't even appear to exist.

That was my case. Kaspersky flag build-script-build.exe as a trojan.

@123Brijesh44aa
Copy link

I am using linux mint 22, and was facing the same problem but the main issue was with the file system. The file system of my partition was fat32. So I changed it to ext4 and now there is no issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

5 participants