Jump to content
dmacias

Wake on Lan for Virtual Machines for 6.1+

82 posts in this topic Last Reply

Recommended Posts

6.6.2.  Should be the latest one.    

No change with your latest update that I just installed.

 

Is the VM stopped or paused? It has to be shutdown or hibernated. It can't be sleeping or in any other state. I would stop the service. Then run "ps aux | grep libvirtwol". To make sure another instance isn't running then start the service and run that again. You can also run manually /etc/rc.d/rc.libvirtwol start/stop. You should see /usr/bin/python /usr/local/emhttp/plugins/libvirtwol/scripts/libvirtwol.py br0 running.

 

Edit: also is your bridge named BR0 or br0? Could make a difference. The service gets this from /boot/config/domain.cfg

 

 

Share this post


Link to post
5 hours ago, Mysticle31 said:

6.6.2.  Should be the latest one.

That version has some issues with VM's not reporting their state correctly. Update and try again.

Share this post


Link to post

6.6.2 not latest...I just installed like...2 days ago.

 

Anyhow, works!  For some reason, the script was using virbr0.  I even have br0 specified in the default network for VMs.  Thanks!  ps aux and grep...my linux/unix knowledge is so bad..need to mess around some more.

 

Would virbr0 even work?  I thought that was like a NAT for VMs you dont want to directly expose to the network.  The script is looking at the packets coming in off eth0 and then looking up a mac address from the specified network (br0/virbr0/whatever) and running the command to start the vm, right?

Share this post


Link to post



6.6.2 not latest...I just installed like...2 days ago.
 
Anyhow, works!  For some reason, the script was using virbr0.  I even have br0 specified in the default network for VMs.  Thanks!  ps aux and grep...my linux/unix knowledge is so bad..need to mess around some more.
 
Would virbr0 even work?  I thought that was like a NAT for VMs you dont want to directly expose to the network.  The script is looking at the packets coming in off eth0 and then looking up a mac address from the specified network (br0/virbr0/whatever) and running the command to start the vm, right?


virbr0 would not work. The script monitors all packets looking for wol packets on the bridged network for your VMs. It gets the bridge name from BRNAME in /boot/config/domain.cfg. Do you have that variable in the domain.cfg? Maybe that variable isn't set anymore? Do you have bridging enabled in network settings?

Share this post


Link to post
15 hours ago, dmacias said:


 

 


virbr0 would not work. The script monitors all packets looking for wol packets on the bridged network for your VMs. It gets the bridge name from BRNAME in /boot/config/domain.cfg. Do you have that variable in the domain.cfg? Maybe that variable isn't set anymore? Do you have bridging enabled in network settings?

 

I have BRNAME in domain.cfg and it's set to BR0.  Bridging is enabled in settings.   I guess something just went funky.  Or maybe I messed with it some point while poking around with unraid.  I remember removing an reinstalling the plugin though after when I was done messing with things.  

Share this post


Link to post
I have BRNAME in domain.cfg and it's set to BR0.  Bridging is enabled in settings.   I guess something just went funky.  Or maybe I messed with it some point while poking around with unraid.  I remember removing an reinstalling the plugin though after when I was done messing with things.  
I was wondering if your BRNAME was actually capitalized as BR0? It may have an affect on the python script and command line. While unRAID is case sensitive, maybe the python script doesn't handle it well. You had mentioned earlier running the command line and using br0 and it worked.

Share this post


Link to post

I've been working with ipmi and vm's recently and I think VirtualBMC would be a great addition to this plugin.  You already have libvirt-python and the only other requirement to get it installed via pip is subprocess32 (if using python 2) which I had no problem building once I installed the build dependencies in unraid from slackware64-current repo.  Pip will build it fine but the slackbuild is more convenient.

 

Would you consider adding it?  I would be happy to help or collaborate.

Share this post


Link to post

Hmm, I can't seem to get this working.  I downloaded the plugin, and installed Python from the Nerd Tools plugin (v2.7.14a) and used the same android app (as well as a smartthings automation app called WebCore) to send a WoL command using the MAC address found in the VM config, but so far nothing.

 

Any suggestions as to what I could try?

 

Share this post


Link to post
Hmm, I can't seem to get this working.  I downloaded the plugin, and installed Python from the Nerd Tools plugin (v2.7.14a) and used the same android app (as well as a smartthings automation app called WebCore) to send a WoL command using the MAC address found in the VM config, but so far nothing.
 
Any suggestions as to what I could try?
 
Look through the past few posts about vm bridge name. I also have a wakeonlan plugin you could try

Share this post


Link to post
I've been working with ipmi and vm's recently and I think VirtualBMC would be a great addition to this plugin.  You already have libvirt-python and the only other requirement to get it installed via pip is subprocess32 (if using python 2) which I had no problem building once I installed the build dependencies in unraid from slackware64-current repo.  Pip will build it fine but the slackbuild is more convenient.

 

Would you consider adding it?  I would be happy to help or collaborate.

I'll see about creating a slackware package and adding it to the plugin

 

Explain to me a little more how it works

Share this post


Link to post

I'm having problems with this as well; I can confirm br0 is set right and:
 

root@Tower:~# ps aux | grep libvirtwol
root     19502  0.0  0.0   9812  2136 pts/2    S+   19:33   0:00 grep libvirtwol
root     22023  0.0  0.0 143204 22008 ?        S    19:15   0:00 /usr/bin/python /usr/local/emhttp/plugins/libvirtwol/scripts/libvirtwol.py br0

is the output from checking what's running while the plugin is enabled.

 

I've never been able to get this plugin to work for a couple years now, it hasn't been a big deal until now where I want to add some automations with something else sending a magic packet to turn on some VMs. I'm interested in trying any other alternative as well, given the situation.

Share this post


Link to post

I figured out that the plugin worked fine, the problem was my network environment -- once I fixed what was blocking the magic packet everything does work fine. Thanks for the great plugin!

Share this post


Link to post
On 12/28/2018 at 12:24 PM, dmacias said:

I'll see about creating a slackware package and adding it to the plugin

 

Explain to me a little more how it works

Basically it lets you use ipmitool to control VM's over the network

  • Power the virtual machine on, off, graceful off, NMI, and reset
  • Check the power status
  • Set the boot device
  • Get the current boot device

Very useful for automation tools that already support ipmi for these tasks for baremetal servers.

 

Here's an example of how it's configured and used.  https://x-vps.com/blog/?p=16

 

Share this post


Link to post
2 hours ago, brunnels said:

Basically it lets you use ipmitool to control VM's over the network

  • Power the virtual machine on, off, graceful off, NMI, and reset
  • Check the power status
  • Set the boot device
  • Get the current boot device

Very useful for automation tools that already support ipmi for these tasks for baremetal servers.

 

Here's an example of how it's configured and used.  https://x-vps.com/blog/?p=16

 

Ok thanks. I didn't see the port option on the github page. So I did know how it would control different vm's.

Share this post


Link to post
14 hours ago, AboveUnrefined said:

I figured out that the plugin worked fine, the problem was my network environment -- once I fixed what was blocking the magic packet everything does work fine. Thanks for the great plugin!

Good to hear.

Share this post


Link to post
On 12/28/2018 at 1:22 PM, dmacias said:
On 12/27/2018 at 2:33 PM, Coolsaber57 said:
Hmm, I can't seem to get this working.  I downloaded the plugin, and installed Python from the Nerd Tools plugin (v2.7.14a) and used the same android app (as well as a smartthings automation app called WebCore) to send a WoL command using the MAC address found in the VM config, but so far nothing.
 
Any suggestions as to what I could try?
 

Look through the past few posts about vm bridge name. I also have a wakeonlan plugin you could try

My bridge name is br0 and bridging is enabled in my network settings.

Edited by Coolsaber57

Share this post


Link to post
On 12/29/2018 at 8:29 PM, AboveUnrefined said:

I figured out that the plugin worked fine, the problem was my network environment -- once I fixed what was blocking the magic packet everything does work fine. Thanks for the great plugin!

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

Share this post


Link to post
I've been working with ipmi and vm's recently and I think VirtualBMC would be a great addition to this plugin.  You already have libvirt-python and the only other requirement to get it installed via pip is subprocess32 (if using python 2) which I had no problem building once I installed the build dependencies in unraid from slackware64-current repo.  Pip will build it fine but the slackbuild is more convenient.
 
Would you consider adding it?  I would be happy to help or collaborate.
I worked on this a bit. It'll take a bit more time to figure out which other packages will be needed to just run it. Most likely it will require all the packages from the requirements.txt but some of those also require other packages too. On my dev system pip installed 20+ packages but all those may not be needed to run it.

Share this post


Link to post
What did you end up needing to do in your network environment?
Maybe describe your network environment and equipment a bit. Something may be blocking the wol packets also what motherboard and network card. You may need to enable wol in your bios.

Share this post


Link to post
Posted (edited)
1 hour ago, dmacias said:
On 12/30/2018 at 11:16 PM, Coolsaber57 said:
What did you end up needing to do in your network environment?

Maybe describe your network environment and equipment a bit. Something may be blocking the wol packets also what motherboard and network card. You may need to enable wol in your bios.

Hey there, sorry I was just going to investigate my setup if I could get a tip on where to start from the other guy, but my setup includes:

 

  1. Ubiquiti USG
  2. Ubiquiti US-48 switch
  3. Gigabyte GA-7PESH2 dual socket LGA2011 mainboard w/ 2x e5-2630 v2, connected via 10gbase-T to sfp+ to the US-48

  4. Sending WoL packets via phone app and WebCore (home automation s/w)

I'll see how to enable WoL in the bios in my MB, I wasn't aware that was needed.

 

Edit: the default setting for WoL is ON on my MB, and I can double check when I get home, but I would imagine it's enabled.

Edited by Coolsaber57

Share this post


Link to post
Posted (edited)
12 hours ago, dmacias said:

I worked on this a bit. It'll take a bit more time to figure out which other packages will be needed to just run it. Most likely it will require all the packages from the requirements.txt but some of those also require other packages too. On my dev system pip installed 20+ packages but all those may not be needed to run it.

I installed a bunch of build packages I download from slackware64-current repo and ran the slackbuild for subprocess32 I linked before.

Then I installed that package, libvirt-python (from slackware64-current), and python-setuptools (from slackware64-current).

Finally I ran `pip install virtualbmc`

 

None of the build packages were needed for the install detailed in the log file. 

I did a reboot to make sure they were all gone before doing it.

 

I attached the log and list of packages I installed to make the slackbuild.  Also my subprocess package in case it helps.

virtualbmc-install.txt

build-packages.txt

subprocess32-3.5.2-x86_64-2_SBo.tgz

Edited by brunnels

Share this post


Link to post
20 hours ago, dmacias said:

I worked on this a bit. It'll take a bit more time to figure out which other packages will be needed to just run it. Most likely it will require all the packages from the requirements.txt but some of those also require other packages too. On my dev system pip installed 20+ packages but all those may not be needed to run it.

I was thinking on this more last night and since a lot of small python packages get installed by pip could you just run the pip install during the plugin install script?  It's pretty fast so I don't think it would be a problem.

 

Another alternative which would probably be useful for a lot of people or other plugins would be a new plugin for "persistent pip" that essentially restores the state of /usr/lib64/python2.7/site-packages/ from the flash drive on boot.

Share this post


Link to post
Hey there, sorry I was just going to investigate my setup if I could get a tip on where to start from the other guy, but my setup includes:
 
  1. Ubiquiti USG
  2. Ubiquiti US-48 switch
  3. Gigabyte GA-7PESH2 dual socket LGA2011 mainboard w/ 2x e5-2630 v2, connected via 10gbase-T to sfp+ to the US-48
  4. Sending WoL packets via phone app and WebCore (home automation s/w)
I'll see how to enable WoL in the bios in my MB, I wasn't aware that was needed.
 
Edit: the default setting for WoL is ON on my MB, and I can double check when I get home, but I would imagine it's enabled.
I have similar hardware (usg pro and usw 24). The only thing I can think of is if you have some traffic blocked or if enabled, an ISP rule that blocks magic packets. Also you need to be on the same subnet as the unraid server. The script works by listening to all packets on udp port 7, udp port 9 or ether proto 0x0842 and matching mac in the magic packet to mac for virtual machine.

Share this post


Link to post



I was thinking on this more last night and since a lot of small python packages get installed by pip could you just run the pip install during the plugin install script?  It's pretty fast so I don't think it would be a problem.
 
Another alternative which would probably be useful for a lot of people or other plugins would be a new plugin for "persistent pip" that essentially restores the state of /usr/lib64/python2.7/site-packages/ from the flash drive on boot.


Along with setuptools and subprocess32 it needs pbr, six, enum34, pycparser, cffi, asn1crypto, idna, ipaddress, cryptography, pyghmi, PyYAML, pyperclip, contextlib2, pyparsing, wcwidth, cmd2, stevedore, PrettyTable, unicodecsv, cliff, pyzmq.

As a rule none of my plugins need to download anything on server boot. There have been too many problems in the past with servers hanging or not working due to connectivity issues at boot. I would just prefer everything be there on the flash drive already.

I could install subprocess32 and setuptools and package everything else into one package (which I don't necessarily like) or just create 21 different ones.

Share this post


Link to post
Posted (edited)
9 hours ago, dmacias said:

I could install subprocess32 and setuptools and package everything else into one package (which I don't necessarily like) or just create 21 different ones.

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.

Edited by brunnels

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.