1

I am trying to add hibernation to ubuntu 18 on laptop. There are 3 disks, ssd m2, ssd and sd-card. Previously there were windows 10 on ssd m2 and ubuntu on ssd; now I have only one ubuntu on ssd m2. So I created 10gb swap file :

fjod@fjod-HP-Laptop-15-db1xxx:~$ swapon --show       
NAME      TYPE SIZE USED PRIO
/swapfile file 9,8G   0B   -2

fjod@fjod-HP-Laptop-15-db1xxx:~$ ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 15 фев  6 16:36 18f88db1-b367-45b1-9444-0f2ca150583b -> ../../nvme0n1p2
lrwxrwxrwx 1 root root 15 фев  6 16:36 513E-F188 -> ../../nvme0n1p1
lrwxrwxrwx 1 root root 10 фев  6 16:36 a1c2f79e-34ac-410e-b110-ba52f526face -> ../../sda1

fjod@fjod-HP-Laptop-15-db1xxx:~$ cat /proc/swaps
Filename                                Type            Size    Used    Priority
/swapfile                               file            10239996        0       -2
fjod@fjod-HP-Laptop-15-db1xxx:~$ grep swap /etc/fstab
/swapfile                                 none            swap    sw              0       0
/swapfile none swap sw 0 0
fjod@fjod-HP-Laptop-15-db1xxx:~$  cd / && ls -l swapfile
-rw------- 1 root root 10485760000 фев  6 16:33 swapfile
fjod@fjod-HP-Laptop-15-db1xxx:/$ cat /etc/fstab | grep -i swap
/swapfile                                 none            swap    sw              0       0
/swapfile none swap sw 0 0

Now I need to add it's UUID to make hibernation work, so:

fjod@fjod-HP-Laptop-15-db1xxx:/$ sudo blkid
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/loop4: TYPE="squashfs"
/dev/loop5: TYPE="squashfs"
/dev/loop6: TYPE="squashfs"
/dev/loop7: TYPE="squashfs"
/dev/nvme0n1: PTUUID="e5f2647b-98c1-45cd-93c1-4bdeb2bd11d1" PTTYPE="gpt"
/dev/nvme0n1p1: UUID="513E-F188" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="20210fff-3590-4c0f-826c-e64cb03894a8"
/dev/nvme0n1p2: UUID="18f88db1-b367-45b1-9444-0f2ca150583b" TYPE="ext4" PARTUUID="ce5ffbc2-5f80-4d12-9167-34d2b9676755"
/dev/sda1: UUID="a1c2f79e-34ac-410e-b110-ba52f526face" TYPE="ext4" PARTLABEL="kingston" PARTUUID="6e777b1f-a124-4821-8bae-c1b956e7e3fe"
/dev/loop8: TYPE="squashfs"
/dev/loop9: TYPE="squashfs"
/dev/loop10: TYPE="squashfs"
/dev/loop11: TYPE="squashfs"
/dev/loop12: TYPE="squashfs"
/dev/loop13: TYPE="squashfs"
/dev/loop14: TYPE="squashfs"
/dev/loop15: TYPE="squashfs"
/dev/loop16: TYPE="squashfs"
/dev/loop17: TYPE="squashfs"
/dev/loop18: TYPE="squashfs"
/dev/loop19: TYPE="squashfs"
/dev/loop20: TYPE="squashfs"
/dev/loop21: TYPE="squashfs"
/dev/loop22: TYPE="squashfs"
/dev/sdb1: TYPE="exfat"

fjod@fjod-HP-Laptop-15-db1xxx:/$ grep swap /etc/fstab
/swapfile                                 none            swap    sw              0       0
/swapfile none swap sw 0 0

But I don't see it's UUID anywhere. What should I do? Looks like I have swapfile somewhere on disk, but how to point hibernation to it?

------------edit1-------------------

using this tutorial

fjod@fjod-HP-Laptop-15-db1xxx:~$ mount | grep " / "
/dev/nvme0n1p2 on / type ext4 (rw,relatime,errors=remount-ro)
fjod@fjod-HP-Laptop-15-db1xxx:~$ sudo blkid -g
[sudo] password for fjod: 
fjod@fjod-HP-Laptop-15-db1xxx:~$ sudo blkid -g
fjod@fjod-HP-Laptop-15-db1xxx:~$ sudo blkid 
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/loop4: TYPE="squashfs"
/dev/loop5: TYPE="squashfs"
/dev/loop6: TYPE="squashfs"
/dev/loop7: TYPE="squashfs"
/dev/nvme0n1: PTUUID="e5f2647b-98c1-45cd-93c1-4bdeb2bd11d1" PTTYPE="gpt"
/dev/nvme0n1p1: UUID="513E-F188" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="20210fff-3590-4c0f-826c-e64cb03894a8"
/dev/nvme0n1p2: UUID="18f88db1-b367-45b1-9444-0f2ca150583b" TYPE="ext4" PARTUUID="ce5ffbc2-5f80-4d12-9167-34d2b9676755"
/dev/sda1: UUID="a1c2f79e-34ac-410e-b110-ba52f526face" TYPE="ext4" PARTLABEL="kingston" PARTUUID="6e777b1f-a124-4821-8bae-c1b956e7e3fe"

so the id = 18f88db1-b367-45b1-9444-0f2ca150583b offset:

od@fjod-HP-Laptop-15-db1xxx:~$ sudo filefrag -v /swapfile                                                                                                                             
Filesystem type is: ef53                                                                                                                                                                
File size of /swapfile is 10485760000 (2560000 blocks of 4096 bytes)                                                                                                                    
 ext:     logical_offset:        physical_offset: length:   expected: flags:                                                                                                            
   0:        0..    8191:   50290688..  50298879:   8192:                                                                                                                               
   1:     8192..   10239:   50302976..  50305023:   2048:   50298880:                                                                                                                   
   2:    10240..   14335:   50307072..  50311167:   4096:   50305024:                                                                                                                   
   3:    14336..   38911:   50472960..  50497535:  24576:   50311168:                                                                                                                   
   4:    38912..   45055:   50505728..  50511871:   6144:   50497536:  

in the end :

fjod@fjod-HP-Laptop-15-db1xxx:~$ cat /etc/initramfs-tools/conf.d/resume
resume=UUID=18f88db1-b367-45b1-9444-0f2ca150583b resume_offset=50290688

/etc/default/grub:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=18f88db1-b367-45b1-9444-0f2ca150583b resume_offset=50290688"

I try to hibernate, but computer fails to boot at all.

------------edit2--------------

I found another great tutorial here , now it hibernates fine, but after hibernation power is still on and I have to shutdown laptop using power button. After turning it on, I see my programs launched.

-------------edit3-----------------------

Resume from hibernate works 50/50 and is painfully slow. In the end, I wont use it (sigh).

2 Answers 2

0

Are you using this tutorial? It says there that you need the UUID of the root mounted partition.

mount | grep " / "

Note your /dev/... for "/" disk.

sudo blkid -g
sudo blkid
1
  • check my edit, I tried to follow the instruction Commented Feb 6, 2020 at 15:41
0

The UUID you should use is the one where your "/" is located, in your case, it appears to be /dev/sda1 with UUID a1c2f79e-34ac-410e-b110-ba52f526face".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .