Azure / iotedge-eflow

Azure IoT Edge for Linux on Windows
https://aka.ms/azeflow-docs
MIT License
49 stars 29 forks source link

E-Flow - disk sharing with modules #3

Closed mjeannin2 closed 3 years ago

mjeannin2 commented 3 years ago

Hello,

I'm testing the new Eflow version of IotEdge. I'm facing a subject. I need to share hosts informations with module. Does exist a powershell script or a documentation to share a disk with the VM then with the docker. Is it plan ?

If it doesn't exist, I will follow the standard way to share host disk with Hyper-V VM.

Thanks for your feedback, Regards, Maxime.

TerryWarwick commented 3 years ago

@mjeannin2,

There are a few different options.

  1. Map host file system to the VM Since the virtual machine for Azure EFLOW is based on Hyper-V this might be possible to share the host file system with the VM by following the instructions in this StackOverflow answer: Please note, that we have not tried this scenario ourselves, but would be very interested to hear back from you on your experience.

  2. Use SCP.EXE from the PowerShell command line to copy terfiles into the EFLOW VM. SCP uses an underlying SSH channel for file transfers. The authentication between the host OS and Linux VM requires an SSH key which is located in the file 'id_rsa' in the EFLOW installation folder. A file transfer can be executed via: C:\WINDOWS\System32\OpenSSH\scp.exe -i 'C:\Program Files\Azure IoT Edge\id_rsa' <sourcefile> iotedge-user@<vmip>:<desinationfile>​

  3. Interop between Windows process and Linux module This involves a Windows process setup as a companion to a Linux module to send information directly to the Linux Module running inside the VM. We have a few interop samples available for this at https://aka.ms/winiotsamples.

Regards,

Terry

mjeannin2 commented 3 years ago

Many thanks Terry I started a script based on SCP command. Sometime, I encounter a problem regarding the SSH key : the SSH command asks me the password even if i added the option -i with the private key. Is it a flow about the keys ? For example when the VM is restarted ?

TerryWarwick commented 3 years ago

@mjeannin2 ,

Would you mind giving us a little background on what you are trying to accomplish with disk access? Are you coping data files into the VM then consuming them with your module to send to the cloud?

What edition/version of Windows are you using and is it a VM or running on physical hardware. If it is a VM, is it running locally or as an Azure VM? Are you running the SSH command from the local host or remotely?

Finally, can you provide step by step instructions that would help us reproduce the issue that you are encountering?

Terry

mjeannin2 commented 3 years ago

Hello

Yes, I'm copying some configuration files used by the module with a disk binding. So I'm trying to copy files to the dedicated place into the VM I execute a schedule task to copy this files with a dedicated script : scp.exe -i "C:\Program Files\Azure IoT Edge\id_rsa" "C:\Program Files (x86)\Sentinel\iotconfig.ini" iotedge-user@192.168.1.101:/home/iotedge-user

About the host, it is a Windows workstation (not a VM neither an Azure compute) : Windows version is 10.0.17763.437

Not sure it can help you but when I try to execute the command Ssh-EflowVm, I receive this message :

[02/18/2021 09:04:38] Exception caught!!!

When I try to connect to the Eflow VM from the host using the address given by Hyper-V and using the key file, it asks me the password

So in order to recap, I see 2 problems :

Regards Maxime

ms-mahuber commented 3 years ago

Taking all the errors into account, it seems to me that there might have been some issues at deploy time?

Also, in the scp command above, are you sure this copies iotconfig.ini into the /home/iotedge-user folder? It looks to me like it would attempt to overwrite the 'iotedge-user' folder as a file (I may be wrong on this but have you tried /home/iotedge-user/iotconfig.ini?)

TerryWarwick commented 3 years ago

@mjeannin2 ,

An easy way to check the status of WSSDAgent is to execute the following command at an elevated PowerShell command prompt.

Get-Service wssdagent

If it is not running then it appears that you may have a larger issue with your specific EFLOW deployment.

Run the following command to check the status of the EFLOW virtual machine

Get-VM | Where-Object { $_.Name -like '*EFLOW'}

Terry

TerryWarwick commented 3 years ago

@mjeannin2,

Were you able to overcome the disk sharing issue? If you are still experiencing an issue with this please help us understand exactly what you are experiencing. If you are no longer having an issue with this, please Close the issue report.

Thank you

Terry Warwick

ytzh101 commented 3 years ago

@mjeannin2 ,

An easy way to check the status of WSSDAgent is to execute the following command at an elevated PowerShell command prompt.

Get-Service wssdagent

If it is not running then it appears that you may have a larger issue with your specific EFLOW deployment.

Run the following command to check the status of the EFLOW virtual machine

Get-VM | Where-Object { $_.Name -like '*EFLOW'}

Terry

I am facing the same issue here. `PS C:\windows\system32> Ssh-EflowVm
[06/03/2021 09:57:31] Exception caught!!!

Following your suggestions, PS C:\windows\system32> Get-Service wssdagent Status Name DisplayName ------ ---- ----------- Stopped wssdagent WSSD Agent Service

PS C:\windows\system32> Get-VM | Where-Object { $_.Name -like '*EFLOW'}
Name State CPUUsage(%) MemoryAssigned(M) Uptime Status Version ---- ----- ----------- ----------------- ------ ------ ------- USWE-2LFRPV2-L-EFLOW Running 0 1024 00:06:06.5930000 Operating normally 9.0

I am having a larger issue here. How can I set the WSSDAgent to automatically restart? Thanks for your help.

ytzh101 commented 3 years ago

@mjeannin2 , An easy way to check the status of WSSDAgent is to execute the following command at an elevated PowerShell command prompt. Get-Service wssdagent If it is not running then it appears that you may have a larger issue with your specific EFLOW deployment. Run the following command to check the status of the EFLOW virtual machine Get-VM | Where-Object { $_.Name -like '*EFLOW'} Terry

I am facing the same issue here. PS C:\windows\system32> Ssh-EflowVm [06/03/2021 09:57:31] Exception caught!!! - wssagent is unreachable, please retry... at line 1682

Following your suggestions, PS C:\windows\system32> Get-Service wssdagent Status Name DisplayName ------ ---- ----------- Stopped wssdagent WSSD Agent Service

PS C:\windows\system32> Get-VM | Where-Object { $_.Name -like '*EFLOW'} Name State CPUUsage(%) MemoryAssigned(M) Uptime Status Version ---- ----- ----------- ----------------- ------ ------ ------- USWE-2LFRPV2-L-EFLOW Running 0 1024 00:06:06.5930000 Operating normally 9.0

I am having a larger issue here. How can I set the WSSDAgent to automatically restart? Thanks for your help.

Update: I fixed the WSSDAgent problem on my machine. In Windows10, run Services.msc as admin, find the WSSD Agent Service, set the Startup Type to Automatic. On the left, start the service, no reboot is needed.

fcabrera23 commented 3 years ago

@ytzh101,

That's great news - the WSSD Agent service should be automatic by default when installing EFLOW, but if for some reason it's not, then that's a great workaround.