My laptop stops working if I suspend it by closing the lid

It seems that if I close it for only a while and open it, it works fine. But if I have left it closed for a while when I open it I cannot log back in, I can click the cancel button so it hasn’t frozen it seems, but the text box to enter my password is greyed out.

When I installed I opted for a swap file, but I have not done anyhting with it, I’m not sure if that is important.

Thanks

can you show:

cat /etc/fstab
cat /etc/default/grub

may remove your uuids if you do not want to show them …
2021-03-11_21-11

1 Like

swapfile and resume (hibernate and suspend):

if you do not setup to have resume function enabled you will need to do so, it will only automatic setup on installs using swap-partition and choosen with hibernate, if you are using swapfile you need to setup by yourself:

get the uuid of your root device:
sudo findmnt -no UUID -T /swapfile

get the swap_file_offset (the point where it starts and ends)
sudo filefrag -v /swapfile | awk '{ if($1=="0:"){print substr($4, 1, length($4)-2)} }'

edit /etc/default/grub
and add needed dconfig to it:

GRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel=3 nowatchdog resume=UUID=0001 resume_offset=0002
where you need to replace 0001 with the UUID of your root device and 0002 with the swap_file_offset.

then enable the resume hook inside /etc/mkinitcpio.conf:

HOOKS="base systemd autodetect modconf block keyboard keymap filesystems fsck"
adding resume before fsck that this line looks similar to this:
HOOKS="base systemd autodetect modconf block keyboard keymap filesystems resume fsck"
(do not change anything else than adding resume!)
now rebuild kernel images and grub.cfg:

sudo mkinitcpio -P
sudo grub-mkconfig -o /boot/grub/grub.cfg

1 Like
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=52C4-2955                            /boot/efi      vfat    umask=0077 0 2
UUID=150bb5ff-71f0-43c5-9f57-12f1f5015e20 /              ext4    defaults,noatime 0 1
/swapfile                                 swap           swap    defaults,noatime 0 0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0

second command gives this output:

cat /etc/deafult/grub
cat: /etc/deafult/grub: No such file or directory

cat /etc/default/grub

Ah sorry:

# GRUB boot loader configuration

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="EndeavourOS"
GRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel=3 nowatchdog"
GRUB_CMDLINE_LINUX=""

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable booting from LUKS encrypted devices
#GRUB_ENABLE_CRYPTODISK=y

# Set to 'countdown' or 'hidden' to change timeout behavior,
# press ESC key to display menu.
GRUB_TIMEOUT_STYLE=menu

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
#GRUB_COLOR_NORMAL="light-blue/black"
#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/path/to/wallpaper"
GRUB_THEME=/boot/grub/themes/EndeavourOS/theme.txt

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

# Uncomment to make GRUB remember the last selection. This requires
# setting 'GRUB_DEFAULT=saved' above.
#GRUB_SAVEDEFAULT="true"
GRUB_DISABLE_SUBMENU=y
 neil@neil-hppavilionlap

sudo findmnt -no UUID -T /swapfile
[sudo] password for neil:
150bb5ff-71f0-43c5-9f57-12f1f5015e20

GRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel=3 nowatchdog resume=UUID=150bb5ff-71f0-43c5-9f57-12f1f5015e20 resume_offset=0002

0002 ===> sudo filefrag -v /swapfile | awk '{ if($1=="0:"){print substr($4, 1, length($4)-2)} }' :wink:

And I just copy this into a terminal?

Ok my grub file now has this instead.

# GRUB boot loader configuration

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="EndeavourOS"
GRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel=3 nowatchdog resume=UUID=150bb5ff-71f0-43c5-9f57-12f1f5015e20 resume_offset=591872"
GRUB_CMDLINE_LINUX=""

Sorry @joekamprad I somehow missed your second post!

I am running the command to rebuild the kernel image now and I got some warnings.

neil@neil-hppavilionlaptop15cw0xxx  ~  sudo mkinitcpio -P
==> Building image from preset: /etc/mkinitcpio.d/linux-lts.preset: ‘default’
→ -k /boot/vmlinuz-linux-lts -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-lts.img
==> Starting build: 5.10.22-2-lts
→ Running build hook: [base]
→ Running build hook: [udev]
→ Running build hook: [autodetect]
→ Running build hook: [modconf]
→ Running build hook: [block]
==> WARNING: Possibly missing firmware for module: xhci_pci
→ Running build hook: [keyboard]
→ Running build hook: [keymap]
→ Running build hook: [filesystems]
→ Running build hook: [resume]
→ Running build hook: [fsck]
==> Generating module dependencies
==> Creating xz-compressed initcpio image: /boot/initramfs-linux-lts.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux-lts.preset: ‘fallback’
→ -k /boot/vmlinuz-linux-lts -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-lts-fallback.img -S autodetect
==> Starting build: 5.10.22-2-lts
→ Running build hook: [base]
→ Running build hook: [udev]
→ Running build hook: [modconf]
→ Running build hook: [block]
==> WARNING: Possibly missing firmware for module: aic94xx
==> WARNING: Possibly missing firmware for module: wd719x
==> WARNING: Possibly missing firmware for module: xhci_pci
→ Running build hook: [keyboard]
→ Running build hook: [keymap]
→ Running build hook: [filesystems]
→ Running build hook: [resume]
→ Running build hook: [fsck]
==> Generating module dependencies
==> Creating xz-compressed initcpio image: /boot/initramfs-linux-lts-fallback.img

EDIT: After running

sudo mkinitcpio -P
sudo grub-mkconfig -o /boot/grub/grub.cfg

I am still unable to hibernate sorry

Power Manager:
GDBus.error:org.freedesktop.login1.SleepVerbNotSupported: Not enough swap space for hibernation

make it bigger:

sudo swapoff /swapfile
sudo rm -f /swapfile
sudo dd if=/dev/zero of=/swapfile bs=1M count=8000 status=progress
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

where count=8000 is the new size in MB

Ok @joekamprad the swap is now 8gb but I get the same error

Power Manager:
GDBus.error:org.freedesktop.login1.SleepVerbNotSupported: Not enough swap space for hibernation

I only have 4gb of ram.

sudo filefrag -v /swapfile | eos-sendlog

1 Like

offset could be set wrong or the service is not able to get the size for the swapfile, both solvable…
But it can be also settings inside Firmware (fka Bios)

http://ix.io/2SHY

Here you go @joekamprad

resume_offset=3796992

is your resume_offset then, seems we do take the wrong number before…

inside /etc/default/grub… needs regen grub.cfg again after changing it sudo grub-mkconfig -o /boot/grub/grub.cfg

Hmm very strange, same error message even now.

Archwiki say:

Note: Since version 244, systemd validates the exact specified swap has enough space. The swap offset detection on Btrfs is not currently supported and therefore systemd cannot recognize the swap file. Set the environment variable SYSTEMD_BYPASS_HIBERNATION_MEMORY_CHECK to 1 in both the systemd-logind and systemd-hibernate service to fallback to the old behavior. See systemd issue #14249 for details.