Lens: Uncaught exception: Error: EPERM: operation not permitted, open kubectl.exe due to `Lock file is already being held`

Created on 24 Aug 2020  路  14Comments  路  Source: lensapp/lens

Describe the bug

Sometimes, when switching the cluster I get the following error

Uncaught exception: 
Error: EPERM: operation not permitted, open 
.../kubectl.exe

image

I've installed lens successfully on my windows machine and I also could successfully add clusters. I also can see cluster details, seems all fine. However sometimes, when I switch the cluster, I get the error mentioned above. After clicking ok, I can continue working

To Reproduce
Steps to reproduce the behavior:

TBD

It usually happens when I switch to another cluster, but not always

Expected behavior

I do not expect any error when switching the cluster

Screenshots

See above

Environment (please complete the following information):

  • Lens Version:
  • OS: Windows Server 2016
  • Installation method (e.g. snap or AppImage in Linux): download and execute binary

Logs:
When you run the application executable from command line you will see some logging output. Please paste them here:

鈫怺31merror鈫怺39m: Failed to get a lock for 1.18.0
鈫怺31merror鈫怺39m: Lock file is already being held {"code":"ELOCKED","file":"C:\\Users\\sc146082as\\AppData\\Roaming\\Lens\\binaries\\kubectl\\1.18.0"}
鈫怺31merror鈫怺39m: Failed to get a lock for 1.18.0
鈫怺31merror鈫怺39m: Lock file is already being held {"code":"ELOCKED","file":"C:\\Users\\sc146082as\\AppData\\Roaming\\Lens\\binaries\\kubectl\\1.18.0"}
arewindows bug

Most helpful comment

The problem is with the 0KB kubectl.exe file. Download kubectl manually from Kubernetes stores e.g. in my case https://storage.googleapis.com/kubernetes-release/release/v1.16.14/bin/windows/amd64/kubectl.exe and replace 0KB file.

image

This works for me!

All 14 comments

Having the same problem. It also "deletes" (0KB) the kubectl.exe after that happens.

image

778 probably fixed this by releasing the lock when downloading of kubectl fails.

I experienced the same issue:

Environment
Windows 7
Lens 3.5.3

I resolved it (work around) by manually downloading kubectl for the given version and placing it in the above mentioned folder before starting up Lens.

Thanks @nevalla I will check with 3.6.0

Hi, Lens update itself this morning to 3.6.0
Got this error now, on 1.18.8 kubectl.exe

Windows 10
Lens 3.6.0

Lens is not usable, trying to downgrade to 3.5.3

EDIT
Downgrade not working neither, the message dialog is less frequent but still broken :(
But workaround, manual download, works also in 3.6.0 with kubectl.exe 1.18.8

With 3.6.3 it's even worse. Getting the error every few seconds (2-10 seconds). Totally bad experience as you need to click it away ervery time.

With 3.6 you can define Download directory in preferences? Does that help? Also it's possible to disable downloading kubectl binaries and define path to your own kubectl binary.

Setting the path to my own kubectl binary works! Setting a different path, for example the desktop does not work.

Setting the path to my own kubectl binary works! Setting a different path, for example the desktop does not work.

when you defined desktop, did you see any binaries downloaded? Trying to figure out what is the actual problem here. I thought that app will release the lock on all situations, but apparently I am wrong.

when you defined desktop, did you see any binaries downloaded? Trying to figure out what is the actual problem here. I thought that app will release the lock on all situations, but apparently I am wrong.

It created the directory Desktop\binaries\1.18.8 and the kubectl.exe is just 0kb in size.

Hi, still happens in 3.6.7 on win10 :(
Are there any workarounds?

The problem is with the 0KB kubectl.exe file. Download kubectl manually from Kubernetes stores e.g. in my case https://storage.googleapis.com/kubernetes-release/release/v1.16.14/bin/windows/amd64/kubectl.exe and replace 0KB file.

image

This works for me!

The problem is with the 0KB kubectl.exe file. Download kubectl manually from Kubernetes stores e.g. in my case https://storage.googleapis.com/kubernetes-release/release/v1.16.14/bin/windows/amd64/kubectl.exe and replace 0KB file.

This works for me!

That worked also for me sometime. But not always and you need to override it way too often.

Thanks @Ghebrehiywet : it works for me, seems to be a good workaround.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fjudith picture fjudith  路  4Comments

jtackaberry picture jtackaberry  路  6Comments

snowmoonsoftware picture snowmoonsoftware  路  4Comments

HristoA picture HristoA  路  6Comments

geruetzel picture geruetzel  路  6Comments