# power management problem on Lenovo Carbon X1 4th gen

## dimpase

After installing the system a week ago, I cannot seem to fix the power management/suspend issue.

Symptoms:

s2ram works well at a root console (system properly goes to sleep and properly resumes)

s2ram does not work if I run it from su root in my X11 (I run a basic X11 installation started using startx with xmonad as the window manager). The only X11 applications I use are mate-terminal and chromium.

After leaving the system with X11 session on screen for a while, it goes into a power saving mode, from which it does not emerge properly (X11 dies and leaves a frozen console window behind, and only way to do anything then is to do a hard restart with the power button).

Closing laptop lid does not invoke a suspend mode, it simply had no effect.

It does not seem to make a difference whether I run laptop_mode (as described in https://wiki.gentoo.org/wiki/Power_management/Guide) or not.

Nothing seemingly interesting in dmesg or in other logs (I didn't try digging into laptop-mode options yet).

----------

In contrast, in Arch on the same machine I have a totally working suspend: I can just close the laptop lid and it goes into sleep, and resumes normally (I ran it for 1.5 months quite a lot, it never failed).

(I don't run systemd in Gentoo, it makes it a bit harder to dig up what's wrong...)

Basically, I'm at loss as where to even start. After more than 15 years of running Linux on laptops (more than a dozen of them IIRC), it's the 1st time I have it this bad...

Thanks,

Dima

----------

## Roman_Gruber

Duplicate your kernel.config,loaded modules and how you invoke that process from your ARCH installation.

I think you are missing some important kernel options. My guess: ACPI related, notebook related for your manufacturer. maybe some useflags missing.

Some kernel options are hidden and only show up when you enalbe those prerequisites.

----------

## dimpase

 *Roman_Gruber wrote:*   

> Duplicate your kernel.config,loaded modules and how you invoke that process from your ARCH installation.
> 
> I think you are missing some important kernel options. My guess: ACPI related, notebook related for your manufacturer. maybe some useflags missing.
> 
> Some kernel options are hidden and only show up when you enalbe those prerequisites.

 

Here is my lsmod:

```

Module                  Size  Used by

ccm                    20480  3

binfmt_misc            20480  1

snd_hda_codec_hdmi     45056  1

snd_hda_codec_conexant    20480  1

snd_hda_codec_generic    65536  1 snd_hda_codec_conexant

btusb                  40960  0

btrtl                  16384  1 btusb

btbcm                  16384  1 btusb

btintel                16384  1 btusb

bluetooth             471040  5 btrtl,btintel,btbcm,btusb

uvcvideo               81920  0

videobuf2_vmalloc      16384  1 uvcvideo

videobuf2_memops       16384  1 videobuf2_vmalloc

videobuf2_v4l2         20480  1 uvcvideo

videobuf2_core         32768  2 uvcvideo,videobuf2_v4l2

videodev              126976  3 uvcvideo,videobuf2_core,videobuf2_v4l2

media                  24576  2 uvcvideo,videodev

snd_soc_skl            61440  0

snd_soc_skl_ipc        32768  1 snd_soc_skl

snd_soc_sst_ipc        16384  1 snd_soc_skl_ipc

snd_soc_sst_dsp        16384  1 snd_soc_skl_ipc

snd_hda_ext_core       20480  1 snd_soc_skl

snd_soc_sst_match      16384  1 snd_soc_skl

mei_wdt                16384  0

snd_soc_core          163840  1 snd_soc_skl

snd_compress           20480  1 snd_soc_core

ac97_bus               16384  1 snd_soc_core

snd_pcm_dmaengine      16384  1 snd_soc_core

arc4                   16384  2

joydev                 20480  0

rtsx_pci_ms            20480  0

memstick               16384  1 rtsx_pci_ms

rtsx_pci_sdmmc         24576  0

iTCO_wdt               16384  0

iTCO_vendor_support    16384  1 iTCO_wdt

acer_wmi               20480  0

sparse_keymap          16384  1 acer_wmi

intel_rapl             20480  0

x86_pkg_temp_thermal    16384  0

intel_powerclamp       16384  0

coretemp               16384  0

kvm_intel             180224  0

kvm                   344064  1 kvm_intel

irqbypass              16384  1 kvm

crct10dif_pclmul       16384  0

crc32_pclmul           16384  0

ghash_clmulni_intel    16384  0

aesni_intel           167936  6

aes_x86_64             20480  1 aesni_intel

lrw                    16384  1 aesni_intel

glue_helper            16384  1 aesni_intel

ablk_helper            16384  1 aesni_intel

cryptd                 20480  3 ablk_helper,ghash_clmulni_intel,aesni_intel

intel_cstate           16384  0

intel_rapl_perf        16384  0

iwlmvm                290816  0

i915                 1138688  3

mac80211              487424  1 iwlmvm

drm_kms_helper        122880  1 i915

snd_hda_intel          32768  0

mei_me                 28672  0

drm                   270336  4 i915,drm_kms_helper

snd_hda_codec          98304  4 snd_hda_intel,snd_hda_codec_conexant,snd_hda_codec_hdmi,snd_hda_codec_generic

i2c_algo_bit           16384  1 i915

pcspkr                 16384  0

snd_hda_core           49152  7 snd_hda_intel,snd_hda_codec_conexant,snd_hda_codec,snd_hda_ext_core,snd_soc_skl,snd_hda_codec_hdmi,snd_hda_codec_generic

input_leds             16384  0

fb_sys_fops            16384  1 drm_kms_helper

snd_hwdep              16384  1 snd_hda_codec

syscopyarea            16384  1 drm_kms_helper

psmouse               118784  0

sysfillrect            16384  1 drm_kms_helper

snd_pcm                86016  8 snd_hda_intel,snd_hda_codec,snd_pcm_dmaengine,snd_hda_ext_core,snd_hda_core,snd_soc_skl,snd_hda_codec_hdmi,snd_soc_core

iwlwifi               139264  1 iwlmvm

serio_raw              16384  0

e1000e                221184  0

ptp                    20480  1 e1000e

sysimgblt              16384  1 drm_kms_helper

rtsx_pci               49152  2 rtsx_pci_sdmmc,rtsx_pci_ms

pps_core               16384  1 ptp

snd_timer              28672  1 snd_pcm

cfg80211              245760  3 iwlmvm,iwlwifi,mac80211

i2c_i801               28672  0

i2c_smbus              16384  1 i2c_i801

intel_pch_thermal      16384  0

mei                    77824  3 mei_me,mei_wdt

shpchp                 32768  0

wmi                    16384  1 acer_wmi

thinkpad_acpi          73728  1

nvram                  16384  1 thinkpad_acpi

snd                    69632  11 snd_compress,snd_hda_intel,snd_hwdep,snd_hda_codec_conexant,snd_hda_codec,snd_timer,thinkpad_acpi,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_soc_core,snd_pcm

evbug                  16384  0

soundcore              16384  1 snd

fjes                   28672  0

mac_hid                16384  0

video                  36864  3 acer_wmi,thinkpad_acpi,i915

```

the kernel .config file is here:

http://users.ox.ac.uk/~coml0531/gentooconfig.txt

all looks meaningful... [/code]

----------

## dimpase

[quote="dimpase"] *Roman_Gruber wrote:*   

> Duplicate your kernel.config,loaded modules and how you invoke that process from your ARCH installation.
> 
> I think you are missing some important kernel options. My guess: ACPI related, notebook related for your manufacturer. maybe some useflags missing.
> 
> Some kernel options are hidden and only show up when you enalbe those prerequisites.

 

I found out that the lid case in /etc/acpi/default.sh was simply commented out!

I added

```

case "$action" in

.... 

                        lid)

                                case "$id" in 

                                      close) s2ram;;

                                      open) :;;

                                      *)uhd $*;;

                                esac;;

```

This at least made the machine going to sleep and wake up properly on lid close/open.

Perhaps a better way to accomplish this would be to add a script into /etc/acpi/actions/, but I have

no idea what and how.

Why lid case was  commented out in the 1st place, I don't know. Perhaps cause it interfers with other, more usual, x11 setups? [/code]

----------

## dimpase

It seems it's down to DPMS not working properly.

Namely, the crash I describe is also triggered by running in xterm

the following: 

xset dpms force off

I don't know how to fix it (short of disabling DPMS).

----------

## dimpase

The problem went away after doing a full update (emerge ... @world) of the system just before the New Year.

----------

## toralf

 *dimpase wrote:*   

> The problem went away after doing a full update (emerge ... @world) of the system just before the New Year.

 what about putting a "[solved]" in front of this thread ?  :Wink: 

----------

