Azure / Azure/iotedgedev

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

Open
#605 2 comments 0 reactions 0 assignees View on GitHub
bug triage
Dominant language
Python
Stars
166
Forks
76
PR merge metrics
No merged PRs in 30d

Description

### 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)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.