Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED]Issues with swap partition and hibernation. (Read 1008 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

[SOLVED]Issues with swap partition and hibernation.

After many years away from linux distros, I have artix suite 66 xfce  up and running on my old dell latitude E6410. I have solved most of my issues with artix and arch wiki/forums as well as internet searches. I am still having some issues getting my swap partition to stay active and in turn causing hibernation not to work. I followed the instructions on the arch wiki to activate the swap partition as the system did not do that automatically after installation. I modified the /etc/fstab as per those instructions to enable the swap partition at boot but it is not doing that.

I have attached the terminal outputs requested for help and the /etc/fstab file.

On a side note, I have not posted on a forum in years. Is there a wiki or instructions somewhere to make my post better with in-text terminal outputs and the like?

Thank you for the hard work you all put into making this distro. What you are doing is very important to the future of the linux environment.

Re: Issues with swap partition and hibernation.

Reply #1
If another Linux was installed after your /etc/fstab has been created (or modified last time), then chances are that swap partition UUID is changed.  Installers like to silently format swap partition without saying anything to the user, thus changing its UUID after formatting.

As a simple first check, I'd verify that /etc/fstab uses actual UUID for swap partition.  To list all partitions with their UUIDs:
Code: [Select]
lsblk --fs

Re: Issues with swap partition and hibernation.

Reply #2
To make hibernation work, you need 3 things:
1. An entry in /etc/fstab with the swap partition.
2. An entry in /boot/grub/grub.cfg (usually taken from /etc/default/grub, array GRUB_CMD_LINE_DEFAULT) which points to your swap partition.
3. The 'resume' hook in /etc/mkinitcpio.conf, run mkinicpio -P after modifying it.

Here are mine:
Code: [Select]
#/boot/grub/grub.cfg
GRUB_CMDLINE_LINUX_DEFAULT="root=/dev/disk/by-label/ROOT resume=/dev/disk/by-label/SWAP"
#/etc/fstab
/dev/disk/by-label/SWAP swap swap defaults 0 0
You can replace the 'disk/by-label/SWAP' part with e.g. sda3, whatever your swap partition is.

 

Re: Issues with swap partition and hibernation.

Reply #3
To make hibernation work, you need 3 things:
1. An entry in /etc/fstab with the swap partition.
2. An entry in /boot/grub/grub.cfg (usually taken from /etc/default/grub, array GRUB_CMD_LINE_DEFAULT) which points to your swap partition.
3. The 'resume' hook in /etc/mkinitcpio.conf, run mkinicpio -P after modifying it.

1. The UUID's match in /etc/fstab.
2. I modified /etc/default/grub and regenerated /boot/grub/grub.cfg
This is where it fails. If I reboot, the swap partition is not active, I can use swapon from a terminal, but it will not do it at boot.
Code: [Select]
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

set menu_color_normal=light-blue/black
set menu_color_highlight=light-cyan/blue

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod ext2
set root='hd0,gpt4'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4  5564aa47-fc7c-45ac-9080-af2241009d3d
else
  search --no-floppy --fs-uuid --set=root 5564aa47-fc7c-45ac-9080-af2241009d3d
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=1024x768,800x600
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
insmod part_gpt
insmod ext2
set root='hd0,gpt4'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4  5564aa47-fc7c-45ac-9080-af2241009d3d
else
  search --no-floppy --fs-uuid --set=root 5564aa47-fc7c-45ac-9080-af2241009d3d
fi
insmod gfxmenu
loadfont ($root)/usr/share/grub/themes/artix/u_vga16_16.pf2
insmod png
set theme=($root)/usr/share/grub/themes/artix/theme.txt
export theme
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=3
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=3
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Artix Linux' --class artix --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-5564aa47-fc7c-45ac-9080-af2241009d3d' {
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  DED4-3D6E
else
  search --no-floppy --fs-uuid --set=root DED4-3D6E
fi
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=5564aa47-fc7c-45ac-9080-af2241009d3d rw net.ifnames=0 root=/dev/sda4 resume=/dev/sda3
echo 'Loading initial ramdisk ...'
initrd /intel-ucode.img /amd-ucode.img /initramfs-linux.img
}
submenu 'Advanced options for Artix Linux' $menuentry_id_option 'gnulinux-advanced-5564aa47-fc7c-45ac-9080-af2241009d3d' {
menuentry 'Artix Linux, with Linux linux' --class artix --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-5564aa47-fc7c-45ac-9080-af2241009d3d' {
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  DED4-3D6E
else
  search --no-floppy --fs-uuid --set=root DED4-3D6E
fi
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=5564aa47-fc7c-45ac-9080-af2241009d3d rw net.ifnames=0 root=/dev/sda4 resume=/dev/sda3
echo 'Loading initial ramdisk ...'
initrd /intel-ucode.img /amd-ucode.img /initramfs-linux.img
}
menuentry 'Artix Linux, with Linux linux (fallback initramfs)' --class artix --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-5564aa47-fc7c-45ac-9080-af2241009d3d' {
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  DED4-3D6E
else
  search --no-floppy --fs-uuid --set=root DED4-3D6E
fi
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=5564aa47-fc7c-45ac-9080-af2241009d3d rw net.ifnames=0 root=/dev/sda4 resume=/dev/sda3
echo 'Loading initial ramdisk ...'
initrd /intel-ucode.img /amd-ucode.img /initramfs-linux-fallback.img
}
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg
fi
### END /etc/grub.d/41_custom ###

### BEGIN /etc/grub.d/60_memtest86+ ###
if [ "${grub_platform}" == "pc" ]; then
    menuentry "Memory Tester (memtest86+)" --class memtest86 --class gnu --class tool {
        search --fs-uuid --no-floppy --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  DED4-3D6E
        linux16 /memtest86+/memtest.bin
    }
fi
### END /etc/grub.d/60_memtest86+ ###


Re: Issues with swap partition and hibernation.

Reply #4
This is where it fails. If I reboot, the swap partition is not active, I can use swapon from a terminal, but it will not do it at boot.

Try this,

Code: [Select]
$sudo 66-env -t boot -e vi boot@system

change,

Code: [Select]
SWAP=!no

to

Code: [Select]
SWAP=!yes

Save the change and exit. Then do,

Code: [Select]
$sudo 66-enable -t boot -F boot@system

or reboot.

Re: Issues with swap partition and hibernation.

Reply #5
Many thanks for all your help. I think a combo of the grub fix and the suite-66 boot fix did the trick. I now have swap and hibernation working as intended.