# Enable Hibernate mode on Ubuntu 25.04 (Plucky Puffin): A Step-by-Step Guide

---

* Hibernation is not enabled by-default in Ubuntu.
    
* If you try to hibernate using “*sudo systemctl hibernate*”, you will run into the below error:
    

call to Hibernate failed: Not enough suitable swap space for hibernation available on compatible block devices and file systems

* Hibernation requires a swap space at least equal to your system’s RAM.
    
* If the swap size is less than your RAM, you’ll need to increase it.
    

### Check current swap usage:

```bash
swapon --show

free -h
```

Depending on your configuration, you either might see:

* A swap partition:
    
* OR a swap file:
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1748487090475/fe7590f1-7083-4128-baaf-d8e195bcf523.png align="left")

> If you don’t have a swap partition, Create a Dedicated Swap Partition.

### Creating a Dedicated Swap Partition

* Make sure the swap partition is equal or more then your RAM size.
    
* **Resize** an existing partition with GParted and create a Linux swap partition.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1748487091611/0bfd647a-0925-4b69-b490-52547d70dfd2.png align="left")

### Format and enable the swap:

* Identify the correct device name and use the below commands to enable the swap
    
* In my case the partition is /dev/nvme0n1p3
    

```bash
sudo mkswap /dev/nvme0n1p3
sudo swapon /dev/nvme0n1p3
```

### Find the UUID of the partition:

```bash
sudo blkid /dev/nvme0n1p3
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1748487092915/26c373ac-8b02-4f6f-9ad1-077193e2c2e8.png align="left")

### Add to `/etc/fstab`:

```bash
UUID="XXXXXX-XXXXX-XXX-XXX-XXXXXXXX" none swap sw 0 0
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1748487094337/a84583ab-2293-4401-8a64-4e474734f713.png align="left")

* Reboot and verify the new swap is active
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1748487095673/6c5fa088-9242-4663-b7b0-85a6d25c72ff.png align="left")

### Edit GRUB configuration:

```bash
sudo nano /etc/default/grub
```

* Find the line starting with `GRUB_CMDLINE_LINUX_DEFAULT` and add the resume parameter:
    

```bash
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=your-swap-uuid"
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1748487097549/bd88740e-3436-49eb-a495-301b5f3a13ce.png align="left")

Replace `your-swap-uuid` with the UUID you noted earlier

* Update GRUB:
    

```bash
sudo update-grub
```

* Rebuild initramfs to include resume info & reboot
    

```bash
sudo update-initramfs -u

sudo reboot
```

### Enable Hibernate in PolicyKit:

```bash
sudo nano /etc/polkit-1/rules.d/10-enable-hibernate.rules
```

* Add the following content to the config:
    

```bash
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.login1.hibernate" ||
action.id == "org.freedesktop.login1.hibernate-multiple-sessions" ||
action.id == "org.freedesktop.upower.hibernate" ||
action.id == "org.freedesktop.login1.handle-hibernate-key" ||
action.id == "org.freedesktop.login1.hibernate-ignore-inhibit")
{
return polkit.Result.YES;
}
});
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1748487099102/e70d37a3-7aa9-46e2-a4d7-21247a6b404f.png align="left")

### Test Hibernation:

sudo systemctl hibernate

### GUI Hibernate button:

You can also add a Hibernate button in Status menu using this gnome extension

[https://extensions.gnome.org/extension/755/hibernate-status-button/](https://extensions.gnome.org/extension/755/hibernate-status-button/)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1748487100241/80bc5e8a-6122-4f10-8986-9cb69e4c54c2.png align="left")
