Bug 106897

Summary: USB not restored when IBM T21 woken up from APM sleep
Product: [openSUSE] SUSE LINUX 10.0 Reporter: Phil Stopford <phil>
Component: KernelAssignee: Holger Macht <hmacht>
Status: VERIFIED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Major    
Priority: P2 - High CC: aj, behlert, vR
Version: RC 1   
Target Milestone: RC 3   
Hardware: i686   
OS: SUSE Other   
Whiteboard:
Found By: Beta-Customer Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: powersave logs, as requested
powersave logs
powersave logs from powersave-0.10.15-5
ps.out
powersave's logs after a failed suspend
/var/log/messages

Description Phil Stopford 2005-08-23 22:19:28 UTC
Not suspending to disk, but placing machine in RAM-based suspend mode (Fn F4 or
shut the lid). Prior to doing this, everything is working fine. Wake the machine
up again and the USB hardware is no longer available.

A full reboot is required to recover the use of USB hardware. This fault was
also present in SuSE 9.3 Pro. By contrast, Fedora Core 4 doesn't demonstrate
this issue; nor does Windows on the same machine.
Comment 2 Pavel Machek 2005-08-24 12:32:50 UTC
This is apm, so yes there might be some hope. 
 
Can you try unloading usb modules before suspend and returning them after 
resume? 
Comment 3 Pavel Machek 2005-08-25 09:55:25 UTC
Phil wrote me that USB modules are not loaded after resume, so it looks like
problem in our suspend scripts somewhere.
Comment 4 Forgotten User ZhJd0F0L3x 2005-08-26 09:12:06 UTC
ok, so we need /var/log/suspend2ram.log and /var/lib/suspend2ram-state{,.resume}

Maybe just some event hook was not executed correctly.
Comment 5 Phil Stopford 2005-08-29 00:15:58 UTC
OK. I will have that for you in just a minute. Before I forget, though, loading
the uhci_hcd module by hand after it fails to be reloaded by the APM system
appears to allow the module to survive further APM events.
Comment 6 Phil Stopford 2005-08-30 20:57:58 UTC
Beta 3 no longer allows me to put the machine to sleep so I cannot progress this
much further for now. No error is produced in logs/console - the machine simply
ceases to respond when trying APM sleep. *sigh* If needed, I can probably
re-download beta 2, but with betas being released so quickly, I'm uncertain that
this would actually help.

ACPI produces a screen full of crash information which seems related to
savagefb, but since it isn't entered into the logs, it would need me to write it
down. I haven't done so since I believe that the ACPI implementation on this
machine may be buggy, hence my use of APM.
Comment 7 Forgotten User ZhJd0F0L3x 2005-08-31 09:15:07 UTC
remove the framebuffer modules before suspend (grep fb /proc/modules and rmmod
e.g. savagefb, bug #113607) and suspend will probably work.

On the old thinkpads, both APM and ACPI should work fine (at least thats what i
experienced in the not too distant past)
Comment 8 m. bracher 2005-09-03 14:38:07 UTC
The APM/usb problem with uhci-hcd exists sometimes also on IBM T40 with suse93
and suse10-beta4. 
Adding uhci-hcd to UNLOAD_MODULES_BEFORE_SUSPEND2RAM in
/etc/sysconfig/powersave/sleep normally works, but not every time. As permanent
workaround I added "modprobe -r uhci-hcd; modprobe uhci-hcd" to
/usr/lib/powersave/restore_after_suspend_to_ram
Comment 9 Andreas Jaeger 2005-09-03 15:42:08 UTC
Phil, did you try #7?
Comment 10 Holger Macht 2005-09-09 06:52:58 UTC
No info from reporter until now. This seems to be no general problem for me.
Therefore lowering severity...
Comment 11 Phil Stopford 2005-09-10 10:14:57 UTC
Beta 4 allows APM to work so I can now provide feedback; the problem is still
present. It makes no difference whether a USB device is plugged in
before/during/after an APM event - the uhci-hcd module is simply not reloaded.
Fresh lsmod output is about to be attached to this to demonstrate the point.
Comment 12 Forgotten User ZhJd0F0L3x 2005-09-10 22:24:28 UTC
please do the following:

cd /tmp
/usr/share/doc/packages/powersave/powersave_logs

and attach /tmp/powersave_logs.tar.gz

This is not a critical bug but a normal one. Critical would mean it is making
lots of machines unusable. Since i have exactly one bug report about this and
nobody seems to be able to reproduce, i'll adjust the severity.
Comment 13 Phil Stopford 2005-09-12 23:17:56 UTC
Created attachment 49702 [details]
powersave logs, as requested

As requested, logs for this issue.
Comment 14 Jason Kasper 2005-09-13 04:27:15 UTC
FWIW, I'm seeing this same problem on an IBM Thinkpad A31 laptop.  uhci-hcd is 
not reloaded after apm suspend/resume.  If I load it manually, and then reload 
usbhid, etc., then things work as expected.
Comment 15 Forgotten User ZhJd0F0L3x 2005-09-13 11:07:32 UTC
Jason, could you also attach powersave_logs.tar.gz as mentioned in comment #12?
I am seeing a very strange thing in Phil's logs, as /var/lib/suspend2ram-state
is empty, which i cannot really explain when reading the code and
/var/log/suspend2ram.log :-)
Comment 16 Forgotten User ZhJd0F0L3x 2005-09-13 11:15:56 UTC
Phil, for debugging it would be great if you could repeat your test, but before
load "usb_storage" manually, then suspend, resume, then collect and attach the
logs. This could hint at the problem.
Comment 17 Jason Kasper 2005-09-13 11:41:09 UTC
Created attachment 49757 [details]
powersave logs

Okay.  Here's my powersave logs.  I did notice that
/var/lib/suspend2ram-state.resume is a 0-length file....  HTH!!  And thanks!! 
=:)
Comment 18 Forgotten User ZhJd0F0L3x 2005-09-13 16:00:57 UTC
thanks, we found the bug, no further logs necessary. powersaved called the
restore_after_suspend_to_ram event twice, simultaneously. This lead to
interesting race conditions, that just did not harm on my APM hardware (it is
too slow :-). This will be fixed in powersaved soon. Thanks for the reports and
logs, this was a nasty one :-)
Comment 20 Holger Macht 2005-09-13 16:27:42 UTC
*** Bug 116774 has been marked as a duplicate of this bug. ***
Comment 21 Phil Stopford 2005-09-13 19:25:17 UTC
Great! Thanks, Stefan. It is (hopefully, soon, was) really annoying me. I'm glad
you managed to nail it. Any ideas if the fix will make it in for RC2?
Comment 22 Forgotten User ZhJd0F0L3x 2005-09-13 19:42:32 UTC
RC2 is already done, it will probably make it into RC3 or final, if not we will
issue an YOUpdate.

If you want to test it before, you can fetch the latest and greatest package from
ftp://ftp.suse.com/pub/people/seife/powersave/SUSE-10.0-test/ (i386 and x86_64
packages)
Comment 23 Andreas Jaeger 2005-09-13 20:03:37 UTC
Fix will be in RC3.
Comment 24 Forgotten User ZhJd0F0L3x 2005-09-13 20:05:48 UTC
BTW: my testpackages have a small error in the postinstall script:
...
Updating etc/sysconfig/powersave/common...
Updating etc/sysconfig/powersave/disk...
/var/tmp/rpm-tmp.57054: line 739: -gt: command not found

Just ignore it, it is fixed for the final version ;-)
Comment 25 Jason Kasper 2005-09-24 02:44:45 UTC
Just wanted to add my confirmation that your fixes solve this problem for me 
too.  Thanks VERY much, Stefan!  =:)
Comment 26 Jason Kasper 2005-09-27 13:50:30 UTC
Created attachment 50936 [details]
powersave logs from powersave-0.10.15-5

Hm.  I am still seeing this, but I think it's caused by something going wrong
in powersave, requiring a restart (bug #116991).  The first couple of times
that I suspend/resume, the USB modules do get reloaded properly.  But as soon
as the above-mentioned bug kicks in, this stops working.  

To be precise, what happens is that at some point, when I click on "suspend to
RAM" from the kpowersave applet, I see my PCMCIA card get stopped, and all USB
devices stop working.  But that's all that happens.  I do not see the powersave
dialog come up and tell me that it's doing stuff.  So I have to do this from
the command line:

sudo /etc/init.d/powersaved restart ; sleep 5; powersave --suspend-to-ram

... which does suspend my laptop, but when I have to do this (after a started
but not completed powersave suspend to RAM), then the USB modules do not get
reloaded.  

Please let me know what else I can provide.
Comment 27 Jason Kasper 2005-09-27 13:51:36 UTC
As mentioned in the previous attachment, I'm still having problems with this 
bug, though I'm not sure if it's a result of bug #116991.  Reopening in hopes I 
can help get this fixed.
Comment 28 Forgotten User ZhJd0F0L3x 2005-09-27 14:31:42 UTC
Holger: the "Statefile disappeared" logmessage is a bug in my script logic - it
is inverted.

It looks like a suspend just hangs.
Could you do a "ps auxwwwf > /tmp/ps.out" as soon as the first suspend does not
work and attach it to this bug? I suspect that some suspend-preparation
processes are hanging somewhere.
Comment 29 Jason Kasper 2005-09-27 21:41:40 UTC
Created attachment 50978 [details]
ps.out

Okay, here's the output of ps as requested.  This is after I've clicked
"suspend to RAM" from kpowersave.  My USB no longer works and my PCMCIA cards
have been ejected.
Comment 30 Jason Kasper 2005-09-27 21:43:23 UTC
Created attachment 50979 [details]
powersave's logs after a failed suspend

I've just gathered these logs after I clicked "suspend to RAM" from kpowersave.
 As mentioned previously, my USB modules have all be removed, and my PCMCIA
card is deactivated.  But no dialog has come up and the laptop has not
suspended.
Comment 31 Jason Kasper 2005-09-27 21:45:01 UTC
Created attachment 50980 [details]
/var/log/messages

Here's /var/log/messages after the failed suspend.  DEBUG is set to 15 in
powersave's common config file.  Hope this helps!
Comment 32 Holger Macht 2005-09-28 07:27:54 UTC
It looks like either powersaved or kpowersave is opening too many dbus
connection which are not closed afterwards. Then the number of open connection
per user is reached. If that's the case, it doesn't suprise me that powersave
doesn't work anymore. As mentioned in bug 116991, please post the output of
"rpm -qi --changelog powersave | head -n 40" to verify you are using the latest
version.

To strengthen my suspicion, can you please start the command "dbus-monitor
--system" and "dbus-monitor --session" one time as user and one time as root
after a failed suspend? One of this commands should not work.
Comment 33 Holger Macht 2005-09-28 10:43:34 UTC
And you are sure that this only happens when you are trying to suspend to disk?

I found a bug that causes the dbus connection not to be closed. But this only
appears when there's something wrong with the hal daemon. SO I'm not sure if the
fix really solves this problem.

seife, can you put an updated package on the ftp server when its ready?
Comment 34 Jason Kasper 2005-09-28 11:18:07 UTC
Per comment #32:

I've done that here: https://bugzilla.novell.com/show_bug.cgi?id=116991#c9

Also, Holger, I will do that next time I see a failed suspend.

Per comment #33:

Actually, I only use suspend to RAM.  I've never had success with suspend to 
disk.  In addition, I don't see a haldaemon running on my system right now, per 
"ps waux | grep hal".  Should I start it with "/etc/init.d/haldaemon start" 
before I try to suspend the next time?
Comment 35 Holger Macht 2005-09-28 12:07:43 UTC
*** Bug 116991 has been marked as a duplicate of this bug. ***
Comment 36 Holger Macht 2005-09-28 12:10:31 UTC
Ok, I think I fixed it. Thanks a lot for reporting.

I will inform you as soon as a new package is available if you like to try.

But the hal-is-not-running-issue might be another problem. If you like, you can
file a new bugreport for this.
Comment 37 Jason Kasper 2005-09-28 12:28:35 UTC
So... should haldaemon be running at all times?  Should I restart it if I notice 
that it's down?  Hm.  I just noticed that if I try /etc/init.d/haldaemon stop 
and start, I _still_ don't see a process actually running (ps waux | grep hal).  
Am I missing something here?

Thanks Holger!
Comment 38 Holger Macht 2005-09-28 12:35:12 UTC
Yes, haldaemon must is mandatory with 10.0 because many applications depend on
it. Please file another bugreport for that issue.
Comment 39 Jason Kasper 2005-09-28 13:00:51 UTC
Okay, to answer comment #32, I just tried a suspend and it failed and this is 
what I see:

> dbus-monitor --session
Failed to open connection to session message bus: Unable to determine the 
address of the message bus
Comment 40 Holger Macht 2005-09-28 13:11:45 UTC
Ok, that's normal.

BTW: Are you sure you are using RC2 and not RC1?
Comment 41 Jason Kasper 2005-09-28 14:05:47 UTC
Um.  I'm using the latest publicly-available release, which is RC1.
Comment 42 Jason Kasper 2005-09-29 17:40:51 UTC
I just wanted to follow up on this...  RC1 is still the latest, right?  I am 
still hitting this problem at least once a day and would really like to help get 
it fixed before 10.0-final.
Comment 43 Holger Macht 2005-09-29 17:45:19 UTC
Yes it is. I just asked because the 'found in version' section of this bugreport
pints to RC2. To I correct this.

As mentioned in comment #36, I will provide a package and let you now.
Comment 44 Andreas Jaeger 2005-09-30 08:01:15 UTC
Jason, 10.0-final is done, we're currently cleaning up and getting things out.

Let's continue working on fixing this nevertheless...

Thanks!
Comment 45 Forgotten User ZhJd0F0L3x 2005-10-04 17:37:23 UTC
for anyone willing to test, i have put a package of the latest code onto
ftp://ftp.suse.com/pub/people/seife/powersave/SUSE-10.0-test/10.0-i386/powersave-0.10.15.1-0.1.i586.rpm
which should be very similar to the upcoming YOU.
Comment 46 Marcus Meissner 2005-10-05 14:24:01 UTC
released powersave update for 10.0. 
Comment 47 Holger Macht 2005-10-10 15:27:44 UTC
Jason, did you try with you update?
Comment 48 Jason Kasper 2005-10-10 16:42:27 UTC
Hi Holger,

I've updated to 10.0-final and I can say that at least after two suspend/resume 
cycles, my usb modules did come back correctly.  =:)  

I still cannot figure out how to keep usbhid from being loaded at boot-time (I 
have to load lmpcm_usb instead), but my putting it in /etc/hotplug/blacklist 
doesn't help.

As far as this one, though... if you want to mark it closed/fixed, I'm okay with 
that and if I see it happen again, I can re-open it?

Thanks again Holger!!  =:)
Comment 49 Holger Macht 2005-10-14 14:26:40 UTC
Ok, thanks a lot for reporting/debugging. Closing the bug now.