Trevor Broaddus

December 22, 2021

Debian Bullseye - Hibernation and Swap Space

TLDR;

  • If you have an issue during boot where your screen gets frozen,
  • OR during the boot into recovery mode your presented with a weird power-management error where it says something to the effect PM Loading image - 10%...20%....etc 
you can do the following:
  1. Create a bootable USB with your *nix flavor of choice
  2. Boot from that USB
  3. Enter into the "Graphical Restore" mode via the "Advanced Options"
  4. Load a shell on your host OS drive (mine was /dev/sda3 for example)
  5. Execute swapoff -a
  6. Execute swapon -a
  7. Reboot and load your OS
  8. Learn more about why that worked :)

Full story below

So, there I am at a hotel trying to do some network mapping at Opryland Hotel in Nashville, TN. Things are going well, we have a beautiful view of the atrium and can hear the after hours "behind-the-scenes" action that goes into maintaining such a beautiful indoor garden, canal system, and tourist attraction. I stop nmap -ing and realize that my coffee had gotten cold. With no microwave in the room I had to venture out into the after hour hotel ambience to track down micro-waves to heat my coffee. Found it :check:

Upon returning to my room, I open up my laptop (Macbook 2015 dual booted with Debian Bullseye) and am unable to awaken the FOSS. This had happened before, one of the cracks in trying to be "free" on an inherently "jailed" system was that hibernation was, well, not working right. Standard procedure dictated that I restart and rebuild my context from where I left off. Unfortunately, I was greeted with a blinking cursor that eventually froze...that is ok, I can boot into recovery mode to recover from this. Yikes...greeted with a power-management module message listing that it cannot continue due to a suspended console. Well fudge.

Upon massive amounts of duck-duck-going around on my cell phone (since the laptop was stuck being test dummy-ed around) I figured out that during a hibernation attempt, the image stored into swap space was corrupt, and upon reboot my kernel was trying to read from the last stored image in swap space and BOOM it failed. That is definitely the "I still don't quite understand the kernel boot process and how that even mattered" version of the root cause. So, after finding the wonderful swapoff -a and swapon -a commands, followed by a reboot, I am now publishing this how-to on getting out of an awkward jam due to hibernation mishaps.