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

Krew install fails on Ubuntu WSL (Windows Subsystem for Linux) #159

Closed
StianOvrevage opened this issue Mar 11, 2019 · 11 comments
Closed

Krew install fails on Ubuntu WSL (Windows Subsystem for Linux) #159

StianOvrevage opened this issue Mar 11, 2019 · 11 comments

Comments

@StianOvrevage
Copy link

StianOvrevage commented Mar 11, 2019

# (
>   set -x; cd "$(mktemp -d)" &&
>   curl -fsSLO "https://storage.googleapis.com/krew/v0.2.1/krew.{tar.gz,yaml}" &&
>   tar zxvf krew.tar.gz &&
>   ./krew-"$(uname | tr '[:upper:]' '[:lower:]')_amd64" install \
>     --manifest=krew.yaml --archive=krew.tar.gz
> )
++ mktemp -d
+ cd /tmp/tmp.y04kz5whCK
+ curl -fsSLO 'https://storage.googleapis.com/krew/v0.2.1/krew.{tar.gz,yaml}'
+ tar zxvf krew.tar.gz
./krew-darwin_amd64
./krew-linux_amd64
./krew-linux_arm
./krew-windows_amd64.exe
++ uname
++ tr '[:upper:]' '[:lower:]'
+ ./krew-linux_amd64 install --manifest=krew.yaml --archive=krew.tar.gz
Installing plugin: krew
W0311 13:32:17.764882     418 install.go:132] failed to install plugin "krew": failed to dowload and move during installation: could not rename file from "/tmp/krew-temp-move308169657" to "/root/.krew/store/krew/dc2f2e1ec8a0acb6f3e23580d4a8b38c44823e948c40342e13ff6e8e12edb15a": rename /tmp/krew-temp-move308169657 /root/.krew/store/krew/dc2f2e1ec8a0acb6f3e23580d4a8b38c44823e948c40342e13ff6e8e12edb15a: permission denied
F0311 13:32:17.768004     418 root.go:52] failed to install some plugins: [krew]

Tried as root and non-root. Both fails with same error.

@ahmetb
Copy link
Member

ahmetb commented Mar 11, 2019

See #156.

@ahmetb ahmetb closed this as completed Mar 11, 2019
@StianOvrevage
Copy link
Author

I reviewed that ticket before opening and I do not think they are the same.

@HoveringHalibut
Copy link

@StianOvrevage The issue is with the length of the underlying NTFS path of the WSL root directory, whose mount defaults to deep in your windows profile. With the additional krew folder depth and long length of the folder name, the full path exceeds the Windows MAX_PATH length of 260.

I worked around the issue by moving my /home mount to a directory in the root of C:

This is using the WSL Ubuntu image:

/etc/fstab
LABEL=cloudimg-rootfs / ext4 defaults 0 0
C: /mnt/c drvfs rw,noatime,uid=1000,gid=1000,umask=22,fmask=11 0 0
/mnt/c/linuxhome /home drvfs bind 0 0

/etc/wsl.conf
[automount]
mountFsTab = true

@ahmetb
Copy link
Member

ahmetb commented Apr 8, 2019

@StianOvrevage can you give an example of a full path exceeding MAX_PATH? I'm curious how it looks like witht he additional krew folder depth.

@StianOvrevage
Copy link
Author

Great job figuring this out!

I was not able to get automatic mounting of /home to work. There was no wsl.conf so maybe there are some differences between our setups.

I did however just mount /mnt/c/linuxhome temporarily for the install and then moved krew into /krew. Hopefully this works without breaking too many of krews expectations about how things should look.

@ahmetb
Copy link
Member

ahmetb commented Apr 8, 2019

If any of you could write up summary a summary of the WSL issue, I would like to link to it from the README>Installation section as a "Known issue with WSL".

@StianOvrevage
Copy link
Author

@ahmetb I don't know enough about WSL to actually find the underlying path as mapped to the NTFS disk.

According to https://blogs.msdn.microsoft.com/wsl/2016/06/15/wsl-file-system-support/ at some point it was at %LocalAppData%\lxss\rootfs but I do not have that folder on my machine. That path would translate to C:\Users\Stian\AppData\Local\lxss\rootfs here.

@ahmetb
Copy link
Member

ahmetb commented Apr 8, 2019

echo 'C:\Users\Stian\AppData\Local\lxss\rootfs\home/MYUSERNAME/.krew/store01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b/store/plugin-name/kubectl-plugin-name' | wc -c is around ~170 chars, not sure if it could easily reach 260 chars as long as your user name is very long.

@HoveringHalibut
Copy link

@StianOvrevage wsl.conf doesn't exist by default, you can just create it.

@ahmetb The full patch for me is only 214, now that I actually counted.
C:\Users\halibuthh\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\halibuthh\.krew\store\krew\dc2f2e1ec8a0acb6f3e23580d4a8b38c44823e948c40342e13ff6e8e12edb15a\krew

What's odd is that it is a permission error and I traced all the system calls and they looked fine from a user permissions stand-point. It could just be a bad error message.

It was a bit for naught anyway, pending this fix for kubectl executing plugins in WSL:
kubernetes/kubernetes#76227

@alioSHA512
Copy link

This Worked for me,
#159 (comment)

But I don't want to move my /home directory, so I created dir /mnt/c/krew and linked it to ~/.krew, and that did the trick.

$ ln -s /mnt/c/krew/ ~/.krew

@ahmetb
Copy link
Member

ahmetb commented Sep 11, 2019

@alioSHA512 Good to hear. You can also set KREW_ROOT environment variable to point to any directory you want to use.

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

No branches or pull requests

4 participants