Lenovo Thinkpad A475 suspend problem

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
0
down vote

favorite












I've got a Lenovo A475 running Ubuntu 17.10



Kernel:


4.13.0-32-generic #35-Ubuntu SMP Thu Jan 25 09:13:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux


Problem



The system does not stay suspended most of the time. If I go to suspend by pressing the power button and selecting suspend in the menu, the system goes to suspend for a brief moment and then immediately wakes up again.



If this is the case and I try to shutdown the computer completely it immediately reboots after the shutdown.



Here is a kernel log from a working suspend, where the system stays suspended:




[27662.813906] wlp3s0: deauthenticating from 8c:04:ff:7b:de:9d by local choice (Reason: 3=DEAUTH_LEAVING)
[27672.893549] PM: Syncing filesystems ... done.
[27672.906512] PM: Preparing system for sleep (mem)
[27672.906976] Freezing user space processes ... (elapsed 0.002 seconds) done.
[27672.909932] OOM killer disabled.
[27672.909933] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[27672.911919] PM: Suspending system (mem)
[27672.911965] Suspending console(s) (use no_console_suspend to debug)
[27673.309477] amdgpu: [powerplay] min_core_set_clock not set
[27673.740288] PM: suspend of devices complete after 827.870 msecs
[27673.741494] PM: late suspend of devices complete after 1.198 msecs
[27673.800476] PM: noirq suspend of devices complete after 58.974 msecs
[27673.800513] ACPI: Preparing to enter system sleep state S3
[27674.132241] ACPI: EC: event blocked
[27674.132243] ACPI: EC: EC stopped
[27674.132244] PM: Saving platform NVS memory
[27674.132272] Disabling non-boot CPUs ...
[27674.150225] smpboot: CPU 1 is now offline
[27674.168878] IRQ 44: no longer affine to CPU2
[27674.169904] smpboot: CPU 2 is now offline
[27674.196562] IRQ 1: no longer affine to CPU3
[27674.196567] IRQ 9: no longer affine to CPU3
[27674.196571] IRQ 12: no longer affine to CPU3
[27674.197594] smpboot: CPU 3 is now offline
[27674.197641] ACPI: Low-level resume complete
[27674.197641] ACPI: EC: EC started
[27674.197641] PM: Restoring platform NVS memory
[27674.197641] LVT offset 0 assigned for vector 0x400
[27674.197641] Suspended for 13.451 seconds
[27674.197641] Enabling non-boot CPUs ...
[27674.197641] x86: Booting SMP configuration:
[27674.197641] smpboot: Booting Node 0 Processor 1 APIC 0x11
[27674.199387] cache: parent cpu1 should not be sleeping
[27674.199476] microcode: CPU1: patch_level=0x06006118
[27674.199681] CPU1 is up
[27674.199713] smpboot: Booting Node 0 Processor 2 APIC 0x12
[27674.200221] cache: parent cpu2 should not be sleeping
[27674.200325] microcode: CPU2: patch_level=0x06006118
[27674.200676] CPU2 is up
[27674.200694] smpboot: Booting Node 0 Processor 3 APIC 0x13
[27674.201063] cache: parent cpu3 should not be sleeping
[27674.201162] microcode: CPU3: patch_level=0x06006118
[27674.202033] CPU3 is up
[27674.202633] ACPI: Waking up from system sleep state S3
[27675.205502] PM: noirq resume of devices complete after 41.201 msecs
[27675.206830] PM: early resume of devices complete after 1.259 msecs
[27675.206999] ACPI: EC: event unblocked
[27675.207189] rtlwifi: rtlwifi: wireless switch is on


And here is a log where the system did not stay suspended:




[27772.501575] wlp3s0: deauthenticating from 8c:04:ff:7b:de:9d by local choice (Reason: 3=DEAUTH_LEAVING)
[27782.568299] PM: Syncing filesystems ... done.
[27782.583517] PM: Preparing system for sleep (mem)
[27782.584194] Freezing user space processes ... (elapsed 0.002 seconds) done.
[27782.587130] OOM killer disabled.
[27782.587131] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[27782.588661] PM: Suspending system (mem)
[27782.588707] Suspending console(s) (use no_console_suspend to debug)
[27782.979671] amdgpu: [powerplay] min_core_set_clock not set
[27783.156276] PM: suspend of devices complete after 567.192 msecs
[27783.157518] PM: late suspend of devices complete after 1.234 msecs
[27783.216763] PM: noirq suspend of devices complete after 59.238 msecs
[27783.216796] ACPI: Preparing to enter system sleep state S3
[27783.548241] ACPI: EC: event blocked
[27783.548243] ACPI: EC: EC stopped
[27783.548244] PM: Saving platform NVS memory
[27783.548269] Disabling non-boot CPUs ...
[27783.566060] smpboot: CPU 1 is now offline
[27783.585791] smpboot: CPU 2 is now offline
[27783.612520] IRQ 1: no longer affine to CPU3
[27783.612525] IRQ 9: no longer affine to CPU3
[27783.612529] IRQ 12: no longer affine to CPU3
[27783.612538] IRQ 44: no longer affine to CPU3
[27783.613553] smpboot: CPU 3 is now offline
[27783.613605] ACPI: Low-level resume complete
[27783.613605] ACPI: EC: EC started
[27783.613605] PM: Restoring platform NVS memory
[27783.613605] LVT offset 0 assigned for vector 0x400
[27783.613605] Suspended for 1.436 seconds
[27783.613605] Enabling non-boot CPUs ...
[27783.613605] x86: Booting SMP configuration:
[27783.613605] smpboot: Booting Node 0 Processor 1 APIC 0x11
[27783.615061] cache: parent cpu1 should not be sleeping
[27783.615150] microcode: CPU1: patch_level=0x06006118
[27783.615327] CPU1 is up
[27783.615372] smpboot: Booting Node 0 Processor 2 APIC 0x12
[27783.615897] cache: parent cpu2 should not be sleeping
[27783.616000] microcode: CPU2: patch_level=0x06006118
[27783.616313] CPU2 is up
[27783.616332] smpboot: Booting Node 0 Processor 3 APIC 0x13
[27783.616729] cache: parent cpu3 should not be sleeping
[27783.616838] microcode: CPU3: patch_level=0x06006118
[27783.617554] CPU3 is up
[27783.618155] ACPI: Waking up from system sleep state S3
[27784.613649] PM: noirq resume of devices complete after 41.395 msecs
[27784.614935] PM: early resume of devices complete after 1.255 msecs
[27784.615105] ACPI: EC: event unblocked
[27784.615322] rtlwifi: rtlwifi: wireless switch is on


I did not find any real differences that could explain this behavior.



After some digging I found advice that mentioned disabling everything that could wakeup the system before suspend.



So I tried to disable wifi and disabled everything in /proc/acpi/wakeup




Device S-state Status Sysfs node
GPP0 S4 *disabled
GPP1 S4 *disabled pci:0000:00:02.2
GPP2 S4 *disabled pci:0000:00:02.3
GPP3 S4 *disabled pci:0000:00:02.4
GFX1 S4 *disabled
GFX2 S4 *disabled
GFX3 S4 *disabled
GFX4 S4 *disabled
XHC0 S3 *disabled pci:0000:00:10.0
EHC1 S3 *disabled pci:0000:00:12.0
SBAZ S4 *disabled
LID S3 *disabled platform:PNP0C0D:00
SLPB S3 *disabled platform:PNP0C0E:00


But it still restarts immediately after suspend.



Partial solution



After some further digging I figured out that the problem only arises if I wakeup the system by opening the lid.



If I suspend and resume solely with the power button without closing the lid the above mentioned problem does not arise.
It somehow seems the event generated by opening the lid is always present after it has been emitted once (I don't know if this is the correct terminology, but it is the best explanation i have)



Disabling the lid in /proc/acpi/wakeup before it is emitted keeps the problem from occuring. This means that the system will not wakeup if the laptop lid is opened but pressing a button to wake it up is not really a trouble to me.



In order to disable the lid permanently I created a small systemd service that makes the change



Create a file /etc/systemd/system/lid-deactivate.service




[Unit]
Description=Deactivate LID

[Service]
ExecStart=/var/scripts/deactivate-lid.sh

[Install]
WantedBy=multi-user.target


and a script /var/scripts/deactivate-lid.sh (or wherever you want to put it)




#!/bin/bash

#Disable the lid switch
echo "LID" > /proc/acpi/wakeup


and make it executable.



Finally enable the service with




systemctl enable lid-deactivate


After that every time the system starts the lid gets deactivated (please note that writing to /proc/acpi/wakeup toggles the state of each acpi device, so if you call it more than once it will get reenabled)



Conclusion



This is only a temporary fix and I hope this helps someone with the same issue, while at the same time I also hope that someone can help find a permanent fix that does not require this workaround.










share|improve this question

























    up vote
    0
    down vote

    favorite












    I've got a Lenovo A475 running Ubuntu 17.10



    Kernel:


    4.13.0-32-generic #35-Ubuntu SMP Thu Jan 25 09:13:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux


    Problem



    The system does not stay suspended most of the time. If I go to suspend by pressing the power button and selecting suspend in the menu, the system goes to suspend for a brief moment and then immediately wakes up again.



    If this is the case and I try to shutdown the computer completely it immediately reboots after the shutdown.



    Here is a kernel log from a working suspend, where the system stays suspended:




    [27662.813906] wlp3s0: deauthenticating from 8c:04:ff:7b:de:9d by local choice (Reason: 3=DEAUTH_LEAVING)
    [27672.893549] PM: Syncing filesystems ... done.
    [27672.906512] PM: Preparing system for sleep (mem)
    [27672.906976] Freezing user space processes ... (elapsed 0.002 seconds) done.
    [27672.909932] OOM killer disabled.
    [27672.909933] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
    [27672.911919] PM: Suspending system (mem)
    [27672.911965] Suspending console(s) (use no_console_suspend to debug)
    [27673.309477] amdgpu: [powerplay] min_core_set_clock not set
    [27673.740288] PM: suspend of devices complete after 827.870 msecs
    [27673.741494] PM: late suspend of devices complete after 1.198 msecs
    [27673.800476] PM: noirq suspend of devices complete after 58.974 msecs
    [27673.800513] ACPI: Preparing to enter system sleep state S3
    [27674.132241] ACPI: EC: event blocked
    [27674.132243] ACPI: EC: EC stopped
    [27674.132244] PM: Saving platform NVS memory
    [27674.132272] Disabling non-boot CPUs ...
    [27674.150225] smpboot: CPU 1 is now offline
    [27674.168878] IRQ 44: no longer affine to CPU2
    [27674.169904] smpboot: CPU 2 is now offline
    [27674.196562] IRQ 1: no longer affine to CPU3
    [27674.196567] IRQ 9: no longer affine to CPU3
    [27674.196571] IRQ 12: no longer affine to CPU3
    [27674.197594] smpboot: CPU 3 is now offline
    [27674.197641] ACPI: Low-level resume complete
    [27674.197641] ACPI: EC: EC started
    [27674.197641] PM: Restoring platform NVS memory
    [27674.197641] LVT offset 0 assigned for vector 0x400
    [27674.197641] Suspended for 13.451 seconds
    [27674.197641] Enabling non-boot CPUs ...
    [27674.197641] x86: Booting SMP configuration:
    [27674.197641] smpboot: Booting Node 0 Processor 1 APIC 0x11
    [27674.199387] cache: parent cpu1 should not be sleeping
    [27674.199476] microcode: CPU1: patch_level=0x06006118
    [27674.199681] CPU1 is up
    [27674.199713] smpboot: Booting Node 0 Processor 2 APIC 0x12
    [27674.200221] cache: parent cpu2 should not be sleeping
    [27674.200325] microcode: CPU2: patch_level=0x06006118
    [27674.200676] CPU2 is up
    [27674.200694] smpboot: Booting Node 0 Processor 3 APIC 0x13
    [27674.201063] cache: parent cpu3 should not be sleeping
    [27674.201162] microcode: CPU3: patch_level=0x06006118
    [27674.202033] CPU3 is up
    [27674.202633] ACPI: Waking up from system sleep state S3
    [27675.205502] PM: noirq resume of devices complete after 41.201 msecs
    [27675.206830] PM: early resume of devices complete after 1.259 msecs
    [27675.206999] ACPI: EC: event unblocked
    [27675.207189] rtlwifi: rtlwifi: wireless switch is on


    And here is a log where the system did not stay suspended:




    [27772.501575] wlp3s0: deauthenticating from 8c:04:ff:7b:de:9d by local choice (Reason: 3=DEAUTH_LEAVING)
    [27782.568299] PM: Syncing filesystems ... done.
    [27782.583517] PM: Preparing system for sleep (mem)
    [27782.584194] Freezing user space processes ... (elapsed 0.002 seconds) done.
    [27782.587130] OOM killer disabled.
    [27782.587131] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
    [27782.588661] PM: Suspending system (mem)
    [27782.588707] Suspending console(s) (use no_console_suspend to debug)
    [27782.979671] amdgpu: [powerplay] min_core_set_clock not set
    [27783.156276] PM: suspend of devices complete after 567.192 msecs
    [27783.157518] PM: late suspend of devices complete after 1.234 msecs
    [27783.216763] PM: noirq suspend of devices complete after 59.238 msecs
    [27783.216796] ACPI: Preparing to enter system sleep state S3
    [27783.548241] ACPI: EC: event blocked
    [27783.548243] ACPI: EC: EC stopped
    [27783.548244] PM: Saving platform NVS memory
    [27783.548269] Disabling non-boot CPUs ...
    [27783.566060] smpboot: CPU 1 is now offline
    [27783.585791] smpboot: CPU 2 is now offline
    [27783.612520] IRQ 1: no longer affine to CPU3
    [27783.612525] IRQ 9: no longer affine to CPU3
    [27783.612529] IRQ 12: no longer affine to CPU3
    [27783.612538] IRQ 44: no longer affine to CPU3
    [27783.613553] smpboot: CPU 3 is now offline
    [27783.613605] ACPI: Low-level resume complete
    [27783.613605] ACPI: EC: EC started
    [27783.613605] PM: Restoring platform NVS memory
    [27783.613605] LVT offset 0 assigned for vector 0x400
    [27783.613605] Suspended for 1.436 seconds
    [27783.613605] Enabling non-boot CPUs ...
    [27783.613605] x86: Booting SMP configuration:
    [27783.613605] smpboot: Booting Node 0 Processor 1 APIC 0x11
    [27783.615061] cache: parent cpu1 should not be sleeping
    [27783.615150] microcode: CPU1: patch_level=0x06006118
    [27783.615327] CPU1 is up
    [27783.615372] smpboot: Booting Node 0 Processor 2 APIC 0x12
    [27783.615897] cache: parent cpu2 should not be sleeping
    [27783.616000] microcode: CPU2: patch_level=0x06006118
    [27783.616313] CPU2 is up
    [27783.616332] smpboot: Booting Node 0 Processor 3 APIC 0x13
    [27783.616729] cache: parent cpu3 should not be sleeping
    [27783.616838] microcode: CPU3: patch_level=0x06006118
    [27783.617554] CPU3 is up
    [27783.618155] ACPI: Waking up from system sleep state S3
    [27784.613649] PM: noirq resume of devices complete after 41.395 msecs
    [27784.614935] PM: early resume of devices complete after 1.255 msecs
    [27784.615105] ACPI: EC: event unblocked
    [27784.615322] rtlwifi: rtlwifi: wireless switch is on


    I did not find any real differences that could explain this behavior.



    After some digging I found advice that mentioned disabling everything that could wakeup the system before suspend.



    So I tried to disable wifi and disabled everything in /proc/acpi/wakeup




    Device S-state Status Sysfs node
    GPP0 S4 *disabled
    GPP1 S4 *disabled pci:0000:00:02.2
    GPP2 S4 *disabled pci:0000:00:02.3
    GPP3 S4 *disabled pci:0000:00:02.4
    GFX1 S4 *disabled
    GFX2 S4 *disabled
    GFX3 S4 *disabled
    GFX4 S4 *disabled
    XHC0 S3 *disabled pci:0000:00:10.0
    EHC1 S3 *disabled pci:0000:00:12.0
    SBAZ S4 *disabled
    LID S3 *disabled platform:PNP0C0D:00
    SLPB S3 *disabled platform:PNP0C0E:00


    But it still restarts immediately after suspend.



    Partial solution



    After some further digging I figured out that the problem only arises if I wakeup the system by opening the lid.



    If I suspend and resume solely with the power button without closing the lid the above mentioned problem does not arise.
    It somehow seems the event generated by opening the lid is always present after it has been emitted once (I don't know if this is the correct terminology, but it is the best explanation i have)



    Disabling the lid in /proc/acpi/wakeup before it is emitted keeps the problem from occuring. This means that the system will not wakeup if the laptop lid is opened but pressing a button to wake it up is not really a trouble to me.



    In order to disable the lid permanently I created a small systemd service that makes the change



    Create a file /etc/systemd/system/lid-deactivate.service




    [Unit]
    Description=Deactivate LID

    [Service]
    ExecStart=/var/scripts/deactivate-lid.sh

    [Install]
    WantedBy=multi-user.target


    and a script /var/scripts/deactivate-lid.sh (or wherever you want to put it)




    #!/bin/bash

    #Disable the lid switch
    echo "LID" > /proc/acpi/wakeup


    and make it executable.



    Finally enable the service with




    systemctl enable lid-deactivate


    After that every time the system starts the lid gets deactivated (please note that writing to /proc/acpi/wakeup toggles the state of each acpi device, so if you call it more than once it will get reenabled)



    Conclusion



    This is only a temporary fix and I hope this helps someone with the same issue, while at the same time I also hope that someone can help find a permanent fix that does not require this workaround.










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I've got a Lenovo A475 running Ubuntu 17.10



      Kernel:


      4.13.0-32-generic #35-Ubuntu SMP Thu Jan 25 09:13:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux


      Problem



      The system does not stay suspended most of the time. If I go to suspend by pressing the power button and selecting suspend in the menu, the system goes to suspend for a brief moment and then immediately wakes up again.



      If this is the case and I try to shutdown the computer completely it immediately reboots after the shutdown.



      Here is a kernel log from a working suspend, where the system stays suspended:




      [27662.813906] wlp3s0: deauthenticating from 8c:04:ff:7b:de:9d by local choice (Reason: 3=DEAUTH_LEAVING)
      [27672.893549] PM: Syncing filesystems ... done.
      [27672.906512] PM: Preparing system for sleep (mem)
      [27672.906976] Freezing user space processes ... (elapsed 0.002 seconds) done.
      [27672.909932] OOM killer disabled.
      [27672.909933] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
      [27672.911919] PM: Suspending system (mem)
      [27672.911965] Suspending console(s) (use no_console_suspend to debug)
      [27673.309477] amdgpu: [powerplay] min_core_set_clock not set
      [27673.740288] PM: suspend of devices complete after 827.870 msecs
      [27673.741494] PM: late suspend of devices complete after 1.198 msecs
      [27673.800476] PM: noirq suspend of devices complete after 58.974 msecs
      [27673.800513] ACPI: Preparing to enter system sleep state S3
      [27674.132241] ACPI: EC: event blocked
      [27674.132243] ACPI: EC: EC stopped
      [27674.132244] PM: Saving platform NVS memory
      [27674.132272] Disabling non-boot CPUs ...
      [27674.150225] smpboot: CPU 1 is now offline
      [27674.168878] IRQ 44: no longer affine to CPU2
      [27674.169904] smpboot: CPU 2 is now offline
      [27674.196562] IRQ 1: no longer affine to CPU3
      [27674.196567] IRQ 9: no longer affine to CPU3
      [27674.196571] IRQ 12: no longer affine to CPU3
      [27674.197594] smpboot: CPU 3 is now offline
      [27674.197641] ACPI: Low-level resume complete
      [27674.197641] ACPI: EC: EC started
      [27674.197641] PM: Restoring platform NVS memory
      [27674.197641] LVT offset 0 assigned for vector 0x400
      [27674.197641] Suspended for 13.451 seconds
      [27674.197641] Enabling non-boot CPUs ...
      [27674.197641] x86: Booting SMP configuration:
      [27674.197641] smpboot: Booting Node 0 Processor 1 APIC 0x11
      [27674.199387] cache: parent cpu1 should not be sleeping
      [27674.199476] microcode: CPU1: patch_level=0x06006118
      [27674.199681] CPU1 is up
      [27674.199713] smpboot: Booting Node 0 Processor 2 APIC 0x12
      [27674.200221] cache: parent cpu2 should not be sleeping
      [27674.200325] microcode: CPU2: patch_level=0x06006118
      [27674.200676] CPU2 is up
      [27674.200694] smpboot: Booting Node 0 Processor 3 APIC 0x13
      [27674.201063] cache: parent cpu3 should not be sleeping
      [27674.201162] microcode: CPU3: patch_level=0x06006118
      [27674.202033] CPU3 is up
      [27674.202633] ACPI: Waking up from system sleep state S3
      [27675.205502] PM: noirq resume of devices complete after 41.201 msecs
      [27675.206830] PM: early resume of devices complete after 1.259 msecs
      [27675.206999] ACPI: EC: event unblocked
      [27675.207189] rtlwifi: rtlwifi: wireless switch is on


      And here is a log where the system did not stay suspended:




      [27772.501575] wlp3s0: deauthenticating from 8c:04:ff:7b:de:9d by local choice (Reason: 3=DEAUTH_LEAVING)
      [27782.568299] PM: Syncing filesystems ... done.
      [27782.583517] PM: Preparing system for sleep (mem)
      [27782.584194] Freezing user space processes ... (elapsed 0.002 seconds) done.
      [27782.587130] OOM killer disabled.
      [27782.587131] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
      [27782.588661] PM: Suspending system (mem)
      [27782.588707] Suspending console(s) (use no_console_suspend to debug)
      [27782.979671] amdgpu: [powerplay] min_core_set_clock not set
      [27783.156276] PM: suspend of devices complete after 567.192 msecs
      [27783.157518] PM: late suspend of devices complete after 1.234 msecs
      [27783.216763] PM: noirq suspend of devices complete after 59.238 msecs
      [27783.216796] ACPI: Preparing to enter system sleep state S3
      [27783.548241] ACPI: EC: event blocked
      [27783.548243] ACPI: EC: EC stopped
      [27783.548244] PM: Saving platform NVS memory
      [27783.548269] Disabling non-boot CPUs ...
      [27783.566060] smpboot: CPU 1 is now offline
      [27783.585791] smpboot: CPU 2 is now offline
      [27783.612520] IRQ 1: no longer affine to CPU3
      [27783.612525] IRQ 9: no longer affine to CPU3
      [27783.612529] IRQ 12: no longer affine to CPU3
      [27783.612538] IRQ 44: no longer affine to CPU3
      [27783.613553] smpboot: CPU 3 is now offline
      [27783.613605] ACPI: Low-level resume complete
      [27783.613605] ACPI: EC: EC started
      [27783.613605] PM: Restoring platform NVS memory
      [27783.613605] LVT offset 0 assigned for vector 0x400
      [27783.613605] Suspended for 1.436 seconds
      [27783.613605] Enabling non-boot CPUs ...
      [27783.613605] x86: Booting SMP configuration:
      [27783.613605] smpboot: Booting Node 0 Processor 1 APIC 0x11
      [27783.615061] cache: parent cpu1 should not be sleeping
      [27783.615150] microcode: CPU1: patch_level=0x06006118
      [27783.615327] CPU1 is up
      [27783.615372] smpboot: Booting Node 0 Processor 2 APIC 0x12
      [27783.615897] cache: parent cpu2 should not be sleeping
      [27783.616000] microcode: CPU2: patch_level=0x06006118
      [27783.616313] CPU2 is up
      [27783.616332] smpboot: Booting Node 0 Processor 3 APIC 0x13
      [27783.616729] cache: parent cpu3 should not be sleeping
      [27783.616838] microcode: CPU3: patch_level=0x06006118
      [27783.617554] CPU3 is up
      [27783.618155] ACPI: Waking up from system sleep state S3
      [27784.613649] PM: noirq resume of devices complete after 41.395 msecs
      [27784.614935] PM: early resume of devices complete after 1.255 msecs
      [27784.615105] ACPI: EC: event unblocked
      [27784.615322] rtlwifi: rtlwifi: wireless switch is on


      I did not find any real differences that could explain this behavior.



      After some digging I found advice that mentioned disabling everything that could wakeup the system before suspend.



      So I tried to disable wifi and disabled everything in /proc/acpi/wakeup




      Device S-state Status Sysfs node
      GPP0 S4 *disabled
      GPP1 S4 *disabled pci:0000:00:02.2
      GPP2 S4 *disabled pci:0000:00:02.3
      GPP3 S4 *disabled pci:0000:00:02.4
      GFX1 S4 *disabled
      GFX2 S4 *disabled
      GFX3 S4 *disabled
      GFX4 S4 *disabled
      XHC0 S3 *disabled pci:0000:00:10.0
      EHC1 S3 *disabled pci:0000:00:12.0
      SBAZ S4 *disabled
      LID S3 *disabled platform:PNP0C0D:00
      SLPB S3 *disabled platform:PNP0C0E:00


      But it still restarts immediately after suspend.



      Partial solution



      After some further digging I figured out that the problem only arises if I wakeup the system by opening the lid.



      If I suspend and resume solely with the power button without closing the lid the above mentioned problem does not arise.
      It somehow seems the event generated by opening the lid is always present after it has been emitted once (I don't know if this is the correct terminology, but it is the best explanation i have)



      Disabling the lid in /proc/acpi/wakeup before it is emitted keeps the problem from occuring. This means that the system will not wakeup if the laptop lid is opened but pressing a button to wake it up is not really a trouble to me.



      In order to disable the lid permanently I created a small systemd service that makes the change



      Create a file /etc/systemd/system/lid-deactivate.service




      [Unit]
      Description=Deactivate LID

      [Service]
      ExecStart=/var/scripts/deactivate-lid.sh

      [Install]
      WantedBy=multi-user.target


      and a script /var/scripts/deactivate-lid.sh (or wherever you want to put it)




      #!/bin/bash

      #Disable the lid switch
      echo "LID" > /proc/acpi/wakeup


      and make it executable.



      Finally enable the service with




      systemctl enable lid-deactivate


      After that every time the system starts the lid gets deactivated (please note that writing to /proc/acpi/wakeup toggles the state of each acpi device, so if you call it more than once it will get reenabled)



      Conclusion



      This is only a temporary fix and I hope this helps someone with the same issue, while at the same time I also hope that someone can help find a permanent fix that does not require this workaround.










      share|improve this question













      I've got a Lenovo A475 running Ubuntu 17.10



      Kernel:


      4.13.0-32-generic #35-Ubuntu SMP Thu Jan 25 09:13:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux


      Problem



      The system does not stay suspended most of the time. If I go to suspend by pressing the power button and selecting suspend in the menu, the system goes to suspend for a brief moment and then immediately wakes up again.



      If this is the case and I try to shutdown the computer completely it immediately reboots after the shutdown.



      Here is a kernel log from a working suspend, where the system stays suspended:




      [27662.813906] wlp3s0: deauthenticating from 8c:04:ff:7b:de:9d by local choice (Reason: 3=DEAUTH_LEAVING)
      [27672.893549] PM: Syncing filesystems ... done.
      [27672.906512] PM: Preparing system for sleep (mem)
      [27672.906976] Freezing user space processes ... (elapsed 0.002 seconds) done.
      [27672.909932] OOM killer disabled.
      [27672.909933] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
      [27672.911919] PM: Suspending system (mem)
      [27672.911965] Suspending console(s) (use no_console_suspend to debug)
      [27673.309477] amdgpu: [powerplay] min_core_set_clock not set
      [27673.740288] PM: suspend of devices complete after 827.870 msecs
      [27673.741494] PM: late suspend of devices complete after 1.198 msecs
      [27673.800476] PM: noirq suspend of devices complete after 58.974 msecs
      [27673.800513] ACPI: Preparing to enter system sleep state S3
      [27674.132241] ACPI: EC: event blocked
      [27674.132243] ACPI: EC: EC stopped
      [27674.132244] PM: Saving platform NVS memory
      [27674.132272] Disabling non-boot CPUs ...
      [27674.150225] smpboot: CPU 1 is now offline
      [27674.168878] IRQ 44: no longer affine to CPU2
      [27674.169904] smpboot: CPU 2 is now offline
      [27674.196562] IRQ 1: no longer affine to CPU3
      [27674.196567] IRQ 9: no longer affine to CPU3
      [27674.196571] IRQ 12: no longer affine to CPU3
      [27674.197594] smpboot: CPU 3 is now offline
      [27674.197641] ACPI: Low-level resume complete
      [27674.197641] ACPI: EC: EC started
      [27674.197641] PM: Restoring platform NVS memory
      [27674.197641] LVT offset 0 assigned for vector 0x400
      [27674.197641] Suspended for 13.451 seconds
      [27674.197641] Enabling non-boot CPUs ...
      [27674.197641] x86: Booting SMP configuration:
      [27674.197641] smpboot: Booting Node 0 Processor 1 APIC 0x11
      [27674.199387] cache: parent cpu1 should not be sleeping
      [27674.199476] microcode: CPU1: patch_level=0x06006118
      [27674.199681] CPU1 is up
      [27674.199713] smpboot: Booting Node 0 Processor 2 APIC 0x12
      [27674.200221] cache: parent cpu2 should not be sleeping
      [27674.200325] microcode: CPU2: patch_level=0x06006118
      [27674.200676] CPU2 is up
      [27674.200694] smpboot: Booting Node 0 Processor 3 APIC 0x13
      [27674.201063] cache: parent cpu3 should not be sleeping
      [27674.201162] microcode: CPU3: patch_level=0x06006118
      [27674.202033] CPU3 is up
      [27674.202633] ACPI: Waking up from system sleep state S3
      [27675.205502] PM: noirq resume of devices complete after 41.201 msecs
      [27675.206830] PM: early resume of devices complete after 1.259 msecs
      [27675.206999] ACPI: EC: event unblocked
      [27675.207189] rtlwifi: rtlwifi: wireless switch is on


      And here is a log where the system did not stay suspended:




      [27772.501575] wlp3s0: deauthenticating from 8c:04:ff:7b:de:9d by local choice (Reason: 3=DEAUTH_LEAVING)
      [27782.568299] PM: Syncing filesystems ... done.
      [27782.583517] PM: Preparing system for sleep (mem)
      [27782.584194] Freezing user space processes ... (elapsed 0.002 seconds) done.
      [27782.587130] OOM killer disabled.
      [27782.587131] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
      [27782.588661] PM: Suspending system (mem)
      [27782.588707] Suspending console(s) (use no_console_suspend to debug)
      [27782.979671] amdgpu: [powerplay] min_core_set_clock not set
      [27783.156276] PM: suspend of devices complete after 567.192 msecs
      [27783.157518] PM: late suspend of devices complete after 1.234 msecs
      [27783.216763] PM: noirq suspend of devices complete after 59.238 msecs
      [27783.216796] ACPI: Preparing to enter system sleep state S3
      [27783.548241] ACPI: EC: event blocked
      [27783.548243] ACPI: EC: EC stopped
      [27783.548244] PM: Saving platform NVS memory
      [27783.548269] Disabling non-boot CPUs ...
      [27783.566060] smpboot: CPU 1 is now offline
      [27783.585791] smpboot: CPU 2 is now offline
      [27783.612520] IRQ 1: no longer affine to CPU3
      [27783.612525] IRQ 9: no longer affine to CPU3
      [27783.612529] IRQ 12: no longer affine to CPU3
      [27783.612538] IRQ 44: no longer affine to CPU3
      [27783.613553] smpboot: CPU 3 is now offline
      [27783.613605] ACPI: Low-level resume complete
      [27783.613605] ACPI: EC: EC started
      [27783.613605] PM: Restoring platform NVS memory
      [27783.613605] LVT offset 0 assigned for vector 0x400
      [27783.613605] Suspended for 1.436 seconds
      [27783.613605] Enabling non-boot CPUs ...
      [27783.613605] x86: Booting SMP configuration:
      [27783.613605] smpboot: Booting Node 0 Processor 1 APIC 0x11
      [27783.615061] cache: parent cpu1 should not be sleeping
      [27783.615150] microcode: CPU1: patch_level=0x06006118
      [27783.615327] CPU1 is up
      [27783.615372] smpboot: Booting Node 0 Processor 2 APIC 0x12
      [27783.615897] cache: parent cpu2 should not be sleeping
      [27783.616000] microcode: CPU2: patch_level=0x06006118
      [27783.616313] CPU2 is up
      [27783.616332] smpboot: Booting Node 0 Processor 3 APIC 0x13
      [27783.616729] cache: parent cpu3 should not be sleeping
      [27783.616838] microcode: CPU3: patch_level=0x06006118
      [27783.617554] CPU3 is up
      [27783.618155] ACPI: Waking up from system sleep state S3
      [27784.613649] PM: noirq resume of devices complete after 41.395 msecs
      [27784.614935] PM: early resume of devices complete after 1.255 msecs
      [27784.615105] ACPI: EC: event unblocked
      [27784.615322] rtlwifi: rtlwifi: wireless switch is on


      I did not find any real differences that could explain this behavior.



      After some digging I found advice that mentioned disabling everything that could wakeup the system before suspend.



      So I tried to disable wifi and disabled everything in /proc/acpi/wakeup




      Device S-state Status Sysfs node
      GPP0 S4 *disabled
      GPP1 S4 *disabled pci:0000:00:02.2
      GPP2 S4 *disabled pci:0000:00:02.3
      GPP3 S4 *disabled pci:0000:00:02.4
      GFX1 S4 *disabled
      GFX2 S4 *disabled
      GFX3 S4 *disabled
      GFX4 S4 *disabled
      XHC0 S3 *disabled pci:0000:00:10.0
      EHC1 S3 *disabled pci:0000:00:12.0
      SBAZ S4 *disabled
      LID S3 *disabled platform:PNP0C0D:00
      SLPB S3 *disabled platform:PNP0C0E:00


      But it still restarts immediately after suspend.



      Partial solution



      After some further digging I figured out that the problem only arises if I wakeup the system by opening the lid.



      If I suspend and resume solely with the power button without closing the lid the above mentioned problem does not arise.
      It somehow seems the event generated by opening the lid is always present after it has been emitted once (I don't know if this is the correct terminology, but it is the best explanation i have)



      Disabling the lid in /proc/acpi/wakeup before it is emitted keeps the problem from occuring. This means that the system will not wakeup if the laptop lid is opened but pressing a button to wake it up is not really a trouble to me.



      In order to disable the lid permanently I created a small systemd service that makes the change



      Create a file /etc/systemd/system/lid-deactivate.service




      [Unit]
      Description=Deactivate LID

      [Service]
      ExecStart=/var/scripts/deactivate-lid.sh

      [Install]
      WantedBy=multi-user.target


      and a script /var/scripts/deactivate-lid.sh (or wherever you want to put it)




      #!/bin/bash

      #Disable the lid switch
      echo "LID" > /proc/acpi/wakeup


      and make it executable.



      Finally enable the service with




      systemctl enable lid-deactivate


      After that every time the system starts the lid gets deactivated (please note that writing to /proc/acpi/wakeup toggles the state of each acpi device, so if you call it more than once it will get reenabled)



      Conclusion



      This is only a temporary fix and I hope this helps someone with the same issue, while at the same time I also hope that someone can help find a permanent fix that does not require this workaround.







      suspend power-management lenovo acpi






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 28 at 8:55









      Michael Gschwandtner

      11




      11

























          active

          oldest

          votes











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "89"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1010566%2flenovo-thinkpad-a475-suspend-problem%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1010566%2flenovo-thinkpad-a475-suspend-problem%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          pylint3 and pip3 broken

          Missing snmpget and snmpwalk

          How to enroll fingerprints to Ubuntu 17.10 with VFS491