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

Manual DEV machine setup described in https://github.com/Azure/iotedgedev/blob/main/docs/environment-setup/manual-dev-machine-setup.md is not working as expected #605

Open
emulic opened this issue May 12, 2023 · 2 comments
Labels
bug triage Issues that need to be looked at

Comments

@emulic
Copy link

emulic commented May 12, 2023

Description

The approach described in https://github.com/Azure/iotedgedev/blob/main/docs/environment-setup/manual-dev-machine-setup.md is not fully working on windows.
The executed command is according to the linked document:
iotedgedev solution init --template csharp
Choosing to install VM to simulate Edge Device (Create a new Virtual Machine with IoTEdge? [y/N]: y) during the execution, ends up with the following error:

SSH Key file (must be located in ~/.ssh and will be created if it doesn't exist) [id_rsa_iotedgedev]:

Creating a new Virtual Machine in 'fits4u-dev' with ssh key file 'id_rsa_iotedgedev'...

Retrieving 'SOME_DEVICE_ID' connection string...

No SSH key found at ~/.ssh/id_rsa_iotedgedev.pub. Generating a new one...

Saving key "~/.ssh/id_rsa_iotedgedev" failed: No such file or directory
ERROR: [Errno 2] No such file or directory: 'C:\\Users\\SOMEUSER\\.ssh\\id_rsa_iotedgedev.pub'
ERROR: Error while executing command: iotedgedev iothub setup --update-dotenv. Command '['iotedgedev', 'iothub', 'setup', '--update-dotenv']' returned non-zero exit status 1.

The exception comes obviously from the line 574 of azurecli.py:
os.system(f("ssh-keygen -t rsa -b 4096 -C \"iotedgedev-autogenerated\" -f ~/.ssh/{ssh_key_file} -q -N \"\""))
This seems to be known issue of ssh-keygen, where ~ can't be resolved as user profile folder under windows.

Expected behavior

The command iotedgedev solution init --template csharp is successfully executed until the end and VM with Edge Device simulation is created in Azure.

Actual behavior

Execution of the command iotedgedev solution init --template csharp fails with the following error, when chosen to create a VM:

Saving key "~/.ssh/id_rsa_iotedgedev" failed: No such file or directory
ERROR: [Errno 2] No such file or directory: 'C:\\Users\\SOMEUSER\\.ssh\\id_rsa_iotedgedev.pub'
ERROR: Error while executing command: iotedgedev iothub setup --update-dotenv. Command '['iotedgedev', 'iothub', 'setup', '--update-dotenv']' returned non-zero exit status 1.

No VM is created.

Steps to Reproduce

Execute following command on Windows 10:
iotedgedev solution init --template csharp
Executing with Administrator privileges is also not working.

Environment

iotedgedev Version: 3.3.7
Python Version: 3.6.8
Pip Version: 21.3.1
Development machine OS Version: Windows 10 Enterprise 22H2
IoT Edge device OS Version: - (this is actually the issue, Edge Device VM is not created)

@emulic emulic added bug triage Issues that need to be looked at labels May 12, 2023
@marianan
Copy link
Collaborator

@emulic thanks for letting us know of this issue. Do you have any pointers to the ssh-keygen known issue you mentioned? What are the suggested workarounds?
Also, what terminal are you running this command on? Does command prompt, Git bash and PowerShell all have this same symptom?

@emulic
Copy link
Author

emulic commented May 16, 2023

@marianan As far as I found, following workarounds might work (I haven't tested):

  1. To use absolute path C:\Users\UserName.ssh\ instead of ~\UserName.ssh as suggested in one of the comments here https://stackoverflow.com/questions/32910928/ssh-keygen-no-such-file-or-directory
  2. To just use file name without any path, this comment here is saying, the file will be by default saved to ~.ssh folder
    I tried with command prompt and PowerShell, same issue on both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage Issues that need to be looked at
Projects
None yet
Development

No branches or pull requests

2 participants