So I messed up and executed
echo disk > /sys/power/state instead of
echo mem > /sys/power/state accidentally. And then realized what I had just done.
Some details about the setup:
- It's using LUKS encryption on the root partition
- EFI stub boot loader (I can set kernel parameters with efibootmgr entries)
- Swapfile is located on the Btrfs file system on the LUKS partition
- Of which I don't have the swap file offset for... I hope I'm not screwed.
My custom initramfs init script doesn't have resume implemented yet. So I need to go into a bootable USB and somehow extract the kernel archive (initramfs is embedded in the kernel) and make changes to the init file, then compress it again. If that's even possible for the kernel executable. I probably can't recompile the kernel again unless I spend a lot of time getting kernel sources and recompiling it for my gentoo environment. But I might be able to as a last resort. So, 1. How could I edit vmlinuz (the kernel archive) with the updated init file?
After the LUKS partition is unlocked, how do I go about reaching this swap file? I don't have the offset for my swap file. I don't know now is Linus going to know where my swap file is. Is it as simple as "echo /dev/mapper/myrootfs > /sys/power/state"? It seemed to go fine doing the initial hibernation so Linux seemed to easily find out where my swap file was. Maybe it's the same for resuming? So, 2. How should I approach the swap file, I don't know it's offset. Will mounting as read only work then specify the swap file to /sys/power/state work or will that break my file system? (as the file system is technically "still mounted"). Maybe echo /dev/mapper/myrootfs to /sys/power/state like said earlier, but the point of specifying an offset is so that Linux knows where the swap file is. Which I don't have.
Edit: I didn't have any important stuff like documents unsaved or anything (all I had open was X, my WM and a terminal window). If I can boot normally (at that reverted state) and then discard that hibernation copy (like I said I didn't have unsaved documents or anything like that) that would be fine. Is that possible? Or is my file system in an unsafe state now and mounting it would only break it?