kubernetes / minikube

Run Kubernetes locally
https://minikube.sigs.k8s.io/
Apache License 2.0
29.23k stars 4.87k forks source link

minikube not added to PATH: installer uses setx.exe which runcates PATHs longer than 1024 chars #2587

Closed mmckenz closed 5 years ago

mmckenz commented 6 years ago

Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT

Please provide the following details:

Environment:

Minikube version (use minikube version): v0.25.0

What happened: Installed minikube using the Windows Installer. The update_path.bat script used setx.exe to add minikube's installation path to my system PATH variable. My system PATH is over 1024 chars long so setx.exe destructively truncated it. I had to restore my system PATH from registry backups.

What you expected to happen: minikube is installed without destructively changing my system PATH.

How to reproduce it (as minimally and precisely as possible): Start with a system PATH environment variable > 1024 chars. Run the minikube Windows installer.

Output of minikube logs (if applicable): N/A

Anything else do we need to know: N/A

fejta-bot commented 6 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

mmckenz commented 6 years ago

/remove-lifecycle stale

stefanjarina commented 6 years ago

Same happened to me:

Minikube version: 0.28.2

I use a PATH in windows that is rather modular, e.g.:

PATH = C:\Windows;C:\Windows\system32;%PATH_TOOLS_MS%;%PATH_TOOLS_HW;%PATH_TOOLS_CODE%
PATH_TOOLS_MS = C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64;
PATH_TOOLS_HW = C:\Program Files\Razer Chroma SDK\bin;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Intel\iCLS Client\;
PATH_TOOLS_CODE = C:\Python37-32\Scripts\;C:\Python37-32\;C:\Program Files\Docker\Docker\Resources\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\PuTTY\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\erl9.2\bin;C:\Program Files (x86)\Elixir\bin;C:\Program Files\heroku\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files\Microsoft VS Code\bin;D:\Programy\ngrok;C:\vagrant\bin;C:\PostgreSQL\pg10\bin;E:\Programy\kotlin-compiler-1.2.61\kotlinc\bin;C:\Go\bin;C:\Program Files\MariaDB 10.3\bin;C:\kubernetes\minikube\bin;

etc. This is basically to avoid PATH longer than 4096 characters which is not working on Windows...

After running the minikube-installer.exe I spent some time debugging why my system is not working properly only to discover in huge shock that it efectivelly destroyed my PATH and it converted it to something like:

PATH = C:\Windows;C:\Windows\system32;C:\Python37-32\Scripts\;C:\Python37-32\;C:\Program Files\Docker\Docker\Resources\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\PuTTY\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\R

Didn't even add minikube installation into PATH. It also removed the references to variables (%PATHTOOLS***%) as an addition to truncating part of my PATH, so it seems it first extends the PATH to it's full form, then truncate it (WHAT???)

If I wouldn't have PATH split into smaller variables, installer would wipe 3/4 of my PATH and I would have to play with registries to fix it... Thankfully for me it only destroyed the variable references and thus I was able to reconstruct PATH easily...

stefanjarina commented 5 years ago

/remove-lifecycle stale

fejta-bot commented 5 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

tstromberg commented 5 years ago

AFAIK, this is still an issue. I'd be happy to approve any PR's which fix the behavior though. Help wanted!

tstromberg commented 5 years ago

Some more context:

https://superuser.com/questions/387619/overcoming-the-1024-character-limit-with-setx

The file that needs to be modified within minikube is installers/windows/update_path.bat. It's unclear which approach is the most sane one, as they all seem to require an additional dependency.

Vaskinn commented 5 years ago

A good temporary fix, probably without introducing dependencies, would be to detect when the path will be to long, and not try to set it but instead show instructions on what to add manually to the path. That will prevent the installer from destroying the system of people that have a long path.

ssargent commented 5 years ago

Is this still a thing? I know as of 0.35 it was, but was this fixed in 1.0.0? I didn't use the installer for that. Would it be possible to use powershell for this on windows? I'm not sure if that gets around the problem somehow, or if that falls under the category of additional dependencies. But I'm happy to look into it if that's possibly in play.

tstromberg commented 5 years ago

@ssargent - Yes, this is still a thing that exists. Patches are very welcome for this issue. Let me know if I can help in any way.

blueelvis commented 5 years ago

@tstromberg - I will pick this up. Instead of using a Batch file for Windows, cannot we incorporate a PowerShell file? PowerShell is installed on all systems by default from Windows 7+

Also, I couldn't find any documentation on the minimum requirement of Windows Operating System for Minikube (I believe it is Windows 8+ as per here. There is a line which says that).

Additionally, I couldn't find any documentation on how the installers are generated?

tstromberg commented 5 years ago

@blueelvis - Thanks! My preference would be to continue to support Windows 7 and higher if possible.

https://github.com/kubernetes/minikube/tree/master/installers/windows contains the code used in the installer.

https://github.com/kubernetes/minikube/blob/master/Makefile#L288 shows the steps used to make the installer.

I very much look forward to your PR!