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

File in use error when validating job on windows #1714

Closed
wstaples opened this issue Sep 16, 2016 · 18 comments
Closed

File in use error when validating job on windows #1714

wstaples opened this issue Sep 16, 2016 · 18 comments

Comments

@wstaples
Copy link

If you have a question, prepend your issue with [question] or preferably use the nomad mailing list.

If filing a bug please include the following:

Nomad version

Nomad v0.4.1

Operating system and Environment details

Windows 7 64-bit

Issue

When validating a job file with nomad validate <job_file> I receive the error
Error getting job struct: Error getting jobfile from "example.nomad": remove C:\Users\user\AppData\Local\Temp\jobfile382992987: The process cannot access the file because it is being used by another process.

This works with Nomad 0.4.0

Reproduction steps

1 nomad init
2 nomad validate example.nomad

Nomad Server logs (if appropriate)

I'm not running this as a client or server. Just using it to validate job files

@mwieczorek
Copy link
Contributor

I think it's the same problem as in #1690
Can you build from master and check?

@dadgar
Copy link
Contributor

dadgar commented Nov 10, 2016

Going to close this as it has been quite a while and the same fix @mwieczorek references should fix this too. Feel free to reopen if you are still affected by this.

Thank,
Alex

@dadgar dadgar closed this as completed Nov 10, 2016
@wstaples
Copy link
Author

Sorry it took so long but I have never setup a go environment. I have everything setup used go get github.com/hashicorp/nomad. in the bin directory I now have a nomad.exe that reports version v0.5.0-rc2. When I run nomad I'm using the full path to the executable located in the bin folder.

I type nomad init then nomad validate example.nomad and I recive the following error:
Error getting job struct: Error getting jobfile from "example.nomad": symlink C:\Users\username\go_workspace\example.nomad C:\Users\username\AppData\Local\Temp\jobfile616974243: A required privilege is not held by the client.

I have tried locating the example.nomad file in various directories that I know I have write permission to. This does work if I run from an elevated command prompt.

@dadgar
Copy link
Contributor

dadgar commented Nov 10, 2016

@wstaples I am assuming same error for nomad run example.nomad? Re-opening.

@dadgar dadgar reopened this Nov 10, 2016
@dadgar
Copy link
Contributor

dadgar commented Nov 10, 2016

@mwieczorek Any ideas as to the cause?

@dadgar
Copy link
Contributor

dadgar commented Nov 10, 2016

@wstaples What version of Windows?

@wstaples
Copy link
Author

wstaples commented Nov 10, 2016

Windows 7 64-bit. Yes I receive the same error running nomad run example.nomad

@mwieczorek
Copy link
Contributor

@dadgar Looks like nomad cannot create symlink
I checked 0.5RC2 on Windows 10 and everything is working ok.

A required privilege is not held by the client

Quick search and I found this:
http://stackoverflow.com/questions/23217460/how-to-create-soft-symbolic-link-using-java-nio-files

@wstaples Can you try that solution?

@jrusiecki
Copy link

Hi, where can I get windows 64bit binary 0.5RC2 ? Regards. Qba.

@mwieczorek
Copy link
Contributor

@jrusiecki https://releases.hashicorp.com/nomad/0.5.0-rc2/

@jrusiecki
Copy link

Thx. Dziękuję.

@wstaples
Copy link
Author

@mwieczorek

Unfortunately this did not work.

This may work for a windows limited user account but it will not work for users in the 'administrator' group. As you can see here: http://superuser.com/a/376141. I tried adding my user to the list anyway and restarted but no luck. Using run as which was suggested in the superuser thread would require a user to enter their password or have the guest account enabled neither of which I would recommend. So it seems like nomad would have to test if the user is a member of the administrators group and if so elevate the session.

@mwieczorek
Copy link
Contributor

@wstaples maybe it's something related to win7. if I find time I'll try to build box (https://github.com/joefitzgerald/packer-windows/blob/master/windows_7.json) and test it.

@ninoles
Copy link
Contributor

ninoles commented Nov 23, 2016

I confirm is a general condition on using symlink on Windows. I have the same problem with Windows 10, and the worse part is that you cannot get this privilege if you're using Home Edition, where the only thing you can do is to always run with Elevated privileges.

Given that only nomad can accept job written in HCL, it will be a big change to my workflow if I need to transform all my templates to JSON and only used the http api for submitting. Could we get nomad accept a "copy" option to pass to go-getter or, even better, have go-getter handle this more gracefully by default? Right now, that's my only roadbloack to use all the wonderful stuff of 0.5.

@ninoles
Copy link
Contributor

ninoles commented Nov 23, 2016

Small workaround I think about, is to use 'nomad run - < file.nomad', but yes, that's only prove that I don't need extra privilege to run the job, only to create the symlink.

@mwieczorek
Copy link
Contributor

or, even better, have go-getter handle this more gracefully by default?
@ninoles So maybe it should be an issue in go-getter?

@cgbaker
Copy link
Contributor

cgbaker commented Feb 15, 2019

closing this in favor of #3491

@cgbaker cgbaker closed this as completed Feb 15, 2019
@tgross tgross removed this from the near-term milestone Jan 9, 2020
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants