3

I am facing this rather bizarre situation. After shutting down my laptop by pushing the power button for a few seconds and powering it on again the "suspend when lid is closed" option isn't working.

So when I close the lid, the laptop powers off. The strange thing is that when I open the lid the laptop powers on! This is strange because I don't push any power button whatsoever!

I checked my /etc/systemd/logind.conf file, but the following lines are uncommented

HandleLidSwitch=suspend
HandleLidSwitchDocked=suspend

Any idea on what might be the issue?

I am pasting the entire logind.conf file, because it might be useful to locate the problem.

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See logind.conf(5) for details.

[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
HandleLidSwitch=suspend
HandleLidSwitchDocked=suspend
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#UserTasksMax=12288

UPDATE-1

I upgraded my system to Fedora 27, but still the problem remains. Any idea on how to solve it?

UPDATE-2

I tried @isapir answer, but it didn't work... More specifically

  1. $ swapon -s which gave

    Filename Type Size Used Priority /dev/dm-2 partition 7864316 0 -2

  2. Then I edited the /etc/default/grub file. On the entry about GRUB_CMDLINE_LINUX= there was "rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet" which I changed to resume=/dev/dm-2

  3. To identify whether my system is UEFI or legacy I did $ sudo efibootmgr. The output was EFI variables are not supported on this system. which I guess means that I own a legacy system. So finally I did grub2-mkconfig -o /etc/grub2.cfg

Any idea on how to proceed?

UPDATE-3

I also checked the journal typing

sudo journalctl -b | grep "Feb 13" > journal.dat

but I am not sure what am I looking for. You can find the output here

Any idea on what's wrong?

  • 1
    IME, suspend is always fragile. What does the journal say about what's happening? Also F25 is no longer supported (or if it is, it's close to EOL). Have you tried upgrading to F27? Problems like this tend to be resolved with time, so older laptops tend to get "fixed", with newer models exhibiting problems. – NickD Jan 2 '18 at 13:57
  • Fedora 25 end-of-life December 12, 2017. I second the recommendation of doing an upgrade as the first step. – mattdm Jan 2 '18 at 22:05
  • @Nick : Thanks a lot for your comment! Although F25 is no longer supported, I don't think an upgrade solves the problem, but I will try it! Thanks! – Thanos Jan 5 '18 at 10:33
  • Do you see anything relevant in the journal? – mattdm Jan 8 '18 at 20:55
  • @mattdm : What do you mean? Which journal? *I am new to Fedora - I used to be an ubuntu user for many years. – Thanos Jan 9 '18 at 6:08
2

The problem is that your laptop is trying to resume from the wrong partition. That can be fixed in the grub by following the steps below:

As a superuser, run:

# swapon -s

That should show you which partition is used for Swap. On my machine, for example, it shows /dev/dm-1:

Filename        Type        Size     Used   Priority
/dev/dm-1       partition   8388604  0      -2

Next edit /etc/default/grub and find the line that starts with GRUB_CMDLINE_LINUX=. It needs to have a value of resume=<your-swap-device>. In my example that is resume=/dev/dm-1. If the resume entry is there, update it. If not, add it.

Next you have to regenerate the grub. On UEFI systems that would be:

# grub2-mkconfig -o /etc/grub2-efi.cfg

On legacy systems that would be

# grub2-mkconfig -o /etc/grub2.cfg

The next time that you open the lid your laptop should find the resume information and recover from suspend correctly.

Reference

EDIT (from the OP)

An additional step is required :

Rebooting the laptop prior to closing the lid for the first time.

  • Thank you very much for your answer! There was indeed an entry GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet" I will change it according to your answer! About the last step, how can I see whether I have UEFI or legacy system? – Thanos Jan 29 '18 at 11:39
  • I did [$ sudo efibootmgr and the output was EFI variables are not supported on this system. so I guess I will have to run # grub2-mkconfig -o /etc/grub2.cfg. – Thanos Jan 29 '18 at 11:43
  • This didn't work. Laptop is still not suspending. – Thanos Jan 31 '18 at 6:14
  • @Thanos did you figure this out? I had a similar issue, and after adding the resume= bit to my grub config, I had to run dracut --regerate-all --force to make it work /shrug – Andbdrew May 1 '18 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.