Win10 64 bit (1607 build 14393.447)
UAC settings: default (notify me only when apps try to make changes to my computer)
From a non-elevated cmd shell:
C:\> choco install keepass-keepasshttp
This is try 1/3. Retrying after 300 milliseconds.
Error converted to warning:
Access to the path 'C:\ProgramData\chocolatey\config' is denied.
This is try 2/3. Retrying after 400 milliseconds.
Error converted to warning:
Access to the path 'C:\ProgramData\chocolatey\config' is denied.
Maximum tries of 3 reached. Throwing error.
Cannot create directory "C:\ProgramData\chocolatey\config". Error was: ...
This is not surprising seeing as when I try to create that folder manually, I am greeted with an OS admin access confirmation dialog. If I run the same command from an elevated prompt, everything works.
Installed Chocolatey from an elevated powershell windows, per the recommendation in https://chocolatey.org/docs/installation. Restarted the computer and executed the choco install command above.
~sh
This is try 1/3. Retrying after 300 milliseconds.
Error converted to warning:
Access to the path 'C:\ProgramData\chocolatey\config' is denied.
This is try 2/3. Retrying after 400 milliseconds.
Error converted to warning:
Access to the path 'C:\ProgramData\chocolatey\config' is denied.
Maximum tries of 3 reached. Throwing error.
Cannot create directory "C:\ProgramData\chocolatey\config". Error was:
System.UnauthorizedAccessException: Access to the path 'C:\ProgramData\chocolatey\config' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
at chocolatey.infrastructure.filesystem.DotNetFileSystem.<>c__DisplayClass60.
at chocolatey.infrastructure.tolerance.FaultTolerance.<>c__DisplayClass1.
at chocolatey.infrastructure.tolerance.FaultTolerance.retryT
at chocolatey.infrastructure.filesystem.DotNetFileSystem.create_directory(String directoryPath)
at chocolatey.infrastructure.filesystem.DotNetFileSystem.create_directory_if_not_exists(String directoryPath, Boolean ignoreError)
at chocolatey.infrastructure.extractors.AssemblyFileExtractor.extract_text_file_from_assembly(IFileSystem fileSystem, IAssembly assembly, String manifestLocation, String filePath, Boolean overwriteExisting)
at chocolatey.infrastructure.app.builders.ConfigurationBuilder.get_config_file_settings(IFileSystem fileSystem, IXmlService xmlService)
at chocolatey.infrastructure.app.builders.ConfigurationBuilder.set_up_configuration(IList1 args, ChocolateyConfiguration config, Container container, ChocolateyLicense license, Action1 notifyWarnLoggingAction)
at chocolatey.console.Program.Main(String[] args)
~
@ohadschn Is this one I asked you to split off from a different issue?
I don't think so, the only other choco discussion I've ever participated in was the tab completion issue..
I ask because you installed Chocolatey to the default location, which is locked down to administrators only.
I just did what the installation page said, namely run this from an elevated PS window:
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
Are you saying that this result is expected, and that I should always run choco install from elevated prompts?
The result is expected, and if you install to the default install location, you should always run choco from an elevated prompt.
Ah, I see. Perhaps that could be mentioned in the installation page as well?
I could almost swear it is, maybe not in all of the sections it should be mentioned in.
Right now, mentioned here in number 1 - https://chocolatey.org/install#non-administrative-install
Mentioned in 1 and 2 here - https://chocolatey.org/security#overall
But perhaps put some considerations up prior to the install text so that folks will have had at least the opportunity to scroll past it, even if they don't read it the first time.
Apologies, I never reached those sections, and even if I did I'd stop right after the line that said "This option should be a last resort and is considered to be an advanced scenario" :)
It would be nice if this were mentioned in the vanilla basic installation text (you already have two notes there, maybe add a third), just my 2 cents..
👍 agreed. That's why a suggestion to mention it sooner.
npm install -g doesnt have this issue, requiring running from elevated prompts all the time
Why not adopt their policy?
We are looking at something we can do here. Chocolatey doesn't require admin rights outside of the default installation directory (unless the program being installed requires it).
My install was just like the OP, where I followed the installation instructions and ran from an elevated prompt.
I believe it installed to its default folder, the ProgramData folder right? (I find it odd that it does require elevated priviledges in the first place when installed there)
Good to know it's being considered
I also experienced this just now.
So I'm testing this now for using highestAvailable permissions.
C:\PROGRAMS\Far3>chocolatey
This is try 1/3. Retrying after 300 milliseconds.
Error converted to warning:
Access to the path 'C:\ProgramData\chocolatey\config' is denied.
This is try 2/3. Retrying after 400 milliseconds.
Error converted to warning:
Access to the path 'C:\ProgramData\chocolatey\config' is denied.
Maximum tries of 3 reached. Throwing error.
Cannot create directory "C:\ProgramData\chocolatey\config". Error was:
System.UnauthorizedAccessException: Access to the path 'C:\ProgramData\chocolatey\config' is denied.
Same bad experience here. When I follow https://chocolatey.org/install I see how simple it is and I feel great - a one-line install! I expect choco to work in my next cmd shell, and instead it falls on the floor.
A quick fix needed right now: after Installing Chocolatey add this short section:
Running Chocolatey
Since choco is an admin tool, it must be run from an admin shell. If you run from an unelevated shell, you'll see an access denied error.
A quick fix needed right now
I like this. Not a quick fix per say, but that is how Chocolatey works.
Here is simplest workaround:
Give full access rights for yourmachine\Users to folder C:\ProgramData\Chocolatey
Hi this seems the problem created because access writes,
give full access to C:\ProgramData\Chocolatey for current user
it is work
quick fix
If the website was in the repo I'd make a PR now.
@air the website does have a repo, but docs are in a different location.
However, I think you are going to see with 0.10.4 this is unnecessary. It won't run by default unless you are running under elevated context. And we've made some changes to how that file gets written.
Run cmd as administrator and try again.
Thanks @lslayer Works like a charm on giving full control for the folder for the current user.
I followed the install instruction and fell foul of this as well…
Just had this issue. The install page already has an "Additional Considerations" section. This should definitely include something along the lines of @air 's suggestion.
You have to run cmd as administrator, so just right click cmd and run as administrator. Run the command again and it should work.
I was trying it in Powershell and running powershell as Administrator worked me.
For me it was admin rights. If you are using PowerShell and installing packages via chocolatey I recommend trying to do it as admin.
Run "cinst git" from Administrator Power Shell. Worked for me.
For me it was admin rights. If you are using PowerShell and installing packages via chocolatey I recommend trying to do it as admin.
This isn't always feasible, such as when running through a remote powershell connection.
Environment
Win10 64 bit (1607 build 14393.447)
UAC settings: default (notify me only when apps try to make changes to my computer)What You Are Seeing?
From a non-elevated cmd shell:
C:\> choco install keepass-keepasshttp This is try 1/3. Retrying after 300 milliseconds. Error converted to warning: Access to the path 'C:\ProgramData\chocolatey\config' is denied. This is try 2/3. Retrying after 400 milliseconds. Error converted to warning: Access to the path 'C:\ProgramData\chocolatey\config' is denied. Maximum tries of 3 reached. Throwing error. Cannot create directory "C:\ProgramData\chocolatey\config". Error was: ...This is not surprising seeing as when I try to create that folder manually, I am greeted with an OS admin access confirmation dialog. If I run the same command from an elevated prompt, everything works.
How Did You Get This To Happen? (Steps to Reproduce)
Installed Chocolatey from an elevated powershell windows, per the recommendation in https://chocolatey.org/docs/installation. Restarted the computer and executed the
choco installcommand above.Output Log (debug + verbose)
This is try 1/3. Retrying after 300 milliseconds. Error converted to warning: Access to the path 'C:\ProgramData\chocolatey\config' is denied. This is try 2/3. Retrying after 400 milliseconds. Error converted to warning: Access to the path 'C:\ProgramData\chocolatey\config' is denied. Maximum tries of 3 reached. Throwing error. Cannot create directory "C:\ProgramData\chocolatey\config". Error was: System.UnauthorizedAccessException: Access to the path 'C:\ProgramData\chocolatey\config' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost) at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost) at chocolatey.infrastructure.filesystem.DotNetFileSystem.<>c__DisplayClass60.<create_directory>b__5f() at chocolatey.infrastructure.tolerance.FaultTolerance.<>c__DisplayClass1.<retry>b__0() at chocolatey.infrastructure.tolerance.FaultTolerance.retry[T](Int32 numberOfTries, Func`1 function, Int32 waitDurationMilliseconds, Int32 increaseRetryByMilliseconds, Boolean isSilent) at chocolatey.infrastructure.filesystem.DotNetFileSystem.create_directory(String directoryPath) at chocolatey.infrastructure.filesystem.DotNetFileSystem.create_directory_if_not_exists(String directoryPath, Boolean ignoreError) Chocolatey had an error occur: System.UnauthorizedAccessException: Access to the path 'C:\ProgramData\chocolatey\config' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost) at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost) at chocolatey.infrastructure.filesystem.DotNetFileSystem.<>c__DisplayClass60.<create_directory>b__5f() at chocolatey.infrastructure.tolerance.FaultTolerance.<>c__DisplayClass1.<retry>b__0() at chocolatey.infrastructure.tolerance.FaultTolerance.retry[T](Int32 numberOfTries, Func`1 function, Int32 waitDurationMilliseconds, Int32 increaseRetryByMilliseconds, Boolean isSilent) at chocolatey.infrastructure.filesystem.DotNetFileSystem.create_directory(String directoryPath) at chocolatey.infrastructure.filesystem.DotNetFileSystem.create_directory_if_not_exists(String directoryPath, Boolean ignoreError) at chocolatey.infrastructure.extractors.AssemblyFileExtractor.extract_text_file_from_assembly(IFileSystem fileSystem, IAssembly assembly, String manifestLocation, String filePath, Boolean overwriteExisting) at chocolatey.infrastructure.app.builders.ConfigurationBuilder.get_config_file_settings(IFileSystem fileSystem, IXmlService xmlService) at chocolatey.infrastructure.app.builders.ConfigurationBuilder.set_up_configuration(IList`1 args, ChocolateyConfiguration config, Container container, ChocolateyLicense license, Action`1 notifyWarnLoggingAction) at chocolatey.console.Program.Main(String[] args)
Hi, you just need to open PowerShell as an administrator. That's the problem
Run cmd as administrator and try again.
thanks worked
Run cmd as administrator and try again.
Working for me
I understand how installing packages requires elevated privileges, but this error also pops up with choco search or even choco -h which are, in terms of observable behaviour, harmless read-only operations. This is inconsistent with all the package managers I am familiar with.
@samhocevar you only have to run choco as admin one time to get config set. Then you can go back to non-admin for search and other items.
I was able to reasonable resolve it.
Appearently chocolatey tries to write data to this location:
C:\ProgramDatachocolatey
I was able to change it's security by extending read & excute rights to full controll for all users - I am only user so no security issue. Make sure to check inherit option box.
PS. Please keep in mind that I was previously trying multiple options which didnt work. I have disabled eventually UAC, and still raised my cmd as admin. It didnt work, I have changed directory access rights to full control and than command
choco install minikube --force
was successful. Not sure if all steps required, I think full controll over choclatey dir should be enough.
Choco needs an option to specify system or user install folders, or better, default to user and have -global as a flag to force installing to ProgamData.
From: PiotrGen notifications@github.com
Sent: Monday, July 13, 2020 3:28:22 AM
To: chocolatey/choco choco@noreply.github.com
Cc: The Sharp Ninja ninja@thesharp.ninja; Comment comment@noreply.github.com
Subject: Re: [chocolatey/choco] Access to the path 'C:\ProgramDatachocolatey\config' is denied (after clean install + restart) (#1048)
I was able to reasonable resolve it.
Appearently chocolatey tries to write data to this location:
C:\ProgramDatachocolatey
I was able to change it's security by extending read & excute rights to full controll for all users - I am only user so no security issue. Make sure to check inherit option box.
PS. Please keep in mind that I was previously trying multiple options which didnt work. I have disabled eventually UAC, and still raised my cmd as admin. It didnt work, I have changed directory access rights to full control and than command
choco install minikube --force
was successful. Not sure if all steps required, I think full controll over choclatey dir should be enough.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/chocolatey/choco/issues/1048#issuecomment-657405397, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AD3GCLCCSBV65L3VVVNSQ53R3LASNANCNFSM4CWBUSVQ.
You need to run Windows PowerShell as admin access
I'm with @sharpninja ... like npm, choco should default to a per user installation as --global and add the all users option as --allusers which would then have the appropriate "administrator" warnings and checks
What's strange is that I'm running into this issue as admin
PS C:\ProgramData\chocolatey> whoami
whoami
ec2amaz-r8culvn\administrator
PS C:\ProgramData\chocolatey> C:\ProgramData\chocolatey\choco.exe -y install git
C:\ProgramData\chocolatey\choco.exe -y install git
Chocolatey v0.10.15
This is try 1/3. Retrying after 300 milliseconds.
Error converted to warning:
Access to the path 'C:\ProgramData\chocolatey\choco.exe.old' is denied.
This is try 2/3. Retrying after 400 milliseconds.
Error converted to warning:
Access to the path 'C:\ProgramData\chocolatey\choco.exe.old' is denied.
Maximum tries of 3 reached. Throwing error.
Most helpful comment
Ah, I see. Perhaps that could be mentioned in the installation page as well?