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

VM create fails to complete using bicep - setup script not executed #74

Closed
richstep opened this issue Mar 17, 2023 · 3 comments
Closed
Assignees
Labels
FarmVibes.AI setup Issues encountered during cluster setup

Comments

@richstep
Copy link

This is the error I get when following the instructions on VM-SETUP.md

{"status":"Failed","error":{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"Conflict","message":"{\r\n \"status\": \"Failed\",\r\n \"error\": {\r\n \"code\": \"ResourceDeploymentFailure\",\r\n \"message\": \"The 'AzureAsyncOperationWaiting' resource operation completed with terminal provisioning state 'Failed'.\",\r\n \"details\": [\r\n {\r\n \"code\": \"VMExtensionProvisioningError\",\r\n \"message\": \"VM has reported a failure when processing extension 'farmvibes-ai_setup_script'. Error message: \\\"Enable failed: failed to get configuration: invalid configuration: 'commandToExecute' is not specified\\\"\\r\\n\\r\\nMore information on troubleshooting is available at https://aka.ms/VMExtensionCSELinuxTroubleshoot \"\r\n }\r\n ]\r\n }\r\n}"}]}}

@brsilvarec
Copy link
Contributor

brsilvarec commented Mar 20, 2023

Hi @richstep,

Thanks for trying to use our project. Apparently, I managed to replicate the issue you are having. In my case, I copied the VM setup script without the last line.

Instead of using

az deployment group create --resource-group <resource_group> \
   --name <deployment_name> \
   --template-file  resources/vm/farmvibes_ai_vm.bicep \
   --parameters \
            ssh_public_key="$(cat ~/.ssh/id_rsa.pub)" \
            vm_suffix_name=<my_test_suffix> \
            encoded_script="$(cat resources/vm/setup_farmvibes_ai_vm.sh | gzip -9 | base64 -w0)"

I used this

az deployment group create --resource-group <resource_group> \
   --name <deployment_name> \
   --template-file  resources/vm/farmvibes_ai_vm.bicep \
   --parameters \
            ssh_public_key="$(cat ~/.ssh/id_rsa.pub)" \
            vm_suffix_name=<my_test_suffix> \

Observe the missing encoded_script="$(cat resources/vm/setup_farmvibes_ai_vm.sh | gzip -9 | base64 -w0)" line.

image

Please, also certify yourself you are using the repository root when trying to execute the command. I believe executing the full command should fix the issue.

Please, let me know if this solves your issue...

@richstep
Copy link
Author

When I run it via WSL I get a working VM with git, python, and docker installed. When I run it in Windows via Powershell 7, I get the same error. I think it's because I don't have gzip installed, which looks like a complicated install.

I worked around the gzip issue and got a working VM by using 7zip.

First compress the .sh file in gzip format:
& "C:\Program Files\7-Zip\7z.exe" a -tgzip -mx=5 setup_farmvibes_ai_vm.gz resources/vm/setup_farmvibes_ai_vm.sh

Then convert it to base64:
$encodedScript = [Convert]::ToBase64String([System.IO.File]::ReadAllBytes("C:\Users\xxxxxx\source\repos\github\farmvibes-ai\setup_farmvibes_ai_vm.gz"))

Finally the creation of the VM:
az deployment group create --resource-group xxxxxxx --name dep006 --template-file resources/vm/farmvibes_ai_vm.bicep --parameters ssh_public_key="$(cat ~/.ssh/xxxxxx.pub)" vm_suffix_name="xxxx" encoded_script=$encodedScript

gzip error message:
image

@brsilvarec
Copy link
Contributor

Thanks for you input @richstep. Happy to know you worked around it.

@rafaspadilha rafaspadilha added the FarmVibes.AI setup Issues encountered during cluster setup label May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FarmVibes.AI setup Issues encountered during cluster setup
Projects
None yet
Development

No branches or pull requests

4 participants