Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
please help me suspend my laptop
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
koshmar
n00b
n00b


Joined: 02 Nov 2016
Posts: 26

PostPosted: Fri Apr 21, 2017 4:25 pm    Post subject: please help me suspend my laptop Reply with quote

Hey all,

I am a gentoo novice and I am trying to teach my laptop suspend when I close the lid and then resume when I open. Unfortunatly, I cannot succeed, please help me identify if I am doing something wrong or missing something.

I have lenovo Thinkpad T440p if it matters with custom x64 gentoo install with more or less standard option and kernel generated with genkernel.
Code:
$ uname -a
Linux kosh-pc 4.9.16-gentoo #1 SMP Sun Mar 26 15:15:33 CST 2017 x86_64 Intel(R) Core(TM) i7-4600M CPU @ 2.90GHz GenuineIntel GNU/Linux


First I read Power management/Guide from the wiki and did the following:
Code:
#emerge --ask app-laptop/laptop-mode-tools

checking that I have global "acpi" USE flag.

I added the appropriate service to the boot
Code:
#rc-update add laptop_mode default

and checked if it is running - it is:
Code:
$ /etc/init.d/acpid status
 * status: started


It did not set anything automatically, so my laptop does not go to sleep when I close the lid

So I looked into "/etc/laptop-mode/laptop-mode.conf" and confirmed that following parameters are set:
Code:

ENABLE_LAPTOP_MODE_TOOLS=1
ENABLE_LAPTOP_MODE_ON_BATTERY=1
ENABLE_LAPTOP_MODE_ON_AC=0
ENABLE_LAPTOP_MODE_WHEN_LID_CLOSED=1


Still does not work, so I checked that acipid is installed and running
Code:

$ /etc/init.d/acpid status
 * status: started


then I went to Suspend and hibernate wiki page and installed
Code:
#emerge --ask sys-power/suspend

I use xmonad so I do not need any buttons for suspend/resume etc so I did not care about that

I checked
Code:
$ cat /sys/power/state
freeze mem disk


and it still does not work (nothing happens when I close/open lid)

Now i tried "s2ram" and "s2disk" command

1) s2ram half works -> it puts computer to sleep, but when I trying to wake it up, it is starting to wake up but does not show anything but black screen (screen without power) but it produces sounds as if it works. So I cannot wake it up.
I disabled the security chip in BIOS and it did not help.
When I run s2ram it outputs:
Code:
KMS graphics driver is in use, skipping quirks.


2) s2disk does not work ("s2both" is the same)
Code:
# s2disk
s2disk: Could not stat the resume device file. Reason: No such file or directory

I tried
Code:
#echo /dev/sda2 > /sys/power/resume

where /dev/sda2 is my working swap
Code:
# swapon -s
Filename            Type      Size   Used   Priority
/dev/sda2                                 partition   16776188   0   -1


I do not know how to trouble-shoot it anymore and make it work. I would write some script to make the lid trigger "s2ram" or "s2disk" but they do not work anyway...
Please help me :)
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Fri Apr 21, 2017 11:06 pm    Post subject: Reply with quote

http://wiki.gentoo.org/wiki/suspend_and_hibernate
Back to top
View user's profile Send private message
koshmar
n00b
n00b


Joined: 02 Nov 2016
Posts: 26

PostPosted: Fri Apr 21, 2017 11:33 pm    Post subject: Reply with quote

josephg wrote:
http://wiki.gentoo.org/wiki/suspend_and_hibernate

well, I read it before and still do not have a solution, you can notice that I tried some things from this article (like disabling the security chip in BIOS).
Back to top
View user's profile Send private message
sebB
l33t
l33t


Joined: 02 Mar 2011
Posts: 739
Location: S.O. France

PostPosted: Sat Apr 22, 2017 8:18 am    Post subject: Reply with quote

Can you you post /etc/default/grub and your fstab?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14050

PostPosted: Sat Apr 22, 2017 4:14 pm    Post subject: Reply with quote

If wake from suspend allows the system to make sound, that suggests that your video card was not reinitialized properly. This has historically been a common problem with S3.

For your s2disk problem, what resume device file did you set in its configuration?
Back to top
View user's profile Send private message
koshmar
n00b
n00b


Joined: 02 Nov 2016
Posts: 26

PostPosted: Sat Apr 22, 2017 10:50 pm    Post subject: Reply with quote

sebB wrote:
Can you you post /etc/default/grub and your fstab?

well, I do not use grab, I use gummiboot https://wiki.archlinux.org/index.php/Systemd-boot from my arch
(I have dual boot https://forums.gentoo.org/viewtopic-p-7988896.html?sid=2bdd4dd5827129d2654e6a14608fd30e). So probably relevant part is
Code:
$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  1024M  0 rom 
sda      8:0    0 465.8G  0 disk
├─sda4   8:4    0 193.8G  0 part /
├─sda2   8:2    0    16G  0 part [SWAP]
├─sda3   8:3    0 255.5G  0 part  (comment: here is my arch)
└─sda1   8:1    0   512M  0 part /boot

and my fstab
Code:
#/dev/sda1      /boot      vfat      noauto,noatime   0 2
/dev/sda4      /      ext4      noatime      0 1
/dev/sda2      none      swap      sw      0 0

I usually do not mount my boot. and this is how I boot gentoo
Code:
# cat /boot/loader/entries/gentoo.conf
title Gentoo
linux /kernel-genkernel-x86_64-4.9.16-gentoo
initrd /early_ucode_4.9.16.cpio
initrd /initramfs-genkernel-x86_64-4.9.16-gentoo
options root=/dev/sda4 rw rootfstype=ext4
Back to top
View user's profile Send private message
koshmar
n00b
n00b


Joined: 02 Nov 2016
Posts: 26

PostPosted: Sat Apr 22, 2017 11:02 pm    Post subject: Reply with quote

Hu wrote:
If wake from suspend allows the system to make sound, that suggests that your video card was not reinitialized properly. This has historically been a common problem with S3.

I just checked: Computer only produces sound as if it works - like HDD is rotating or something, processor working etc, but I cannot hear real sound - I left vlc working with video, then "s2ram" then "woke" it and no sound is present. Sorry but what is S3?
Quote:
For your s2disk problem, what resume device file did you set in its configuration?

Sorry for stupid question, but what configuration? all I did is
Code:
#echo /dev/sda2 > /sys/power/resume

where sda2 is my swap partition.


Last edited by koshmar on Sat Apr 22, 2017 11:04 pm; edited 1 time in total
Back to top
View user's profile Send private message
sebB
l33t
l33t


Joined: 02 Mar 2011
Posts: 739
Location: S.O. France

PostPosted: Sat Apr 22, 2017 11:03 pm    Post subject: Reply with quote

What appen if you modify
Code:
options root=/dev/sda4 rw rootfstype=ext4

by
Code:
options root=/dev/sda4 rw rootfstype=ext4 resume=/dev/sda2
Back to top
View user's profile Send private message
koshmar
n00b
n00b


Joined: 02 Nov 2016
Posts: 26

PostPosted: Sat Apr 22, 2017 11:12 pm    Post subject: Reply with quote

sebB wrote:
What appen if you modify
Code:
options root=/dev/sda4 rw rootfstype=ext4

by
Code:
options root=/dev/sda4 rw rootfstype=ext4 resume=/dev/sda2

well it boots, but there are a lot of errors, because my file system becomes read-only, and it still does not wake up from s2ram.
UPDATE if you think about it, s2ram should not depend on it =) but I guess if my fs is read-only, this option is out.
Back to top
View user's profile Send private message
koshmar
n00b
n00b


Joined: 02 Nov 2016
Posts: 26

PostPosted: Sun Apr 23, 2017 11:50 pm    Post subject: Reply with quote

just checked,
Code:
acpid_listen
catches the closing and opening of the lid. Moreover
Code:
echo mem > /sys/power/state
can put my computer into sleep but I again cannot resume. even if I set my swap partition like so
Code:
echo /dev/sda2 > /sys/power/resume
Probably I need to tell kernel about it... somehow and resume=/dev/sda2 did not work.
Back to top
View user's profile Send private message
koshmar
n00b
n00b


Joined: 02 Nov 2016
Posts: 26

PostPosted: Mon Apr 24, 2017 12:09 am    Post subject: Reply with quote

well I solved half the problem, for laptop to go to sleep I just needed to add
Code:
case "$action" in
....
                        lid)
                                case "$id" in
                                      close) s2ram;;
                                      open) :;;
                                      *)uhd $*;;
                                esac;;

into my /etc/acpi/default.sh :) that was easy.

Now I need to make my laptop wakeup
Back to top
View user's profile Send private message
koshmar
n00b
n00b


Joined: 02 Nov 2016
Posts: 26

PostPosted: Mon Apr 24, 2017 12:43 am    Post subject: Reply with quote

well, I modified /etc/suspend.conf so
Code:
snapshot device = /dev/snapshot
resume device = /dev/sda2

and I managed to make bootloader to pass the parameter to kernel "resume=/dev/sda2" (I just needed to write parameters in two lines)
so now s2disk runs, but it does not want to wake up.
If I make my laptop go to sleep manually with s2disk comand
it first prints
Code:
s2disk: Snapshotting system

then goes black screen then wakeups by itself and writes "Snapshotting system" again and hangs. if I use lid to trigger s2disk I only see the black screen
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum