Cannot hibernate Ubuntu Budgie 17.04
I tried to hibernate ubuntu-budgie from the top panel, but it doesn't hibernate, it only locks the computer.
Seeing that, I tried to hibernate from the terminal using sudo systemctl hibernate
, but I got the same result.
I used the command systemctl status hibernate.target
, and I saw theses errors :
systemd[1]: Dependency failed for Hibernate.
systemd[1]: hibernate.target: Job hibernate.target/start failed with result 'dependency'.
PS : This is a fresh installation of ubuntu budgie, and I have enough swap size (4Gb RAM and 4Gb swap).
PS2 : I am using a swap file and not a swap partition (That's how the new version of ubuntu creates by default)
Solution 1:
@fossfreedom gave me a link to an answer, the answer is great, but didn't completely solve my problem. So I will put what I did to make my computer hibernate under ubuntu-budgie 17.04
Create Swap File (go to the next step if you already have a swapfile)
These commands create a formatted 4GiB swap file, mounted and added to /etc/fstab:
sudo fallocate -l 4g /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile swap swap defaults 0 0' | sudo tee -a /etc/fstab
Install Userspace Software Suspend (uswsusp)
sudo apt install uswsusp
Verify Swap File Partition
sudo findmnt -no SOURCE,UUID -T /swapfile
> /dev/sda1 11cc33ee-1234-abcd-1234-ddeeff112233
Configure uswsusp
This will create /etc/uswsusp.conf and recreate initramfs using those details:
sudo dpkg-reconfigure -pmedium uswsusp
-
Yes
to 'Continue without a valid swap space?' (Wizard hasn't set swap file yet.) - Select the partition that the swap-file resides on, cross-reference with details from
findmnt
above. (Note: not the swap-file itself)
Create the file /etc/initramfs-tools/conf.d/resume
if it doesn't exist, and put your swap_id in it like this :
sudo -s
swaplabel /swapfile
> UUID: 81bb07cd-d495-4733-be81-3447f9161f33
echo "RESUME=UUID=81bb07cd-d495-4733-be81-3447f9161f33" > /etc/initramfs-tools/conf.d/resume
update-initramfs -u
Test Hibernate
sudo s2disk
Use s2disk with systemd Hibernate
sudo cp /lib/systemd/system/systemd-hibernate.service /etc/systemd/system/
Edit the new file:
sudo gedit /etc/systemd/system/systemd-hibernate.service
Replace the last line of the file (starts ExecStart=...) with the following:
ExecStart=/usr/sbin/s2disk
ExceStart=run-parts -a post /lib/systemd/system-sleep
Update the systemd daemon and test hibernate:
sudo systemctl daemon-reload
sudo systemctl hibernate
Allow hibernation from top panel buttons
Open the file :
sudo gedit /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla
and find both sections :
- [Disable hibernate by default in upower]
- [Disable hibernate by default in logind]
and change both values from no to yes :
Solution 2:
try:
swapoff /dev/drive/swap
swapon -f /dev/drive/swap