Bug 245660

Summary: Suspend to disk broken on LVM partitions
Product: [openSUSE] openSUSE 10.2 Reporter: Felix Rommel <felix.rommel>
Component: Mobile DevicesAssignee: Pavel Machek <pavel>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Enhancement    
Priority: P5 - None CC: behlert, bernhard.bender
Version: Final   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: output of messages while suspend to disk

Description Felix Rommel 2007-02-15 00:40:22 UTC
Please fix the problem not being able to suspend to RAM/Disk if the root partition is in a logical volume. See:

https://bugzilla.novell.com/show_bug.cgi?id=228572#c12

Currently openSUSE 10.2 is not good for using it on a laptop - if you use LVM - because you cannot suspend to disk...

Because 10.3 is foremost planned for September, it would be great if you fix this problem in 10.2.
Comment 2 Pavel Machek 2007-02-15 10:25:04 UTC
No, this is more something for seife... kernel should be capable of doing resume from LVM, but our initrd is probably not able to cope with that.

If stefan says it has to wait, I'm afraid it has to wait.

Felix, if initrd does not scare you, try to move lvm init before resume handling; that should get resume from LVM to work. If you can do that with nice and obvious patch, then _maybe_ we can think about fixing it for 10.2.
Comment 3 Forgotten User ZhJd0F0L3x 2007-02-15 11:22:42 UTC
I will work on that, but it will have to wait a bit.
Also, messing around with the initrd creation has the potential to screw up other users, so this must be tested extensively.

Unless we find out it is doable with a trivial, non-intrusive patch, it will have to wait for 10.3.
Comment 5 Forgotten User ZhJd0F0L3x 2007-02-15 18:51:17 UTC
It is even less easy than i thought.
Suspend with LVM does not work at all, because the machine hangs after

        printf("suspend: Snapshotting system\n");
        attempts = 2;
        do {
                if (set_image_size(snapshot_fd, image_size)) {
                        error = errno;
                        break;
                }
                if (!atomic_snapshot(snapshot_fd, &in_suspend)) {

here.
I think if we stop all threads, the LVM thread ksnapd gets frozen (it gets created in linux/drivers/md/dm-snap.c with 

	ksnapd = create_singlethread_workqueue("ksnapd");
)
and this then deadlocks the rest of the suspend process, but i am not sure.
So as it is now, suspend on LVM does not work _at all_, so i can not do anything in userland to fix it.
Comment 6 Forgotten User ZhJd0F0L3x 2007-02-15 18:57:07 UTC
it fails the same way when trying the in-kernel suspend (almost the same; s2disk seems to let the CPU idle, the cursor is still blinking. In-kernel sends the CPU to 100% and the cursor stops blinking).
Last thing seen is always "suspending consoles", this is with 2.6.20 on STABLE.
Comment 7 Pavel Machek 2007-02-16 11:50:46 UTC
Ok, this is mine problem, I guess, and unlikely to be fixed in 10.2. Is there some  easy to understand LVM howto somewhere?
Comment 8 Pavel Machek 2007-02-16 12:01:18 UTC
Hmmm... is LVM /dev/mapper/*? People report it works... and we even have howto in Doc*/power/swsusp-dmcrypt.txt...

Stefan, can you try turning off CONFIG_DM_SNAPSHOT and retry? That should get rid of at least the ksnapd problem...
Comment 9 Forgotten User ZhJd0F0L3x 2007-02-16 17:35:10 UTC
I just installed opensuse factory in a QEMU virtual machine, no need to risk your real data :-)
I will try without DM_SNAPSHOT (hopefully just getting rid of the module is enough), but not before tuesday.
Comment 10 Forgotten User ZhJd0F0L3x 2007-02-16 19:32:37 UTC
It works with EVMS, but not with our initrd. I will work on the initrd problem.
Comment 11 Pavel Machek 2007-02-16 22:11:20 UTC
Thanks.
Comment 12 Forgotten User ZhJd0F0L3x 2007-02-18 11:59:05 UTC
removing dm_snapshot before suspend makes lvm suspend work, but it has the same initrd problems as EVMS.
Comment 13 Felix Rommel 2007-03-25 23:11:54 UTC
Suspend to Disk works with 10.3 Alpha1 + updates 2007-03-25 on my Thinkpad Z61m with LVM, now.

Suspend to Ram does NOT work with 10.3 Alpha1 + updates on Z61m.
Comment 14 Forgotten User ZhJd0F0L3x 2007-03-26 07:21:24 UTC
(In reply to comment #13)
> Suspend to Disk works with 10.3 Alpha1 + updates 2007-03-25 on my Thinkpad Z61m
> with LVM, now.

Interesting. Can you tell us your kernel version (uname -r)? Did you need to unload dm_snapshot to make it work?


> Suspend to Ram does NOT work with 10.3 Alpha1 + updates on Z61m.

Different bug, please read http://en.opensuse.org/S2ram and file an extra report for that issue.
Comment 15 Felix Rommel 2007-03-28 07:52:50 UTC
I was a little too optimistic - suspend to RAM works SOMETIMES. But sometimes Computer hangs before switching power off.

I didn NOT unload any drivers - I suspend with Gnomes old logout dialog, cause current version of gnome-main-menu is broken.

uname -a:

Linux thinksusez29 2.6.21-rc4-git5-3-default #1 SMP Wed Mar 21 19:44:10 UTC 2007 i686 i686 i386 GNU/Linux

I have attached the messages when system froze while suspending. I had to switch it off with power button.
Comment 16 Felix Rommel 2007-03-28 07:55:05 UTC
Created attachment 126919 [details]
output of messages while suspend to disk
Comment 17 Forgotten User ZhJd0F0L3x 2007-03-28 08:27:36 UTC
(In reply to comment #15)
> I was a little too optimistic - suspend to RAM works SOMETIMES. But sometimes
> Computer hangs before switching power off.

Suspend to RAM is a totally different thing than suspend to disk.
_PLEASE_ file a different bug.

> I didn NOT unload any drivers - I suspend with Gnomes old logout dialog, cause
> current version of gnome-main-menu is broken.
> 
> uname -a:
> 
> Linux thinksusez29 2.6.21-rc4-git5-3-default #1 SMP Wed Mar 21 19:44:10 UTC
> 2007 i686 i686 i386 GNU/Linux
> 
> I have attached the messages when system froze while suspending. I had to
> switch it off with power button.
> 

(In reply to comment #16)
> Created an attachment (id=126919) [edit]
> output of messages while suspend to disk

So now it is suspend to disk again? 
I'm afraid mixing this all up in this bug, which is mainly about the initrd and the suspend tools not working well wrt. suspend  on LVM and about dm_snapshot possibly having problems wrt. suspend, is not a good idea.
Comment 18 Felix Rommel 2007-03-28 13:19:01 UTC
Sorry, I unsettled things. To make it clear:

Comment #15 must be:

Suspend to DISK (I accidently wrote "...to RAM") with root partition in LVM does work sometimes with 10.3 Alpha1 + updates 2007-03-25 . Sometimes means, that sometimes after clicking Hibernate in Gnome dialog, computer starts suspend to DISK but freezes and does not shutdown clearly. But at other times computer suspends and shutdown is OK.

I will create a NEW bug report for Thinkpad Z61m not suspending to RAM - with information given at http://en.opensuse.org/S2ram.
Comment 19 Pavel Machek 2007-04-10 08:03:06 UTC
Felix: try suspending from console, and elevate console loglevel to see _where_ it hangs.
Comment 20 Felix Rommel 2007-04-10 20:04:03 UTC
With newer kernel

2.6.21-rc5-git6-2-default #1 SMP Fri Mar 30 23:55:02 UTC 2007 i686 i686 i386 GNU/Linux

it seems to work reliable now. In the last days I suspended to DISK a few times consecutively and it worked without problems. It maybe need a little bit too long until system starts counting how much data it has copied to disk but otherwise it works with this kernel version, now.
Comment 21 Pavel Machek 2007-04-22 16:41:28 UTC
Ok, thanks.
Comment 22 Forgotten User ZhJd0F0L3x 2007-06-21 21:05:05 UTC
*** Bug 267722 has been marked as a duplicate of this bug. ***
Comment 23 Bernhard Bender 2007-12-03 22:31:53 UTC
I just wanted to report that s2disk work fine for me on a LVM2/MD(RAID1) based system after upgrading to OpenSUSE 10.3

kernel 2.6.22.12-0.1-default
pm-utils-0.99.3.20070618-18

Thanks
Bernhard