Re: how to make debian use my swapfile for hibernation
Your idea is pretty close to what really happens, but it's happening in another 'sphere'.
You probably mean the 'export' shell builtin command. It is used in the context of the shell (the login environment), for example when compiling code from sources.
A shelled login creates a conext environment, for example, parameters that define how this shell works for you. When you start a process from that shell (launching an application), it gets it's own processing environment, often with only rudimentary environment parameters.
Typical processes are launching the desktop, or stuff done via sudo, or compiling sourcecode.
With 'export', you can set variables in the 'outer' shell login context, which may be used by any process or sub-context. Imagine it as setting up satellites into the earth orbit so everybody can 'read' them :)
So far my understanding, which is not derived from the manuals but my best guess :)
Hibernation however belongs to the kernel space. That space is no more earth orbit, since it is created way before any login happens. The kernel deals with the hardware, with booting up the machine. It's rather like the sun, apparently a little different from any planets.
Although a user can tell some system software (like pm-utils) about the device, it's not going to happen via export. It's a real system configuration. Next thing is, that system software tells the kernel, and the kernel saves the snapshot image. So far, no problem. But what happens when the machine wakes up again ? Now, the operating system (GNU/Linux) is not even running, only the kernel starts to boot up and now have to find the piece of information where the snapshot image is.
If you were to 'export' this information for this time of wake-up, where to drop it so the kernel can read it ? One possibility is the so-called 'initrd', which really comes close to a satellite. Only that it's rather an asteroid, but packed with stuff that every userspace-ship needs to survive down here :)
Another method is to tell the bootloader (eg. grub) by inserting it into the boot commandline. The bootloader then tells the kernel.
Well, don't ask me what a bootloader would be, in our little planetary computer system. Maybe a kind of Stargate ...
Anyway. My question hits the difference between swap partition and swap file. It's a little tricky. Both kernel and bootloader have no problem to identify a partition, but normally they can not identify a single file. That would require the filesystem driver already being launched (which implies *a lot* of other stuff, and besides there are two dozen different file systems), which simply isn't happening.
BUT grub does have file system drivers, so why not using that ? Grub should be able to tell the offset to the kernel, no ? Requirement would be a unique name, like pagefile.linux :) Well, it may add another 1-2 seconds to the bootup time, though.
Meanwhile, i configured the swapfile 'physical offset' as per manual, and it works. But it's so inelegant.
> Hoping this at least maybe triggers another similar thought
Well, many Laptop brands ship their specific boot partition together with the OEM generic Windows, and they implement all the stuff that Windows would have difficulties with. I guess you can do this with Linux as well, only it requires a certain amount of work and time. It's rather a miracle that even a generic Linux *does* work on so many different machines... so, i do not want to complain for real.