I am planing to have hibernation with a swap file in root (/). But somehow I still unable to resume my session.
Here is my fstab (/etc/fstab)(I just show my system drive in here)
# /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).
#
#
UUID=9BAC-2533 /boot/efi vfat fmask=0137,dmask=0027 0 2
UUID=c0f5f7b1-0bbc-4558-80e4-0ec8811b8904 / ext4 noatime 0 1
/swapfile none swap defaults 0 0
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
My grub (/etc/default/grub)
# GRUB boot loader configuration
GRUB_DEFAULT=saved
GRUB_TIMEOUT=‘3’
GRUB_DISTRIBUTOR=‘EndeavourOS’
GRUB_CMDLINE_LINUX_DEFAULT=‘nvme_load=YES loglevel=3 resume=UUID=c0f5f7b1-0bbc-4558-80e4-0ec8811b8904 resume_offset=387072’
# GRUB_CMDLINE_LINUX_DEFAULT=‘nowatchdog nvme_load=YES loglevel=3 resume=UUID=c0f5f7b1-0bbc-4558-80e4-0ec8811b8904 resume_offset=387072’
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 `videoinfo’
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=‘/usr/share/endeavouros/splash.png’
#GRUB_THEME=“/path/to/gfxtheme”
# 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
# Uncomment to disable submenus in boot menu
GRUB_DISABLE_SUBMENU=‘false’
# Probing for other operating systems is disabled for security reasons. Read
# documentation on GRUB_DISABLE_OS_PROBER, if still want to enable this
# functionality install os-prober and uncomment to detect and include other
# operating systems.
#GRUB_DISABLE_OS_PROBER=false
GRUB_EARLY_INITRD_LINUX_STOCK=‘’
this is my system drive, and the swapfile is located in /, and it is loaded
nvme1n1
├─nvme1n1p1 vfat FAT32 9BAC-2533 2G 0% /boot/efi
└─nvme1n1p2 ext4 1.0 endeavouros c0f5f7b1-0bbc-4558-80e4-0ec8811b8904 1.6T 10% /
total 83886148
lrwxrwxrwx 1 root root 7 5月 4 04:26 bin → usr/bin
drwxr-xr-x 4 root root 4096 9月 13 23:49 boot
drwxr-xr-x 20 root root 4760 9月 16 01:22 dev
drwxr-xr-x 93 root root 12288 9月 16 01:22 etc
drwxr-xr-x 3 root root 4096 9月 13 17:26 home
lrwxrwxrwx 1 root root 7 5月 4 04:26 lib → usr/lib
lrwxrwxrwx 1 root root 7 5月 4 04:26 lib64 → usr/lib
drwx------ 2 root root 16384 9月 13 17:22 lost+found
drwxr-xr-x 10 root root 4096 9月 13 23:25 mnt
drwxr-xr-x 4 root root 4096 9月 13 19:17 opt
dr-xr-xr-x 421 root root 0 9月 16 01:21 proc
drwxr-x— 5 root root 4096 9月 13 17:55 root
drwxr-xr-x 34 root root 760 9月 16 01:22 run
lrwxrwxrwx 1 root root 7 5月 4 04:26 sbin → usr/bin
drwxr-xr-x 4 root root 4096 3月 19 20:30 srv
-rw------- 1 root root 85899345920 9月 13 23:44 swapfile
dr-xr-xr-x 13 root root 0 9月 16 01:21 sys
drwxrwxrwt 13 root root 340 9月 16 01:23 tmp
drwxr-xr-x 9 root root 4096 9月 16 00:21 usr
drwxr-xr-x 13 root root 4096 9月 16 00:26 var
NAME TYPE SIZE USED PRIO
/swapfile file 80G 0B -2
My swapfile offset is 387072, which I get with this command(with privilege), and it is a ext4 file system, so I directly use this offset should be ok
filefrag -v /swapfile
Filesystem type is: ef53
File size of /swapfile is 85899345920 (20971520 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 6143: 387072.. 393215: 6144:
1: 6144.. 38911: 327680.. 360447: 32768: 393216:
2: 38912.. 69631: 296960.. 327679: 30720: 360448:
3: 69632.. 102399: 262144.. 294911: 32768: 327680:
After update the grub config with below command and restart, I tried to hibernate the system
sudo grub-mkconfig -o /boot/grub/grub.cfg
But my session did not return, I tested with a private browsing window Firefox. After resume, every window position is reset and the private browsing window disappeared, so the resume failed.
Can anyone help to point out what I am missing? thanks.