# "safe" migration from mainstream kernel to tuxonice?

## ese002

Is there a reasonably reliable "safe" way to do this?

I have hibernation working on the mainstream kernel but resume is miserably slow so I'm trying to migrate to tuxonice.

My understanding is that tuxonice can do uswsusp so that would seem the most straightforward way to start.  I would change just the kernel, make sure everything works before I start messing with configuration which may break hibernation.

tuxonice-4.5.2 clean boots fine.  But when I hibernate and resume, things go South.  

May 30 22:19:44 crab kernel: usb 2-1.3.1: reset full-speed USB device number 6 using ehci-pci

May 30 22:19:44 crab kernel: PM: restore of devices complete after 2127.036 msecs

May 30 22:19:44 crab kernel: BUG: Bad page state in process s2disk  pfn:41f000

May 30 22:19:48 crab kernel: page:ffffea00107c0000 count:0 mapcount:-2146500592 mapping:          (null) index:0x0 compound_mapcount: 0

May 30 22:19:48 crab kernel: flags: 0x8000000000004080(slab|head)

May 30 22:19:49 crab kernel: page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set

May 30 22:19:49 crab kernel: bad because of flags:

May 30 22:19:50 crab kernel: flags: 0x80(slab)

May 30 22:19:50 crab kernel: Modules linked in: i915 i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel drm snd_hda_codec snd_hwdep snd_hda_core snd_pcm snd_timer snd x86_pkg_temp_thermal mac_hid r8168(O) efivarfs tg3 e1000 dm_mirror dm_region_hash dm_log dm_mod sg sata_sil24 sata_sil pata_sil680 sr_mod sd_mod cdrom ahci libahci pata_hpt37x

May 30 22:19:50 crab kernel: CPU: 2 PID: 6859 Comm: s2disk Tainted: G           O    4.5.2-tuxonice #2

May 30 22:19:50 crab kernel: Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./Z77 Pro3, BIOS P2.10 07/12/2013

May 30 22:19:50 crab kernel:  0000000000000000 ffff880408e3fd90 ffffffff813fa968 ffffea00107c0000

May 30 22:19:50 crab kernel:  ffffffff819a9ca8 ffff880408e3fdb8 ffffffff8117947b ffffea00107c0000

May 30 22:19:50 crab kernel:  ffffea00107c0000 0000000000000001 ffff880408e3fdf0 ffffffff81179bfc

May 30 22:19:50 crab kernel: Call Trace:

May 30 22:19:50 crab kernel:  [<ffffffff813fa968>] dump_stack+0x4d/0x65

May 30 22:19:50 crab kernel:  [<ffffffff8117947b>] bad_page+0xab/0x100

May 30 22:19:50 crab kernel:  [<ffffffff81179bfc>] free_pages_prepare+0x21c/0x2b0

May 30 22:19:50 crab kernel:  [<ffffffff8117b87b>] free_hot_cold_page+0x1b/0x120

May 30 22:19:50 crab kernel:  [<ffffffff8117ba3d>] __free_pages+0x1d/0x20

May 30 22:19:50 crab kernel:  [<ffffffff810f76de>] swsusp_free+0x14e/0x1a0

May 30 22:19:50 crab kernel:  [<ffffffff810fb936>] snapshot_ioctl+0x186/0x440

May 30 22:19:50 crab kernel:  [<ffffffff811d7a19>] do_vfs_ioctl+0x89/0x580

May 30 22:19:50 crab kernel:  [<ffffffff8139bb0e>] ? security_file_ioctl+0x3e/0x60

May 30 22:19:50 crab kernel:  [<ffffffff811d7f84>] SyS_ioctl+0x74/0x80

May 30 22:19:50 crab kernel:  [<ffffffff817cfc1b>] entry_SYSCALL_64_fastpath+0x16/0x6e

May 30 22:19:50 crab kernel: Disabling lock debugging due to kernel taint

It actually does resume, despite the screens of kernel errors.  However, the machine soon locks up.

----------

## PeGa!

pf-sources user here. When I installed pf-sources I didn't have hibernation set, but I just configured the new kernel and everything went file.

At the moment of installation, pf-sources says this:

```
- sys-apps/tuxonice-userui: provides minimal userspace progress

information related to suspending and resuming process.

- sys-power/hibernate-script or sys-power/pm-utils: runtime utilities

for hibernating and suspending your computer."
```

Hope that helps.

----------

## ese002

More details:

If I attempt to hibernate using tuxonice facility, I get a kernel panic.

I hibernate using s2disk, hibernate works fine but I get a panic I when I resume.

The behavior is the same for tuxonice-4.5.2 and tuxonice-4.4.5

This is disappointing, to put it mildly.  What's the point of using tuxonice if hibernate doesn't work?

Interestingly, the 4.7 series of pf-sources no longer includes tuxonice.

The version of pf-sources in portage is 4.4-p8.  This version does include tuxonice and it crashes in the same way as the dedicated tuxonice kernels.

----------

## khayyam

ese002 ...

I have probably experienced the same when using a 4.x series kernel, and am fairly sure where the issue lies. Am I correct in thinking your architecture is x86?

Note that without TOI_REPLACE_SWSUSP=y you may find that whatever userland (s2disk) you're using doesn't function properly, I would consider using hibernate-script, at least for testing, as there may be some incompatibility involved unrelated to tuxonice.

best ... khay

----------

## ese002

Thanks,  khayyam.

Architecture is AMD64

TOI_REPLACE_SWSUSP=y for all tuxonice kernels

And, actually I have been using hibernate_script to test entering hibernate using tuxonice.

----------

## khayyam

 *ese002 wrote:*   

> Architecture is AMD64

 

ese002 ... I see, I was thinking the reason was the changes made due to x86 snapshot.c failing to compile. The contributed patches that were finally included in tuxonice 2016-04-21 (or prehaps sometime before) fixed the compilation (at least on 4.x series kernels) but (so I thought) introduced the above segfault. The fact that you also have issues suggests it may be something other than this. Unfortunately I wasn't keeping track of what specific kernel's, and patches, I'd tried at the time, but I wasn't able to get any 4.x kernel working ... I remember that much.

Have you tried a 3.12.60 with tuxonice-for-linux-3.12.58-2016-04-21.patch.bz2? (all patches can be found here). This is the kernel I'm currently using and hibernate works.

best ... khay

----------

## ese002

 *khayyam wrote:*   

>  *ese002 wrote:*   Architecture is AMD64 
> 
> ese002 ... I see, I was thinking the reason was the changes made due to x86 snapshot.c failing to compile. The contributed patches that were finally included in tuxonice 2016-04-21 (or prehaps sometime before) fixed the compilation (at least on 4.x series kernels) but (so I thought) introduced the above segfault. The fact that you also have issues suggests it may be something other than this. Unfortunately I wasn't keeping track of what specific kernel's, and patches, I'd tried at the time, but I wasn't able to get any 4.x kernel working ... I remember that much.
> 
> Have you tried a 3.12.60 with tuxonice-for-linux-3.12.58-2016-04-21.patch.bz2? (all patches can be found here). This is the kernel I'm currently using and hibernate works.
> ...

 

Is the patched kernel different from sys-kernel/tuxonice-sources-3.12.58?  This one is actually worse than  4.5.2 and 4.4.5 in that s2disk hangs.  tuxonice hangs like the other two.

Some possible differences:

I'm running software raid (mdadm) mirrored everything including swap.  I'm also using EFI boot, though it is hard to see how that could be a factor.

From refind.conf:

menuentry tuxonice-4.5.2 {

        icon EFI/BOOT/icons/os_gentoo.icns

        loader vmlinuz-4.5.2-tuxonice

        initrd initramfs-genkernel-x86_64-4.5.2-tuxonice

        options "ro root=/dev/md22 domdadm rootfstype=ext4 real_init=/usr/lib/systemd/systemd resume=swap:/dev/md23"

}

----------

