Score:1

Bought a new Acer laptop, installed Ubuntu, and cannot get the laptop to hibernate when the lid is closed?

tr flag

I have recently just purchased a new Acer laptop.

I opened up Windows and opened up the partition manager on Windows, then I shrank my current partition that Windows is on to create an additional, unallocated partition to install Ubuntu 22.04 on.

I ran a live USB of Ubuntu 22.04 and installed Ubuntu automatically.

I did not manually create or mount any partitions like swap, etc... I just followed the automatic install prompt.

Ubuntu was installed correctly on that partition.

I restarted Ubuntu and it ran fine as expected.

However, I cannot get the laptop to go into hibernation when the lid is closed. I have tried various tutorials online, but none seem to work. I need hibernation to work correctly because when I close the lid now the battery drains and laptop dies!

I am not sure if it's not working because I didn't set a swap partition when initially installing, or what could be wrong!

Any help would be greatly appreciated! Please! Thank you!

Update:

My fstab file is displayed below.

# /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>
# / was on /dev/nvme0n1p5 during installation
UUID=bec289b6-5b1e-4e67-b733-01c9e37a8ccd /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=D083-8094  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0

I have removed the duplicate entry. So, it appears that I do have swap file.

Update:

I have figured out the problem! I followed the instructions here: https://ubuntuhandbook.org/index.php/2021/08/enable-hibernate-ubuntu-21-10/

and my laptop is now hibernating correctly! Thanks for the help ya'll!

Nuwan Thisara avatar
sa flag
did you try this https://askubuntu.com/questions/678019/hibernate-when-lid-is-closed-laptop-14-04?rq=1
Nuwan Thisara avatar
sa flag
and this https://itsfoss.com/ubuntu-close-lid-suspend/#:~:text=Go%20to%20System%20Settings%20and,Ubuntu%20by%20closing%20the%20lid.
watchy avatar
tr flag
The first link you mentioned returned the following: suspend Supported hibernate Supported suspend-hybrid Supported
watchy avatar
tr flag
and for the second link. i followed the instructions and restarted my laptop. i then closed the laptop's lid. i waited about 15 minutes -- the laptop was charged to a full %100 -- and then I opened the lid. I had been logged out and I logged back in. My battery was down to %98! I can't have this! Any more advice?
watchy avatar
tr flag
When I edit the /etc/systemd/logind.conf from "suspend" to "hibernate", and close the lid. I waited a few minutes and opened the lid and Ubuntu had been shutdown completely. However, I noticed in the boot screen that there was an error message. I think this may have something to do with why hibernate is not working! I'm not sure though. The error is "Failed to create unit file /run/systemd/generator/swapfile.swap, as it already exists. Duplicate entry in /etc/fstab? /usr/lib/systemd/system-generators/systemd-fstab-generator Filed with exit status 1"
watchy avatar
tr flag
The error message above may have my own fault for messing with the swap file. I am not sure. But, regardless, setting the logind.conf from suspend to hibernate shouldn't shutdown my system, should it? It should just go into hibernation... right?
in flag
Hibernation requires a swap *partition* to exist, which needs to be at least the same size as the amount of RAM you have installed on the machine. As you've done a bunch of work since posting your question, it may be worthwhile to [edit] the question to reflect the currents state of the notebook and the errors you are receiving
watchy avatar
tr flag
I removed the duplicate entry in the fstab file, so I no longer get the error messaged I included in the comment above.
us flag
Please write the answer in the answer field below instead of editing the question with your solution. Also, write down the steps you followed, instead of just posting the link. It would help other users in the future.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.