Author Topic: MD wake on Lan not working  (Read 2400 times)

jamo

  • Guru
  • ****
  • Posts: 457
    • View Profile
    • LMCE user Page
MD wake on Lan not working
« on: June 22, 2012, 09:51:16 am »
After sorting out the shutdown on my other two MDs, I'm now trying to sort out the wake-on-lan for my HP compaq 6710b notebook. It has definitely worked before and definitely has the capability (hardware) but at the moment is not working.

What I've done so far-

* Tried the "power on"  from other orbiters and that doesn't work.
* Tried running /sbin/WakeMD.sh (or something similar) with --dev and --mac options, no dice.
* Tried using ethtool -g to check that wake-on-lan is configured when the MD is up and that looks correct.

Hmmm... will probably have to do a bit more digging to find how wake-on-lan works at a lower level and see if I can do it with a crescent wrench... then if that works I will try to figure out how/why that is not happening via the normal channels! Any suggsetions/troubleshooting tips welcome.

It is a bit of a pain not being able to start this puppy remotely.

sambuca

  • Guru
  • ****
  • Posts: 439
    • View Profile
Re: MD wake on Lan not working
« Reply #1 on: June 22, 2012, 10:00:23 am »
From memory, this is what is required for wake-on-lan to work:
* It must be enabled in the BIOS
* The network card must have been enabled (by ethtool)
* The system must have wake-up enabled
   - This is done in /proc/acpi/wakeup iirc, see if there is some entries there that match your network card, or a generic PCI entry. Some googling may be required to figure this one out (I don't recall the exact command at the moment)
* The driver must support wake-on-lan. What LMCE version are you using 810 or 1004? In 810 there was some network drivers that did not set the wake-up flag correctly, and wouldn't wake-on-lan. I think it is fixed in the kernel used in 1004 but still...

br,
sambuca

jamo

  • Guru
  • ****
  • Posts: 457
    • View Profile
    • LMCE user Page
Re: MD wake on Lan not working
« Reply #2 on: June 22, 2012, 11:14:48 am »
* It must be enabled in the BIOS [TICK]
* The network card must have been enabled (by ethtool) [TICK]
* The system must have wake-up enabled
   - This is done in /proc/acpi/wakeup iirc, see if there is some entries there that match your network card, or a generic PCI entry. Some googling may be required to figure this one out (I don't recall the exact command at the moment)
* The driver must support wake-on-lan. What LMCE version are you using 810 or 1004? In 810 there was some network drivers that did not set the wake-up flag correctly, and wouldn't wake-on-lan. I think it is fixed in the kernel used in 1004 but still...

Ta, that sounds right. I think the first two are OK. I will have a look at the third (/proc/acpi/wakeup iirc or whatever) and then the fact that the driver supports it...
I'm using 1004.
My one thought is that I have deleted and recreated this media director device out of webadmin and, obviously, the same MAC address would be used as the previous (now deleted) device so I thought there might have been some config somewhere that wasn't properly purged and the system is still trying to wake the "old" device or something...

sambuca

  • Guru
  • ****
  • Posts: 439
    • View Profile
Re: MD wake on Lan not working
« Reply #3 on: June 22, 2012, 11:43:04 am »
If you use /usr/pluto/bin/WakeMD.sh --mac xxxx then it should work anyway. You could also play around with /usr/sbin/etherwake which is used in WakeMD.sh to try and wake the MD.
Using WakeMD.sh --dev will look up the MAC address from the web-admin for the MD.

I haven't heard of any problems with the drivers in 1004, but one time have to be the first  ;)

br,
sambuca

posde

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2855
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: MD wake on Lan not working
« Reply #4 on: June 22, 2012, 11:47:29 am »
And the MD must have been shutdown using LinuxMCE. I've seen cases where powering down the MD using other means causes the WOL to no longer work.

DragonK

  • Guru
  • ****
  • Posts: 429
    • View Profile
Re: MD wake on Lan not working
« Reply #5 on: June 22, 2012, 12:07:29 pm »
My wake on lan works.... Kinda....
What possy says makes sense.

If my core was swithced of due to long term powerfailure or maintenance,
 and I switch it back on again, then my Md's also boot. But when using the Power on button
In the orbiter it doesnt work.

Karel

sambuca

  • Guru
  • ****
  • Posts: 439
    • View Profile
Re: MD wake on Lan not working
« Reply #6 on: June 22, 2012, 12:28:24 pm »
One more thing that occurred to me. It seems that there are a slight difference between when you suspend a MD and when you shut it down. When shutting it down, it needs to set NETDOWN=no in /etc/default/halt to keep the network alive. Afaict, this is not required when doing suspend.

br,
sambuca

JaseP

  • Addicted
  • *
  • Posts: 526
    • View Profile
    • JaseP's LinuxMCE Wiki User page
Re: MD wake on Lan not working
« Reply #7 on: June 22, 2012, 02:53:15 pm »
Has anyone tried this on an MD when the bios is set to wake after a power loss? Some bios-es support this function. I'd actually like to use the wake on LAN to conserve power at some point in the future.

Second, semi-related question... I have an APC UPS,... Does LinuxMCE have a routine for controlled shutdown when it catches a signal from an UPS?
See my User page on the LinuxMCE Wiki for a description of my system configuration (click the little globe under my profile pic).

posde

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2855
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: MD wake on Lan not working
« Reply #8 on: June 22, 2012, 03:07:40 pm »
JaseP,

please create a new topic for the UPS question.

jamo

  • Guru
  • ****
  • Posts: 457
    • View Profile
    • LMCE user Page
Re: MD wake on Lan not working
« Reply #9 on: June 26, 2012, 08:17:17 am »
Just to add to this... I haven't got to the bottom of it yet but I have certainly tried many things - confirmed bios is enabled, confirmed via ethtool that WOL is setup for NIC. Where I am at the moment is possibly at a bug in ubuntu somewhere.... because here's what is possible-

If mains power is removed for a few seconds after shutdown and then re-connected, after *that* I can wake on lan the MD. I got that from a bug report somewhere... I think some people had some success removing networkmanager or some similar package but I made a mess of my MD trying some stuff and had to rebuild the image.

Will keep digging.

_if_

  • Guru
  • ****
  • Posts: 238
    • View Profile
Re: MD wake on Lan not working
« Reply #10 on: June 26, 2012, 11:37:40 am »
JaseP, just install and configure apcupsd. It's working for me very well for long time now.

JaseP

  • Addicted
  • *
  • Posts: 526
    • View Profile
    • JaseP's LinuxMCE Wiki User page
Re: MD wake on Lan not working
« Reply #11 on: June 26, 2012, 02:56:06 pm »
Thanks,... to both Jamo on on the Answ. to the power on Quest. and to _if_ re: the ups stuff...
See my User page on the LinuxMCE Wiki for a description of my system configuration (click the little globe under my profile pic).

jamo

  • Guru
  • ****
  • Posts: 457
    • View Profile
    • LMCE user Page
Re: MD wake on Lan not working
« Reply #12 on: June 28, 2012, 09:53:03 am »
Some more tinkering last night. The problem certainly seems related to how the machine is shutdown - it seems the NIC needs to be left in a state that allows WOL to work. This can be forcecd by physically removing power from the machine but obviously I don't want to do that every time... I may as well power it on manually.

The "halt"  (/etc/init.d/halt) script which is the last that is called in the shutdown sequence, as I understand it, has a setting at the beginning "NETDOWN=yes" which then, if "yes" passes a "-i" parameter the /sbin/halt executable to, presumably, shut down the network device.

Now there doesn't seem to be clarity as to whether the NIC must be shutdown (similar to
Code: [Select]
ifconfig eth0 down) or not for WOL to work but regardless of this, halt doesn't seem to do the right thing. I have tried "NETDOWN=no" as well as yes.

Some of the bugfixes/workarounds out there advise shutting down the NIC explicitly by creating a script that is executed right at the end of the shutdown process that does a
Code: [Select]
ifconfig eth0 down
immediately before powering off.

I tried hacking the halt script to include this code prior to the /sbin/halt command but the system then moaned about something being active. I presume this is to do with the NFS being mounted. Of course that is going to be a problem. It makes sense that you can't bring down a network card that is still being used for the filesystem....

Here's what I'm thinking at the moment. The problem is either due to
a) My NIC driver which is not allowing the NIC to be moved to a state that will accept WOL when the /sbin/halt command is executed with the "-i" parameter.
OR
b) Some other problem in the shutdown of this particular MD that is causing other things (NFS, NBD?) not to be stopped properly which is preventing the network being brought down properly.

I'll start with b) because there are definitely a few "faileds" being thrown on shoutdown of this MD. I'll compare to the working ones and see if I'm having a problem somewhere that doesn't exist on the others and try to fix. Otherwise I'll tinker wtih the NIC driver. Maybe.

mkbrown69

  • Guru
  • ****
  • Posts: 180
    • View Profile
Re: MD wake on Lan not working
« Reply #13 on: June 28, 2012, 06:18:40 pm »
Jamo,

Generally, the interface has to be configured to support/Listen for the WOL packet.  This is generally done by

Code: [Select]
ethtool -s eth0 wol g
It could be done via an init script, like below, or in rc.local

Code: [Select]
sudo cat << EOF >> /etc/init.d/wake-on-lan
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: wake-on-lan
# Required-Start: \$network
# Required-Stop: \$local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Enable Wake-On-Lan
### END INIT INFO
#
. /lib/lsb/init-functions
 
do_start() {
    ethtool -s eth0 wol g
    exit
}
 
do_stop() {
    ethtool -s eth0 wol d
    exit
}
 
case "\$1" in
  start )
        do_start
        ;;
  restart|reload|force-reload )
        echo "Error: argument '\$1' not supported" >&2
        exit 3
        ;;
  stop )
        do_stop
        ;;
  * )
        echo "Usage: \$0 start|stop" >&2
        exit 3
        ;;
esac
EOF
sudo chmod 755 /etc/init.d/wake-on-lan

Code: [Select]
sudo update-rc.d wake-on-lan defaults

Now, if this solves your problem, then it should probably be added to the MD generation scripts.  If not, then there's something else at play, possibly power management.

HTH!

/Mike

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5479
  • DOES work for LinuxMCE.
    • View Profile
Re: MD wake on Lan not working
« Reply #14 on: June 28, 2012, 06:35:54 pm »
Morning,

If any of you actually BOTHERED to look at our code, you'll see there is code already in the boot scripts to do this.

Damn it guys, actually grab the code and look!

http://svn.linuxmce.org/svn/branches/LinuxMCE-1004/src/BootScripts

*Picard-style-hmm*

-Thom