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

May 6th 2022: Latest Visual Studio Code Update fails #148953

Closed
dipakboyed opened this issue May 6, 2022 · 25 comments
Closed

May 6th 2022: Latest Visual Studio Code Update fails #148953

dipakboyed opened this issue May 6, 2022 · 25 comments
Assignees

Comments

@dipakboyed
Copy link


Visual Studio Code

There was an error while Opening file handle: "...\AppData\Local\Programs\Microsoft VS Code\resources\app\out\bootstrap-amd.js":
Failed to create file handle: Access is denied.
Please verify there are no Visual Studio Code processes still executing.

Retry Cancel

Latest Vs Code updater fails for me on Windows11. I can't see any handle open for this file elsewhere.

@jsuddsjr
Copy link

jsuddsjr commented May 6, 2022

Failed on Windows 10, too. I also tried installing Visual Studio Insiders, with the same result. I ended up downloading the full installer and reinstalling to get around it.

@lovettchris
Copy link
Member

I get the same thing also, I notice the file does not have user write permissions, only admin write permissions:
image

@yonghenghuanmie
Copy link

Same problem on windows11.
"May 07 18:46:37.177 INFO Get file handle: "C:\Users\huanmie\AppData\Local\Programs\Microsoft VS Code\bin\code" (attempt 16)"
In fact this file is not in use, I can even delete it.
This problem continues even after restart.

@lansalot
Copy link

lansalot commented May 9, 2022

+1 I'm afraid - Fixed by removing the entire "C:\Users\$USER\AppData\Local\Programs\Microsoft VS Code" folder and re-installing. Same file permissions were missing too.

@hediet hediet assigned joaomoreno and unassigned hediet May 9, 2022
@XVII
Copy link

XVII commented May 10, 2022

I've had this issue too. Affecting my fleet of VS Code users.

Added some discussion here for a similar issue: https://stackoverflow.com/a/72180048/168457. Had to grant users permissions to their AppData directory.

@amcasey
Copy link
Member

amcasey commented May 10, 2022

@joaomoreno Let me know if you need an internal repro

@TheJCAB
Copy link
Member

TheJCAB commented May 10, 2022

May be a clue. I just tried running the installer as admin, and it says this:

image

That installer has a date of today, so it's the one that was being used. But... when I click ok, I then get this:

image

Indicating that VSCode is "system-installed". Note that the user installer is being offered by VSCode itself, just after launching it. So it might be some indication that it doesn't know how to system-update itself? Not sure.

Clicking ok again (after making sure VSCode itself, or its installer, is not running - sigh!) proceeded with the installation just fine.

I don't remember installing it any differently before (to get it system-installed vs. user-installed), but my memory is slowly fading, so it could be :-).

@XVII
Copy link

XVII commented May 11, 2022

Our users sometimes have to run VS Code as admin on occasion for system-focused development. Perhaps it ran a self-update during that time which caused permissions to be lost and instead assigned to Admin group only?

@michael-hawker
Copy link

michael-hawker commented May 13, 2022

I've also started hitting this the other day. Just rebooted and still hit it.

The end of the log has:

May 13 14:32:28.014 INFO Get file handle: "C:\\Users\\...\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\out\\bootstrap-amd.js" (attempt 16)
May 13 14:35:06.358 ERRO Failed to create file handle: Access is denied.

@lovettchris
Copy link
Member

lovettchris commented May 13, 2022 via email

@michael-hawker
Copy link

I was able to run the uninstaller and it seemed to wipe that directory clean as well. Installing from the latest download on the website for 1.67.1 worked after that. Will see when it tries to update next what happens.

@ant0nsc
Copy link

ant0nsc commented May 17, 2022

Our users sometimes have to run VS Code as admin on occasion for system-focused development. Perhaps it ran a self-update during that time which caused permissions to be lost and instead assigned to Admin group only?

@ShadowXVII , I have never used VSCode with admin permissions before, but I'm hitting exactly the same error.

@XVII
Copy link

XVII commented May 17, 2022

Our users sometimes have to run VS Code as admin on occasion for system-focused development. Perhaps it ran a self-update during that time which caused permissions to be lost and instead assigned to Admin group only?

@ShadowXVII , I have never used VSCode with admin permissions before, but I'm hitting exactly the same error.

Ah, there goes that theory then. Haven't found any other possible pattern between.

@devlie
Copy link
Member

devlie commented May 17, 2022

Those files that vscode installer was complaining about have ACL set to read-only for non admin users. Perhaps the installer is not running elevated when trying to replace them (they are in localappdata, so theoretically it doesn't need to be). I ended up just running the MSI installer directly; that allows me to install the latest VSCode, but the app is now living under Program Files instead of %localappdata%.

@t1nr2y
Copy link

t1nr2y commented May 17, 2022

I'd been having this problem for days as well. Then after reading these comments and finding no answer, I went back into VS Code with no folder or workspace opened and noticed that it wanted me to make it a trusted workspace. Once I did that, I was able to get the update. I had ignored that trusted workspace before, I think it showed up after Gitlens, which I think is ok to be trusted, so went ahead and trusted it-hopefully ok there. Anyways, maybe this will help others, but use at your own caution.

@ant0nsc
Copy link

ant0nsc commented May 18, 2022

Those files that vscode installer was complaining about have ACL set to read-only for non admin users. Perhaps the installer is not running elevated when trying to replace them (they are in localappdata, so theoretically it doesn't need to be). I ended up just running the MSI installer directly; that allows me to install the latest VSCode, but the app is now living under Program Files instead of %localappdata%.

I also tried downloading the MSI. When starting, my installer though again tried to write into AppData, and again failed with a permissions problem, screenshot below.

I ended up deleting the whole VSCode folder from AppData, and doing a new install :-(

image

@lovettchris
Copy link
Member

Yeah it is weird, because I thought the User Installer:
image
was supposed to avoid all this elevation stuff.
I have used only the user installer for a long time now, yet I also ran into this. But I do use VS code from WSL, and I'm wondering if that could have something to do with it? Can WSL install extensions in this location and get the file permissions wrong? I know I've seen other WSL activities create files with weird permissions like this... So if someone hits this and has never used VS code from WSL then we can rule that out...

@jacleggmsr
Copy link

Same issue for me. My VSCode version:

Version: 1.66.2 (user setup)
Commit: dfd34e8
Date: 2022-04-11T07:46:01.075Z
Electron: 17.2.0
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Windows_NT x64 10.0.22000

I'm running windows 11.

@rainersigwald
Copy link
Member

#147408 is related (or maybe this is a duplicate). icacls "%LOCALAPPDATA%\Programs\Microsoft VS Code" /grant "%USERDOMAIN%\%USERNAME%":F /T worked around for me.

@jamesadevine
Copy link
Member

jamesadevine commented May 19, 2022

Thanks @rainersigwald, that command worked for me when run from cmd.exe with admin permissions. Once complete, I then hit retry in the updater, and the updater completed successfully.

EDIT: slight caveat is that code <path> no longer works from the terminal.

@sandersaares
Copy link
Member

Also having this with the below version. Started happening today (though I do not use VS code all too often). Never used VS Code as admin, as far as I can recall.

Version: 1.67.1 (user setup)
Commit: da15b6f
Date: 2022-05-06T12:37:03.389Z
Electron: 17.4.1
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Windows_NT x64 10.0.19044

@sba923
Copy link

sba923 commented May 19, 2022

It seems that once you have performed an "update on close" while VScode was running elevated / as admin, you can no longer perform updates when non-elevated.

Rather annoying if you ask me.

@joaomoreno
Copy link
Member

Duplicate of #147408

@joaomoreno joaomoreno marked this as a duplicate of #147408 May 20, 2022
@joaomoreno joaomoreno closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2022
@joshjm
Copy link

joshjm commented Jun 7, 2022

i got the update to work by;

  • closing vs code or restarting
  • right click cs code and run as admin
  • ctrl shift p, and check for updates/restart to update

and it worked for me

@DJackman123
Copy link

Thanks for that advice. Launching VSCode elevated to do the update worked for me also. Does that mean all future updates will also need to be running as admin?

@github-actions github-actions bot locked and limited conversation to collaborators Jul 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests