Bug 589108

Summary: Networking is disabled by state file after power loss drained laptop battery
Product: [Fedora] Fedora Reporter: Jerry Amundson <jamundso>
Component: NetworkManagerAssignee: Dan Williams <dcbw>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 13CC: dcbw, eqisow, jklimes, joel_rees, oded, orion, plug.gulp, rbh00
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 598765 (view as bug list) Environment:
Last Closed: 2010-06-07 10:37:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
nm-applet: NetworkManager in sleep state
none
knetworkmanager with added "Enable networking" checkbox none

Description Jerry Amundson 2010-05-05 12:26:11 UTC
Description of problem:
Networking is disabled by state file after power loss drained laptop battery

Version-Release number of selected component (if applicable):
NetworkManager-0.8.0-7.git20100422.fc13.i686

How reproducible:
always

Steps to Reproduce:
1.login to KDE on laptop
2.disconnect power, and let battery die
3.plugin power and boot - no network.
  
Actual results:
no network management

Expected results:
network management

Additional info:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=571331

Note in step 3. above there are actually two boots as the resume from power mgmt suspend never works for me - I force power off and restart.

Comment 1 Oded Arbel 2010-05-10 13:11:17 UTC
I have the same problem after trying to recover from a failed suspend.

Removing the state file at /var/lib/NetworkManager and restarting NetworkManager solved the problem for me.

Comment 2 Justin Newman 2010-05-11 03:00:39 UTC
Same issue here on a Dell Studio 1558, 03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6200 (rev 35), NetworkManager-0.8.0-13.git20100509.fc13

Comment 3 Joel Rees 2010-05-16 11:22:23 UTC
Additional evidence:

I had this happen to me, apparently when my daughter accidentally hit the sleep button on the keyboard or selected hibernate instead of shutdown from the shutdown menu.

The file mentioned above, 

/var/lib/NetworkManager/NetworkManager.state

shows the wired network disabled and the wireless enabled.

The box is a desktop, by the way, not a laptop. No battery. No wireless hardware of any sort. 32 bit, single CPU Sempron. (Should I attach a dmesg?) 

Oh, and it's running Fedora 12.

Editing the file instead of deleting it also seems to unclog the networking stuff.

Comment 4 Dan Williams 2010-05-17 23:55:41 UTC
*** Bug 592505 has been marked as a duplicate of this bug. ***

Comment 5 Dan Williams 2010-05-18 00:10:11 UTC
*** Bug 552233 has been marked as a duplicate of this bug. ***

Comment 6 Richard Hitt 2010-05-19 21:46:39 UTC
When this symptom has happened to me, the following command instantly fixes it:
    nmcli nm wakeup

The circumstances seem to be that NM sets NetworkingEnabled to false in the /var/lib/NetworkManager/NetworkManager.state file but the situation can arise where NM cannot reset it.

My guess is that this flag is set at suspend time (and of course at 'nmcli nm sleep' time as well).  Further, I guess that NM expects a 'suspend' to be followed by a 'resume', which should reset this flag to be NetworkingEnabled=true.  But if the latter fails, as it stands manual intervention is reqired.

The failure can occur in at least these two ways:  the hardware's suspend function is broken and a power-on reboot is required, and the battery discharges and a power-on reboot is required.  The NetworkingEnabled=false flag remains set in these cases, and manual intervention is required.  But a naïve user is at a complete loss what to do.  Even sophisticated users, e.g., helpers on the #fedora channel of freenode, are at a loss, as I've seen.  NM should perhaps set the flag to true when freshly started?

What are the exact and complete semantics of this NetworkingEnabled=false flag?

Is there a valid case where a freshly started NetworkManager service can expect NetworkingEnabled=false to be the proper setting?  If there is, could a freshly started NM pop up a graphic window asking the user if enabling was okay?

Comment 7 Jirka Klimes 2010-05-20 12:27:31 UTC
(In reply to comment #6)
> When this symptom has happened to me, the following command instantly fixes it:
>     nmcli nm wakeup

Yeah, this pokes NM to wake up via D-BUS.
The same effect can be reached by:
1. right clicking nm-applet and checking "Enable Networking"
2. directly via D-Bus call, e.g. with dbus-send:
dbus-send --system --dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager.Sleep boolean:false

> 
> The circumstances seem to be that NM sets NetworkingEnabled to false in the
> /var/lib/NetworkManager/NetworkManager.state file but the situation can arise
> where NM cannot reset it.
> 
> My guess is that this flag is set at suspend time (and of course at 'nmcli nm
> sleep' time as well).  Further, I guess that NM expects a 'suspend' to be
> followed by a 'resume', which should reset this flag to be
> NetworkingEnabled=true.  But if the latter fails, as it stands manual
> intervention is reqired.
>
The flag is set by 
/usr/lib64/pm-utils/sleep.d/55NetworkManager script when suspending. The same script is responsible for waking NM up on resume. But when resume fails, of course, the flag is not set to true again.
The whole problem is that suspend/resume should not reuse NetworkingEnabled flag, but it does at present. It's planned to change that in the future, though (see the duped bugs and some others on the issue).

> The failure can occur in at least these two ways:  the hardware's suspend
> function is broken and a power-on reboot is required, and the battery
> discharges and a power-on reboot is required.  The NetworkingEnabled=false flag
> remains set in these cases, and manual intervention is required.  But a naïve
> user is at a complete loss what to do.  Even sophisticated users, e.g., helpers
> on the #fedora channel of freenode, are at a loss, as I've seen.  NM should
> perhaps set the flag to true when freshly started?
> 
> What are the exact and complete semantics of this NetworkingEnabled=false flag?
> 
The state file was introduced to retain setting during restarts. So that you can set the flags and see the same stuff over reboots.

> Is there a valid case where a freshly started NetworkManager service can expect
> NetworkingEnabled=false to be the proper setting?  If there is, could a freshly
> started NM pop up a graphic window asking the user if enabling was okay?    

There are valid cases.
You may manually disable wireless or whole networking (e.g via right-clicking nm-applet). And you want to have the same state after reboot, of course.
I am sure about a pop-up. I think that disabled state is already indicated via nm-applet icon. See attachment.

Comment 8 Jirka Klimes 2010-05-20 12:29:18 UTC
Created attachment 415400 [details]
nm-applet: NetworkManager in sleep state

Comment 9 Oded Arbel 2010-05-20 13:28:41 UTC
The main problem with using nm-applet for waking up NetworkManager, is that if you use KDE then you don't have nm-applet, you have knetworkmanager which doesn't have that features.

When NetworkManager is sleeping, knetworkmanager shows a disabled menu entry saying "networking is disabled" and there is no way to enable it.

Comment 10 Jirka Klimes 2010-05-20 17:45:00 UTC
This is actually a deficiency of knetworkmanager.
I've submitted a patch for knetworkmanager to fix that:
https://bugs.kde.org/show_bug.cgi?id=238325

Btw, you can use nm-applet in KDE without any problem (I do that myself).

Comment 11 Jirka Klimes 2010-05-20 17:57:07 UTC
Created attachment 415484 [details]
knetworkmanager with added "Enable networking" checkbox

knetworkmanager with enable check boxes when NetworkManager is sleeping.

Comment 12 Dan Williams 2010-05-22 17:04:39 UTC
Upstream NetworkManager commits that fix this bug:

ee3ece9dac985034c5c1f81a6769b40fd7856579 (0.8.1)
fa70542c618665cf203a2b71fa0e504f759f7902 (master)

still need to hook the applet's Enable checkbox up to the new bits in a separate commit.

Comment 13 Dan Williams 2010-05-22 17:57:51 UTC
5ca1a9d546be81b54e57d525b54ff92597de6115 (0.7.x)

Comment 14 Jerry Amundson 2010-05-25 00:28:25 UTC
(In reply to comment #12)
> Upstream NetworkManager commits that fix this bug:
> 
> ee3ece9dac985034c5c1f81a6769b40fd7856579 (0.8.1)
> fa70542c618665cf203a2b71fa0e504f759f7902 (master)

This is in my list of bugs to "Retest", but I see no way to do so. Please update accordingly. Thanks!

Comment 15 Jerry Amundson 2010-06-02 01:28:33 UTC
(In reply to comment #10)
> This is actually a deficiency of knetworkmanager.
> I've submitted a patch for knetworkmanager to fix that:
> https://bugs.kde.org/show_bug.cgi?id=238325
> 
> Btw, you can use nm-applet in KDE without any problem (I do that myself).    

That is a different problem, and solution, so I've cloned this as Bug #598765.

Comment 16 Fedora Update System 2010-06-10 05:26:38 UTC
NetworkManager-0.7.2.997-2.git20100609.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/NetworkManager-0.7.2.997-2.git20100609.fc11

Comment 17 Dan Williams 2010-06-26 01:48:28 UTC
*** Bug 573799 has been marked as a duplicate of this bug. ***