Jump to content
dmacias

Wake on Lan for Virtual Machines for 6.1+

97 posts in this topic Last Reply

Recommended Posts

Found slackbuilds for most of those:

pbr six enum34 pycparser cffi idna ipaddress cryptography

PyYAML pyperclip pyparsing wcwidth stevedore PrettyTable

unicodecsv pyzmq

 

Didn't see them for these:

asn1crypto pyghmi contextlib2 cmd2 cliff

 

python-six and python-idna are actually in official repos.

I decided to use a python virtual environment and load everything into one package. Created multiple packages based on unraid version/libvirt version. I also add a Virtual BMC service to the VM settings page. I'll add more Virtual BMC settings to the WebGUI when I have time. E.g. vm's and port settings.  Also I wondering if you knew where Virtual BMC stored the vm/ports settings, so they can be restored on boot.

 

Edit: Nm I figured out where the settings are stored. They are in the user home directory. So /root/.vbmc

 

Share this post


Link to post

Awesome work.  Thank you.  I'm testing it out now.

 

One note so far.  The verbose on the uninstall logging to the webpage makes it take a really long time delete all the files in the virtual environment 

Share this post


Link to post

Just been trying to get this to work with no success until i realised my VLANS were causing the issue.

 

I worked around it by overriding the code in the /etc/rc.d/rc.libvirtwol file.

 

i replaced the variable $BRNAME directly with the hard coded value br0.1 (for br0 vlan 1) is it possible to get some sort of option for this added to the plugin? 

Share this post


Link to post
On 1/11/2019 at 1:45 PM, Fma965 said:

Just been trying to get this to work with no success until i realised my VLANS were causing the issue.

 

I worked around it by overriding the code in the /etc/rc.d/rc.libvirtwol file.

 

i replaced the variable $BRNAME directly with the hard coded value br0.1 (for br0 vlan 1) is it possible to get some sort of option for this added to the plugin? 

Is your Default network bridge not set to bro.1? That is what the variable $BRNAME is.

Share this post


Link to post
On 1/11/2019 at 3:45 PM, Fma965 said:

Just been trying to get this to work with no success until i realised my VLANS were causing the issue.

 

I worked around it by overriding the code in the /etc/rc.d/rc.libvirtwol file.

 

i replaced the variable $BRNAME directly with the hard coded value br0.1 (for br0 vlan 1) is it possible to get some sort of option for this added to the plugin? 

I have VMs on both br0 and br0.40 VLAN (default) and the script will not start w/ the variable $BRNAME or if br0.40 is hard coded.  If I hard code br0, the service reports as started but I cannot seem to start any VMs via WoL

 

Any advice?

 

Also, how does one access VBMC?

 

 

EDIT:
I am running 6.6.6

Edited by therapist

Share this post


Link to post
On 1/30/2019 at 1:07 PM, therapist said:

I have VMs on both br0 and br0.40 VLAN (default) and the script will not start w/ the variable $BRNAME or if br0.40 is hard coded.  If I hard code br0, the service reports as started but I cannot seem to start any VMs via WoL

 

Any advice?

 

Also, how does one access VBMC?

 

 

EDIT:
I am running 6.6.6

It not necessary to hard code anything. Everything works fine for me as is. I have the Default vm bridge set to br0.80. I doesn't really matter what bridge the VMs are on. The default bridge is what matters as it is the interface the script will be listening on. It will be looking for any magic packet. It will then compare the magic packet mac to all the vm macs and start a matching vm. Wol packets have to be broadcast on the same network. Are you setting your Default vm bridge to br0.40 in the Unraid webgui? Are you sending the wol from the br0.40 network? I can send etherwake -i br0.40 vmmacaddress from the server and the vm starts up. The VBMC is command line only for now. You'll have to google how to use it. But basically you assign vms to different ports and then you use ipmi commands/software to send ipmi commands to server.ip:vmport#. You'll need something like my cmdline plugin to save and restore your /root directory on server restart also. All the VBMC settings are saved in /root/.vbmc

Share this post


Link to post
On 12/30/2018 at 11:16 PM, Coolsaber57 said:

What did you end up needing to do in your network environment?

Hey, sorry for the delay. The problem had to do with network access in a virtual machine container -- it wasn't so much the network itself as the container's access to the network.

Share this post


Link to post

WOL plugin daemon is running ,but in fact wont work and no config at all

Nerdpack all plugins installed.

After research found 

Quote

 /usr/local/emhttp/plugins/libvirtwol/scripts/libvirtwol.py br0
Traceback (most recent call last):
  File "/usr/local/emhttp/plugins/libvirtwol/scripts/libvirtwol.py", line 26, in <module>
    import pcap
ImportError: No module named pcap
 

Any solution please?

Edited by ingus16

Share this post


Link to post
2 hours ago, ingus16 said:

Nerdpack all plugins installed.

I'll let someone else comment on WOL plugin, but what do you mean by the above? Do you mean that you have installed every single one of the packages in Nerdpack? It is probably a bad idea to randomly install a lot of things that you don't know what they are and aren't going to use. I recommend only installing packages that you know what they are and that you actually intend to use.

Share this post


Link to post
7 hours ago, ingus16 said:

WOL plugin daemon is running ,but in fact wont work and no config at all

Nerdpack all plugins installed.

After research found 

Any solution please?

The way you're trying to run it won't work. Everything is loaded under a python virtual environment.

/usr/share/libvirt-python-env/bin/python /usr/local/emhttp/plugins/$prog/scripts/libvirtwol.py $BRNAME

The config is under VM Manager settings.  All you need from NerdPack is python2.

Share this post


Link to post

I am using unraid 6.8, and status for "Libvirt wake on lan" always shows stopped. I have installed python2 in nerd and nothing shows in log

/var/log/libvirt/libvirtwakeonlan.log it's empty.

execute /etc/rc.d/rc.libvirtwol start/stop  without error

 

Share this post


Link to post

Hi, i was not able to WoL with my VM, i run a pfsense router as VM,

i have my pfsense interface as vnet0 as the same ip address as the VM and the UNRAID GUI also another PC with the same ip address range,

my pfsense was able to wake the physical PC but not the VM :(

not sure where i did wrong.

Share this post


Link to post
I am using unraid 6.8, and status for "Libvirt wake on lan" always shows stopped. I have installed python2 in nerd and nothing shows in log
/var/log/libvirt/libvirtwakeonlan.log it's empty.
execute /etc/rc.d/rc.libvirtwol start/stop  without error
 
Did you try and stop then start from the settings page? You can check if it's running with
ps aux | grep libvirtwol

. It does depend on your default network bridge in the vm settings. This is the actual command and may give you some info as to why it's not starting. Just substitute br0 with your default network bridge

/usr/share/libvirt-python-env/bin/python /usr/local/emhttp/plugins/libvirtwol/scripts/libvirtwol.py br0

Share this post


Link to post
Hi, i was not able to WoL with my VM, i run a pfsense router as VM,
i have my pfsense interface as vnet0 as the same ip address as the VM and the UNRAID GUI also another PC with the same ip address range,
my pfsense was able to wake the physical PC but not the VM
not sure where i did wrong.
What is your default network bridge in the vm settings? The plugin relies on that. I seem to remember to remember something about dockers and vm's not being about to see unraid. Something to do with network isolation. Try waking with another device on the same network as your unraid server.

Share this post


Link to post
2 hours ago, dmacias said:

Did you try and stop then start from the settings page? You can check if it's running with


ps aux | grep libvirtwol
 

. It does depend on your default network bridge in the vm settings. This is the actual command and may give you some info as to why it's not starting. Just substitute br0 with your default network bridge


/usr/share/libvirt-python-env/bin/python /usr/local/emhttp/plugins/libvirtwol/scripts/libvirtwol.py br0
 

 

Hello, I ssh into my unraid

I got following

root@unraid:~# ps aux | grep libvirtwol
root      2085  0.0  0.0   3912  2140 pts/6    S+   23:37   0:00 grep libvirtwol

but for running

root@unraid:~# /usr/share/libvirt-python-env/bin/python /usr/local/emhttp/plugins/libvirtwol/scripts/libvirtwol.py br0

It returned nothing, and I could only see the cursor is waiting. After I checked the status, it shows running and even I set it to no, it's still running. After I closed my ssh session, it's stopped again and I didn't get any message.

 

Thanks for your reply. I finally figured it out. As you said, the plugin seem monitor the br0 as default one and I was using another br0.10 (I have several vlan). After I made the vm default network to br0, the status shows correctly in web gui. And your plugin works well if I set vm client network to br0 as NIC.

But the issue is that all my vm are running in br0.10, and if I set the vm default network to br0.10, your plugin will never start from web gui.

 

 

 

Edited by Lilarcor

Share this post


Link to post
On 1/11/2020 at 10:02 PM, dmacias said:
On 1/10/2020 at 6:16 PM, Ong Hui Hoong said:
Hi, i was not able to WoL with my VM, i run a pfsense router as VM,
i have my pfsense interface as vnet0 as the same ip address as the VM and the UNRAID GUI also another PC with the same ip address range,
my pfsense was able to wake the physical PC but not the VM emoji20.png
not sure where i did wrong.

What is your default network bridge in the vm settings? The plugin relies on that. I seem to remember to remember something about dockers and vm's not being about to see unraid. Something to do with network isolation. Try waking with another device on the same network as your unraid server.

 

i did try, and it work on my physical PC, the WoL from the VM (pfsense) br0 to wake my PC over the network.

but i cannot wake another VM within the unraid Server.

 

pfsense (UNRAID VM) - another PC on the same network - can wake

Pfsense (UNRAID VM) - another VM (UNRAID VM) - cannot wake

 

all 3 is on the same network,

 

pfsense (VM in UNRAID) - 192.168.1.1/24 - Br0

physical PC - 192.168.1.10/24 - connect directly to Br0 (Eth0) on UNRAID server

VM PC - 192.168.1.31/24 - Br0

 

UNRAID Network setting

image.png.42eeb12f329a6bfd98f02f48df98eead.png

 

VM Setting

image.png.fa74038c2ca5db7ae8e170584fc6f881.png

 

VM PC

image.png.6f6f095290f1b00e7be4fd32e5d257ae.png

 

Pfsense

image.png.6d8a24895ca185a247336f28aaaf6756.png

Edited by Ong Hui Hoong

Share this post


Link to post
On 1/11/2020 at 10:02 PM, dmacias said:
On 1/10/2020 at 6:16 PM, Ong Hui Hoong said:
Hi, i was not able to WoL with my VM, i run a pfsense router as VM,
i have my pfsense interface as vnet0 as the same ip address as the VM and the UNRAID GUI also another PC with the same ip address range,
my pfsense was able to wake the physical PC but not the VM emoji20.png
not sure where i did wrong.

What is your default network bridge in the vm settings? The plugin relies on that. I seem to remember to remember something about dockers and vm's not being about to see unraid. Something to do with network isolation. Try waking with another device on the same network as your unraid server.

i just tried to wake the VM from my physical PC also, cannot :(

Share this post


Link to post

I always get „Didn't find a vm with MAC address ..." in /var/log/libvirt/libvirtwakeonlan.log, but the MAC is correct and WOL is working in my network so far (elsewise I guess I wouldn’t get that message in the first place)

I’m not using VLANs and I have br0 selected in global VM settings as well as in the individual ones...

 

Any ideas?

Share this post


Link to post

This won't even install on the latest unraid version (6.8.3)  I get Warning: mkdir(): Read-only file system in /usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/plugin on line 268
plugin: plugin: error: unable to create parent directory for /boot/config/plugins/libvirtwol/libvirt-python-env-4.10.0-x86_64-1.txz

 

Other plugins seem to install and work ok, does this need to be updated to work

Share this post


Link to post
This won't even install on the latest unraid version (6.8.3)  I get Warning: mkdir(): Read-only file system in /usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/plugin on line 268
plugin: plugin: error: unable to create parent directory for /boot/config/plugins/libvirtwol/libvirt-python-env-4.10.0-x86_64-1.txz
 
Other plugins seem to install and work ok, does this need to be updated to work
Are you logged in as root? Seems like a permissions problem on your end. Not sure. I removed it and reinstalled it just fine

Share this post


Link to post

Many thanks for this plugin worked for me sending wake from splashtop 👍

I had to send wake twice first one put the stopped vm into pause then second send set it to run.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.