# Trouble with suspend/resume on 2.6.39-x

## Amity88

I did a fresh Gentoo install on an old p4 that I use for testing. The problem is that I can't resume from suspend, it works once in a blue moon but most of the time it permanantly stays in suspend and I have to hard reset it. The suspend seems to work correctly, the screen goes blank & I can hear the hard drive spin down.

I've tried the following to suspend.

```

echo 'standby' > /sys/power/state

```

```

echo 'mem' > /sys/power/state

```

```

pm-suspend

```

I downgraded to kernel 2.6.32-r29... and it seems to work perfectly! Is there a way to get it to work in 2.6.39-x ?

here's the emerge info

```

Portage 2.1.10.11 (default/linux/x86/10.0/desktop, gcc-4.4.5, glibc-2.12.2-r0, 2.6.32-gentoo-r29 i686)

=================================================================

System uname: Linux-2.6.32-gentoo-r29-i686-Intel-R-_Pentium-R-_4_CPU_2.40GHz-with-gentoo-2.0.3

Timestamp of tree: Wed, 14 Sep 2011 09:45:01 +0000

ccache version 2.4 [enabled]

app-shells/bash:          4.1_p9

dev-java/java-config:     2.1.11-r3

dev-lang/python:          2.7.1-r1, 3.1.3-r1

dev-util/ccache:          2.4-r9

dev-util/cmake:           2.8.4-r1

dev-util/pkgconfig:       0.26

sys-apps/baselayout:      2.0.3

sys-apps/openrc:          0.8.3-r1

sys-apps/sandbox:         2.4

sys-devel/autoconf:       2.13, 2.68

sys-devel/automake:       1.9.6-r3, 1.11.1

sys-devel/binutils:       2.20.1-r1

sys-devel/gcc:            4.4.5

sys-devel/gcc-config:     1.4.1-r1

sys-devel/libtool:        2.4-r1

sys-devel/make:           3.82

sys-kernel/linux-headers: 2.6.36.1 (virtual/os-headers)

sys-libs/glibc:           2.12.2

Repositories: gentoo

ACCEPT_KEYWORDS="x86"                                                                  

ACCEPT_LICENSE="*"                                                                     

CBUILD="i686-pc-linux-gnu"                                                             

CFLAGS="-Os -march=pentium4 -pipe -fomit-frame-pointer"                                

CHOST="i686-pc-linux-gnu"                                                              

CONFIG_PROTECT="/etc"                                                                  

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-Os -march=pentium4 -pipe -fomit-frame-pointer"                              

DISTDIR="/usr/portage/distfiles"

FEATURES="assume-digests binpkg-logs ccache distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

FFLAGS=""

GENTOO_MIRRORS="rsync://ftp.fi.muni.cz/pub/linux/gentoo/"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

LINGUAS="en"

MAKEOPTS="-j2"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY=""

SYNC="rsync://rsync.fi.gentoo.org/gentoo-portage"

USE="X a52 aac acl acpi alsa berkdb branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus djvu dri dts dvd dvdr emboss encode exif extensions fam ffmpeg firefox flac fortran gdbm gdu gif glitz gpm gstreamer iconv icu java jpeg lcms ldap mad mmx mng modules mp3 mp4 mpeg mudflap ncurses nls nptl nptlonly ogg opengl openmp pam pango pcre pdf perl png policykit ppds pppd python qt3support readline samba sdl session spell sqlite sse sse2 ssl startup-notification svg symlink sysfs tcpd threads tiff tordns truetype udev unicode usb vaapi vorbis win32codecs x264 x86 xcb xml xorg xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="via" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

```

----------

## mp342

Did you set /proc/acpi/wakeup to permit a wakeup with your keyboard ? (or anything you want to use)

Did you tried with 'shutdown' mode instead of 'platform' mode ?

----------

## Amity88

I didn't explicitly set it, the default one is identical for both kernels but works only with 2.6.32. Here's the output for cat /proc/acpi/wakeup

for 2.6.32

```

Device  S-state   Status   Sysfs node

SLPB      S5    *enabled   

PCI0      S5     disabled  no-bus:pci0000:00

USB3      S3     disabled  pci:0000:00:10.0

USB4      S3     disabled  pci:0000:00:10.1

USB5      S3     disabled  pci:0000:00:10.2

USB6      S3     disabled  pci:0000:00:10.3

USB7      S3     disabled  pci:0000:00:10.4

LAN0      S5     disabled  pci:0000:00:12.0

AC97      S5     disabled  pci:0000:00:11.5

UAR1      S5     disabled  pnp:00:09

```

for 2.6.39

```

Device  S-state   Status   Sysfs node

SLPB      S5    *enabled   

PCI0      S5    *disabled  no-bus:pci0000:00

USB3      S3    *disabled  pci:0000:00:10.0

USB4      S3    *disabled  pci:0000:00:10.1

USB5      S3    *disabled  pci:0000:00:10.2

USB6      S3    *disabled  pci:0000:00:10.3

USB7      S3    *disabled  pci:0000:00:10.4

LAN0      S5    *disabled  pci:0000:00:12.0

AC97      S5    *disabled  pci:0000:00:11.5

UAR1      S5    *disabled  pnp:00:09

```

what exactly are shutdown & platform modes?

----------

## mp342

 *Amity88 wrote:*   

> what exactly are shutdown & platform modes?

 

It's the hibernate mode in /sys/power/disk, I didn't noticed you talk about suspend.

When you use pm-suspend, is it going through the complete process (in /var/log/pm-suspend.log).

For the logs of the kernel part of the suspend, it's the tricky part of suspend, you have to complete the resume to see the logs !

----------

## Hu

Does it work in v2.6.38.8?  Can the affected system use hibernation?  Suspend-to-RAM, which you requested, requires more BIOS support than hibernation.

----------

## Amity88

@mp342,

 According to the logs, with 3.6.32 it does the whole thing (suspend and resume). With the 3.6.39, the log seems to show that only the suspend part is completed. Here are the two logs.

pm-suspend.log in 2.6.32-x

```

cat pm-suspend.log

Initial commandline parameters: 

Blacklisting 01grub.

Blacklisting 55NetworkManager.

Blacklisting 90clock.

Tue Sep 27 10:00:30 AST 2011: Running hooks for suspend.

Running hook /usr/lib/pm-utils/sleep.d/00logging suspend suspend:

Linux genesis 2.6.32-gentoo-r29 #5 Wed Sep 21 16:00:59 AST 2011 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz GenuineIntel GNU/Linux

Module                  Size  Used by

snd_via82xx            15802  0 

snd_ac97_codec         86014  1 snd_via82xx

sr_mod                 10362  0 

ac97_bus                 838  1 snd_ac97_codec

cdrom                  26985  1 sr_mod

snd_mpu401_uart         4204  1 snd_via82xx

snd_rawmidi            14228  1 snd_mpu401_uart

             total       used       free     shared    buffers     cached

Mem:        187360      96724      90636          0      14584      28288

-/+ buffers/cache:      53852     133508

Swap:       530104          0     530104

/usr/lib/pm-utils/sleep.d/00logging suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/00powersave suspend suspend:

Blacklisting 01grub.

Blacklisting 55NetworkManager.

Blacklisting 90clock.

/usr/lib/pm-utils/sleep.d/00powersave suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/01grub suspend suspend:

/usr/lib/pm-utils/sleep.d/01grub suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/49bluetooth suspend suspend:

/usr/lib/pm-utils/sleep.d/49bluetooth suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/55NetworkManager suspend suspend:

/usr/lib/pm-utils/sleep.d/55NetworkManager suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/75modules suspend suspend:

/usr/lib/pm-utils/sleep.d/75modules suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/90clock suspend suspend:

/usr/lib/pm-utils/sleep.d/90clock suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/94cpufreq suspend suspend:

/usr/lib/pm-utils/sleep.d/94cpufreq suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/95led suspend suspend:

/usr/lib/pm-utils/sleep.d/95led suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler suspend suspend:

No quirk database entry for this system, using default.

/usr/lib/pm-utils/sleep.d/98video-quirk-db-handler suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/99video suspend suspend:

kernel.acpi_video_flags = 0

Allocated buffer at 0x2010 (base is 0x0)

ES: 0x0201 EBX: 0x0000

/usr/lib/pm-utils/sleep.d/99video suspend suspend: success.

Tue Sep 27 10:00:33 AST 2011: performing suspend

Tue Sep 27 10:00:48 AST 2011: Awake.

Tue Sep 27 10:00:48 AST 2011: Running hooks for resume

Running hook /usr/lib/pm-utils/sleep.d/99video resume suspend:

Function not supported

Function not supported

/usr/lib/pm-utils/sleep.d/99video resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler resume suspend:

Saving last known working quirks: --quirk-vbe-post --quirk-dpms-on 

                            --quirk-dpms-suspend --quirk-vbestate-restore

                            --quirk-vbemode-restore --quirk-vga-mode-3

/usr/lib/pm-utils/sleep.d/98video-quirk-db-handler resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/95led resume suspend:

/usr/lib/pm-utils/sleep.d/95led resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/94cpufreq resume suspend:

/usr/lib/pm-utils/sleep.d/94cpufreq resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/90clock resume suspend:

/usr/lib/pm-utils/sleep.d/90clock resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/75modules resume suspend:

Reloaded unloaded modules.

/usr/lib/pm-utils/sleep.d/75modules resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/55NetworkManager resume suspend:

/usr/lib/pm-utils/sleep.d/55NetworkManager resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/49bluetooth resume suspend:

/usr/lib/pm-utils/sleep.d/49bluetooth resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/01grub resume suspend:

/usr/lib/pm-utils/sleep.d/01grub resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/00powersave resume suspend:

Blacklisting 01grub.

Blacklisting 55NetworkManager.

Blacklisting 90clock.

/usr/lib/pm-utils/sleep.d/00powersave resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/00logging resume suspend:

/usr/lib/pm-utils/sleep.d/00logging resume suspend: success.

Tue Sep 27 10:00:50 AST 2011: Finished.

```

pm-suspend in 2.6.39-x

```

Initial commandline parameters: 

Blacklisting 01grub.

Blacklisting 55NetworkManager.

Blacklisting 90clock.

Tue Sep 27 10:05:53 AST 2011: Running hooks for suspend.

Running hook /usr/lib/pm-utils/sleep.d/00logging suspend suspend:

Linux genesis 2.6.39-gentoo-r3 #12 Mon Sep 19 18:58:44 AST 2011 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz GenuineIntel GNU/Linux

Module                  Size  Used by

snd_via82xx            14110  0 

snd_ac97_codec         77580  1 snd_via82xx

ac97_bus                 710  1 snd_ac97_codec

snd_mpu401_uart         3755  1 snd_via82xx

snd_rawmidi            11943  1 snd_mpu401_uart

             total       used       free     shared    buffers     cached

Mem:        187384      97048      90336          0      14600      28880

-/+ buffers/cache:      53568     133816

Swap:       530108          0     530108

/usr/lib/pm-utils/sleep.d/00logging suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/00powersave suspend suspend:

Blacklisting 01grub.

Blacklisting 55NetworkManager.

Blacklisting 90clock.

/usr/lib/pm-utils/sleep.d/00powersave suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/01grub suspend suspend:

/usr/lib/pm-utils/sleep.d/01grub suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/49bluetooth suspend suspend:

/usr/lib/pm-utils/sleep.d/49bluetooth suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/55NetworkManager suspend suspend:

/usr/lib/pm-utils/sleep.d/55NetworkManager suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/75modules suspend suspend:

/usr/lib/pm-utils/sleep.d/75modules suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/90clock suspend suspend:

/usr/lib/pm-utils/sleep.d/90clock suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/94cpufreq suspend suspend:

/usr/lib/pm-utils/sleep.d/94cpufreq suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/95led suspend suspend:

/usr/lib/pm-utils/sleep.d/95led suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler suspend suspend:

No quirk database entry for this system, using default.

/usr/lib/pm-utils/sleep.d/98video-quirk-db-handler suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/99video suspend suspend:

kernel.acpi_video_flags = 0

Allocated buffer at 0x2010 (base is 0x0)

ES: 0x0201 EBX: 0x0000

/usr/lib/pm-utils/sleep.d/99video suspend suspend: success.

Tue Sep 27 10:05:55 AST 2011: performing suspend

```

@Hu,

 The bios has options to enable both S1 and S3. I just checked hibernation and suspend to ram..... neither works(even in 2.6.32)   :Sad: 

first I tried s3 suspend

```

echo 'mem' > /sys/power/state

```

S3 suspend with 2.6.32 seems to work... almost. The whole system seems to power down and resumes when I press some key, but the display stops working... but I can ssh into it. here is the pastebin of dmesg I executed from the ssh terminal.

The 2.6.39-x seem to hang 'during' suspending because the system doesn't seem to power down and it doesn't respond to any keypresses.

Then I tried hibernation.

```

pm-hibernate

```

  It seems to save the image and shutdown, but on power on it just boots normal. It doesn't resume the hibernation.... I suspect that this has something to do with the initrd image. I've read somewhere that I need a custom resume script. I didn't create one cos I never wanted hibernate.

  I haven't tried using 2.6.38.8 yet... why it specifically?

----------

## toralf

If you boot the lernel with "no_console_suspend" did you see anything at the console after resume ?

----------

## mp342

 *Amity88 wrote:*   

> @mp342,
> 
>  According to the logs, with 3.6.32 it does the whole thing (suspend and resume). With the 3.6.39, the log seems to show that only the suspend part is completed. Here are the two logs.
> 
> pm-suspend.log in 2.6.32-x
> ...

 

So, it's in the kernel part of the suspend.

 *Quote:*   

> 
> 
> Then I tried hibernation.
> 
> ```
> ...

 

Did you set the correct place of your swap partition for hibernate ? (resume=/dev/sdXX)

----------

## mp342

 *Amity88 wrote:*   

> S3 suspend with 2.6.32 seems to work... almost. The whole system seems to power down and resumes when I press some key, but the display stops working... but I can ssh into it. here is the pastebin of dmesg I executed from the ssh terminal.
> 
> The 2.6.39-x seem to hang 'during' suspending because the system doesn't seem to power down and it doesn't respond to any keypresses.

 

There are some workarounds for display issues ("quirk"). Never used them but you should dig into this, it could be the problem.

----------

## Amity88

Update:

 The S3 suspend does work with 2.6.32-x when I used pm-suspend instead. Both suspend and hibernate seems to work correctly from windows as well. What I don't understand is why the newer 2.6.39 cause problems   :Mad: 

@mp342,

 I just did the hibernate as a test, I don't really need it. But it sucks that I have to use an older kernel to get suspend to work properly.

@torlaf,

 I'll attempt that with the 2.6.39.... but it seems that it doesn't resume at all :/

----------

## mp342

Sometime, there are some regressions in new kernels. Wait for the next or try one between 2.6.32 and 2.6.39.

Recently, I had a kernel witch crash every time I plug my blackberry. The problem disappears with the next version.

----------

## Hu

 *Amity88 wrote:*   

> I haven't tried using 2.6.38.8 yet... why it specifically?

 That is the last stable kernel in the v2.6.38 line, so it will be as close to v2.6.39.x as possible without including anything from the v2.6.39 merge window.  If v2.6.38.8 works, then the regression was introduced in v2.6.39.  If it fails, then the regression was introduced earlier.

----------

## Amity88

I tried with gentoo kernel 2.6.38-r7. The kernel hangs after about 1.8 seconds into boot with a new error:

```

viafb 0000:01:00.0: PCI INT A -> GSI 16(level, low)-> IRQ16

viafb_init_dvi_size: dvi panel size undetected

```

I fixed it by disabling the framebuffer. But the important thing is that suspend does work in 2.6.38-r7.

----------

## depontius

This might be the same problem I had, moving a dedicated mythfrontend beyond 2.6.32.  Depending on how you are meaning to wake the system, it may not be sufficient to merely do something in /proc/acpi/wakeup.  If you're trying to wake with a USB device, you also have to walk somewhere in the USB device tree tell that device to be ready to wake the system.  If you don't do that, it goes to sleep along with everything else, instead of staying alert for the wake event.

I'm away from the system where I fixed this, so I can't tell you now exactly what I did.  If nobody has answered it by later tonight I'll take a look.

EDIT:

```
From /etc/conf.d/baselayout1.start :

# Enable wake-on-USB

echo "US15" >/proc/acpi/wakeup

echo "enabled" >/sys/bus/usb/devices/4-1/power/wakeup
```

The first (non-comment) line enables the usb wakeup at the acpi level, and the second line enables it at the usb device level.

----------

