chocolatey / boxstarter

Repeatable, reboot resilient windows environment installations made easy using Chocolatey packages
https://boxstarter.org/
Apache License 2.0
1.3k stars 162 forks source link

chocolatey\chocolatey\chocolatey\.... temp download paths #241

Open flcdrg opened 7 years ago

flcdrg commented 7 years ago

2.9.2 - seeing packages getting downloaded into weird folders (and then failing).

C:\Users\dgardiner\AppData\Local\Temp\chocolatey\chocolatey\chocolatey\chocolatey\chocolatey\chocolatey\chocolatey\chocolatey\chocolatey\chocolatey\chocolatey\chocolatey\chocolatey\chocolatey\chocolatey\chocolatey\chocolatey\chocolatey.squirrel-lock-0205C670A9D776F56D17A8FB985A520ADEE61F89: System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

flcdrg commented 7 years ago

Seems like each package is going one level deeper :-)

gep13 commented 7 years ago

You can never have to much chocolatey!

Ok, I will leave now...

😄

mwrock commented 7 years ago

I have submitted https://github.com/chocolatey/choco/pull/1211 to fix this issue.

mwrock commented 7 years ago

Just released this fix on 2.9.5

flcdrg commented 7 years ago

Still seeing this in 2.9.5 :-(

flcdrg commented 7 years ago

Just guessing, but could it be that config.CacheLocation.EndsWith("chocolatey") would be false if CacheLocation had a trailing slash/backslash?

flcdrg commented 7 years ago

Raised https://github.com/chocolatey/choco/issues/1231

mwrock commented 7 years ago

see https://github.com/chocolatey/choco/pull/1232. I tested this build against boxstarter and the nested directories appear to be gone.

mwrock commented 7 years ago

Reopening this until the above is released

KZeronimo commented 7 years ago

Ugg - sorry I missed this - and I looked at this one the other day and chuckled about

You can never have to much chocolatey!

mwrock commented 7 years ago

no worries. this issue was closed which is probably why you missed it :)

batzen commented 7 years ago

https://github.com/chocolatey/choco/pull/1233 is the correct PR, just for reference.

flcdrg commented 7 years ago

Confirmed that this is now resolved

amaau commented 7 years ago

nope not resolved yet, boxstarter 2.10.3 + choco 0.10.7 still have this problem

mwrock commented 7 years ago

yes we had to revert to choco 0.10.5 which "rebroke" this but fixed larger problems.

amaau commented 7 years ago

but current (2.10.3) boxstarter installs choco 0.10.7, at least that's what the log says

mwrock commented 7 years ago

boxstarter doesn't install chocolatey unless your script installs it. It just calls into a chocolatey dll.

mwrock commented 7 years ago

oh maybe you are referring to the bootstrapper which does install the latest choco if it is not installed in order to install boxstarter. That would install 0.10.7 but it does not use it in boxstarter runs.

amaau commented 7 years ago

right, sorry, i did refer to the bootstrapper

ferventcoder commented 7 years ago

I thought I had seen this as well - should have linked the two. https://github.com/chocolatey/choco/pull/1233#issuecomment-318479205

ghost commented 7 years ago

Matt, any idea when a new version of Boxstarter will be released that will have a version of Chocolatey which addresses this issue? We are unable to use boxstarter with this issue in it. :(

Sebbl22 commented 7 years ago

Are there any known workarounds? Can i reset the cache path after each package install?

ghost commented 7 years ago

That did not work for me. If you try and it works let me know!

kirannhegde commented 7 years ago

@mwrock Hello Matt, I am using the latest version of Boxstarter bootstrapper, that installs the latest version of Chocolatey. I am seeing this issue as well when i try to install a series of packages using the text file on Git gist. Is there an easy way to workaround this issue?

mwrock commented 6 years ago

not that I am aware of @kirannhegde but have not had time to investigate

kirannhegde commented 6 years ago

I worked around this issue by using an alternative cache location, instead of the user temp directory. Basically , for each choco install, i explicitly use an alternative cache location as follows: cinst 7zip --version 9.22 --source https://abc.com/ --cacheLocation "$env:SystemDrive\TCAgentSetupCache"

Hope this helps.

@Sebbl22 @ericrlarson

Sebbl22 commented 6 years ago

Thanks @kirannhegde. Your solution worked for me.

It seems, that the $env:temp Variable gets overwritten for the current PowerShell session, because I first tried cinst 7zip --cacheLocation "$env:temp\ChocoCache", wich also resulted in C:\Users\abc\AppData\Local\Temp\chocolatey\chocolatey\chocolatey\chocolatey after several installs.

cinst 7zip --cacheLocation "$env:userprofile\AppData\Local\ChocoCache" however worked just fine. Hint: The cache location must exist. I use the follwing command in my Boxstarter script: New-Item -Path "$env:userprofile\AppData\Local\ChocoCache" -ItemType directory -Force

flcdrg commented 6 years ago

This is still causing problems, and the workaround isn't working for me with the latest BoxStarter. Even though cacheLocation is being passed in, Chocolatey is still using %TEMP% which has the chocolatey\chocolatey\chocolatey problem :-(

flcdrg commented 6 years ago

Looks like if you apply --cache-location to every choco call in your BoxStarter script, you might be ok. That includes choco pin, and windows features

Oxymoron290 commented 5 years ago

im stuck, help

pauby commented 5 years ago

@Oxymoron290 What are you stuck with?

Oxymoron290 commented 5 years ago

This problem with infinite chocolatey folders in cache. I've tried adding --cacheLocation "$env:userprofile\AppData\Local\ChocoCache" at the end of all cinst statements and the problem persists image

pauby commented 5 years ago

@Oxymoron290 What happens when you use c:\temp as the --cacheLocation? What is the value of $env:userprofile and what is your cinst line?

Oxymoron290 commented 5 years ago

image

Oxymoron290 commented 5 years ago

So it appears using c:\temp will work for now. Let me try updating my powershell scripts for boxstarter

Oxymoron290 commented 5 years ago

Yes, it is working now.

ctmcisco commented 5 years ago

thing only began to happen when I repaved my machine using Boxstarter. Is this a boxstarter issue as I don't seem to have this issue when running Chocolatey only?

flcdrg commented 5 years ago

It was a bug in Chocolatey that has been fixed, but for unrelated reasons Boxstarter hasn't been able to upgrade to that newer version of Chocolatey yet.

ctmcisco commented 5 years ago

I see, so best thing to do is either run with the work around for now as suggested by @neilkidd or only use Chocolatey?

flcdrg commented 5 years ago

Yes. (Credit to @kirannhegde)..

It only becomes a problem if you exceed a certain number of packages. Some of my Boxstarter scripts get by without it, but the longer ones require the workaround for now.

https://gist.github.com/flcdrg/87802af4c92527eb8a30

ctmcisco commented 5 years ago

great catch @kirannhegde !

The below is what I am doing for now and every time I this the fails are happen randomly between packages. So I think adding the Temp cache to all is the safest bet.

I like your cleaner look of dropping the cache location in a variable.

Thanks. Now I have to clean up the script a bit. Arg I should have checked in before trying to trouble on my own. Lost some time.

Thanks again!

choco upgrade --cacheLocation="$ChocoCachePath" googlechrome -dy
choco upgrade --cacheLocation="$ChocoCachePath" firefox -dy
choco upgrade --cacheLocation="$ChocoCachePath" skype -dy
choco upgrade --cacheLocation="$ChocoCachePath" ditto -dy
choco upgrade --cacheLocation="$ChocoCachePath" keepass.install -dy
choco upgrade --cacheLocation="$ChocoCachePath" flashplayerplugin -dy
choco upgrade --cacheLocation="$ChocoCachePath" sysinternals -dy
choco upgrade --cacheLocation="$ChocoCachePath" winrar -dy
choco upgrade --cacheLocation="$ChocoCachePath" teamviewer -dy
choco upgrade --cacheLocation="$ChocoCachePath" notepadplusplus -dy
choco upgrade --cacheLocation="$ChocoCachePath" filezilla -dy
choco upgrade --cacheLocation="$ChocoCachePath" angryip -dy
choco upgrade --cacheLocation="$ChocoCachePath" putty -dy
choco upgrade --cacheLocation="$ChocoCachePath" winscp -dy
choco upgrade --cacheLocation="$ChocoCachePath" nmap -dy
choco upgrade --cacheLocation="$ChocoCachePath" mRemoteNG -dy
choco upgrade --cacheLocation="$ChocoCachePath" openssh -dy
choco upgrade --cacheLocation="$ChocoCachePath" vnc-viewer-plus -dy
choco upgrade --cacheLocation="$ChocoCachePath" powershell-core -dy
choco upgrade --cacheLocation="$ChocoCachePath" markdownmonster -dy
choco upgrade --cacheLocation="$ChocoCachePath" git -dy
choco upgrade --cacheLocation="$ChocoCachePath" vscode -dy
pauby commented 5 years ago

Need to upgrade chocolatey lib to a later version - need to determine which one. This comment suggests it's fixed in 0.10.4.

jamie-tillman commented 4 years ago

This "increasing chocolatey temp path" happened to me to today when running this gist using the current downloadable Boxstarter: https://gist.github.com/jamie-tillman/a375037784d6874a77a6049f56fd53bc

It ended up ultimately failing due to a "path too long" exception.

me-kell commented 3 years ago

It is the dll chocolatey.dll packaged with Boxstarter that changes the variable $env:temp. Replacing the packaged chocolatey.dll with a new version from chocolatey.lib.0.10.15\lib\chocolatey.dll returns the $env:temp unchanged.

See my comments on https://github.com/chocolatey/boxstarter/issues/442#issuecomment-707600051

pauby commented 3 years ago

@me-kell Can we keep the comments on your issue?

Just for clarity, replacing the chocolatey.dll is not an option at this point.

me-kell commented 3 years ago

@pauby Do you mean not writing the comments here but only in the issue #442 ?

pauby commented 3 years ago

@me-kell Yes. That way we keep everything relevant to that issue and the discussion only needs to happen once. Your issue is linked here so people can refer to it.

me-kell commented 3 years ago

@pauby Thank very much you for the hint.

Jawabiscuit commented 3 years ago

Greetings, I thought I'd submit a bug but seems this is a very well known issue. I think I got around the issue by setting the chocolatey config cache path. Seems very sad to have to resort to workarounds such as putting --cacheLocation everywhere e.g. https://gist.github.com/flcdrg/87802af4c92527eb8a30.

There's a handy tool called choco-cleaner in case people reading this haven't heard of it. A sprinkling of choco-cleaner in long install scripts seems to be working much better for me. Installed early on with: choco install choco-cleaner; refreshenv.