Network interfaces are not correctly brought down on halt, disrupting Wake-on-LAN

Bug #981461 reported by Robbie Williamson on 2012-04-14
This bug affects 19 people
Affects Status Importance Assigned to Milestone
ifupdown (Ubuntu)
upstart (Ubuntu)

Bug Description

I found the workaround (and proof) for this bug is posted here:

The relevant info is below
To get WOL to work the ethernet interface must be properly brought down as part of the system shutdown. This should be performed as part of run levels rc0 and rc6, noting that Linux typically has 7 different run levels (or operating modes):
rc0.d - System Halted
rc1.d - Single User Mode
rc2.d - Single User Mode with Networking
rc3.d - Multi-User Mode - boot up in text mode
rc4.d - Not yet Defined
rc5.d - Multi-User Mode - boot up in X Windows
rc6.d - Shutdown & Reboot
A simple script can be created to bring the ethernet interface down properly at shutdown:
sudo vi /etc/rc6.d/

It may contain:
ifconfig eth0 down

Change the script's permissions to make it executable:

sudo chmod 755 /etc/rc6.d/

Copy the script to work on system halt as well:

sudo cp /etc/rc6.d/ /etc/rc0.d/

Change permissions to make it executable:

sudo chmod 755 /etc/rc0.d/

Job done.

To test power down the machine, sudo shutdown now or sudo poweroff , and use your favourite WOL tool to send a magic packet. Thanks to rockafeller and everyone else who have commented with various solutions.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: ifupdown 0.7~beta2ubuntu8
ProcVersionSignature: Ubuntu 3.2.0-23.36-generic 3.2.14
Uname: Linux 3.2.0-23-generic x86_64
ApportVersion: 2.0.1-0ubuntu2
Architecture: amd64
Date: Sat Apr 14 05:12:38 2012
SourcePackage: ifupdown
UpgradeStatus: No upgrade log present (probably fresh install)

Robbie Williamson (robbiew) wrote :
Changed in ifupdown (Ubuntu):
status: New → Incomplete
status: Incomplete → Confirmed
importance: Undecided → High
assignee: nobody → Canonical Foundations Team (canonical-foundations)
Robbie Williamson (robbiew) wrote :

One more note: Anyone wanting to do WOL will also need to have ethtool ran, e.g. ' ethtool -s eth0 wol g' at each boot to ensure WOL is set during an 'ifconfig eth0 down'. Placing it in /etc/rc.local worked for me.

Steve Langasek (vorlon) on 2012-04-15
Changed in ifupdown (Ubuntu Precise):
milestone: none → precise-updates
assignee: Canonical Foundations Team (canonical-foundations) → Stéphane Graber (stgraber)
status: Confirmed → Triaged
Stéphane Graber (stgraber) wrote :

I'll have to test when I get back home and have access to server hardware.

Looking at our current initscripts "/etc/init.d/networking stop" gets called in rc0.d which will call ifdown and ultimately do the "ifconfig ethX down", unless the interface isn't defined in /etc/network/interfaces.

So maybe we have a race somewhere and the interface doesn't reliably get brought down on shutdown, causing this bug.

We can't call ethtool as it's not shipped by default in Ubuntu and certainly won't introduce it in an SRU.
Also, based on what I remember about that specific call and somewhat confirmed by the manpage entry, "wol g" actually turns on wake-on-lan ignoring the BIOS setting which we certainly don't want to do.

So what we want is for a machine where the BIOS is properly configured and supports wake-on-lan to actually wake up on magic packet but not make every single Ubuntu system suddenly boot when they get one ;)

ossjunkie (ossjunkie) wrote :

Did you try /etc/init.d/halt and "NETDOWN=no"?

AC (atcapollo) wrote :

any progress on this bug?

Unai Uribarri (unaiur) wrote :

I believe the bug is in the halt command. "halt -i" should shutdown all the network interfaces but it doesn't do it realiabily.

Unai Uribarri (unaiur) wrote :

This bug was introduced when Ubuntu migrated to upstart. I've reading the upstart source code and -i flag was never implemented. So the NETDOWN variable and related functionality in /etc/init.d/halt is useless.

Unai Uribarri (unaiur) wrote :

This patch fixes the handling of NETDOWN variable in /etc/init.d/halt. Since upstart doesn't implement halt -i, do it in the shell script.

The attachment "This patch fixes the handling of NETDOWN variable in /etc/init.d/halt. Since upstart doesn't implement halt -i, do it in the shell script." of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
no longer affects: upstart (Ubuntu Precise)
summary: - wol broken on HP ProLiant N40L (Broadcom tg3 driver)
+ Network interfaces are not correctly brought down on halt, disrupting
+ Wake-on-LAN
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in upstart (Ubuntu):
status: New → Confirmed
Pali (pali) wrote :

Is there something new about this patch?

Changed in ifupdown (Ubuntu):
assignee: Stéphane Graber (stgraber) → nobody
Changed in ifupdown (Ubuntu Precise):
assignee: Stéphane Graber (stgraber) → nobody
proofNot (b.r.o.w.n.i.e.) wrote :

thanks to the solution proposed by @Robbie Williamson I was able to start my ubuntu server by sending WOL packets

Hark (cab902) wrote :

Issue is also detected in the Lubuntu Xenial, despite migration to systemd. Attached is the workaround. Copy the file to /etc/systemd/system and activate with "systemctl enable wol\@eth0".

no!chance (ralf-fehlau) wrote :

no wake-on-lan with Ubuntu 20., too!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers