User Space Software Suspend patch for post 3.7 Linux kernels (updated for 4.4 kernels)
The majority of people that run an open source operating system on their computers, will download a distribution and allow it to do most of the configuration of their machine automatically. At first it was not like this and an open source user was required to install everything manually, which did demand a certain amount of skill, so it was something that was done mostly by enthusiasts. As the quality of the software started to improve, this lead some commercial companies to try and make a profit out of the situation, but this would require them to make the process a lot easier for the end users, so a lot of functionality was introduced, that originated from Mac OS and Windows, where it was down to the company to determine how the end users desktop was configured. This then lead to open source operating systems becoming bloated like Windows and Mac OS, with lots of services running in the background and getting in the way of the user experience.
All of the above then also sometimes leads to a situation where a change is made in the kernel that breaks things for the enthusiasts, but doesn't have an affect on the majority of of end users, because they are just using their computers like how the big companies say they should, which then means that they will avoid the problem. The software that I am writing about in this article is called USWSUSP and it is the user space suspend utilities, which are used to suspend a PC or laptop, while saving the state to either the hard disk or memory, so that the computer can be resumed from where it left of, after having been shut down.
Up until kernel 3.4, the user space utilities were working fine and they had no problem with suspending the machine to disk or memory. It then looks as if a change was made in kernel 3.7 that then caused the resume utility to not be able to restore the suspended processes and this change did not seem to be a bug, because it was the same in any newer kernel that was tried. The newer kernels own suspend code could still restore the machine ok, but it lacks support for an encrypted suspend image, so the user space utilities still have some advantages. When I first came across this problem, it seemed to be hard to find a solution to it and I only recently found out what was going on, when I stumbled across a post from the Linux kernel mailing list. It turned out that the kernel developers had broken how applications are run from the initrd and one of them even helped someone to produce a patch that cured the problem. You might now wonder what the beginning of the article has to do with this problem, well it is what happened next that shows how even the Linux kernel developers are now more attached to their masters, than to the enthusiasts who helped them to start things of in the first place. I have tried the patch out and it works just fine in the kernels that I have tried it in, which are 3.16, 3.18 and 4.1, so you would think that the kernel developers would have merged it so that the few enthusiasts who need it could still use their user space suspend utilities, but it seems as if it has been forgotten, as you can see by looking at the last post to the thread that is in the link at the bottom of this article.
I have added the patch as a download on this article, for the odd person or two who might still prefer not to just accept things as a dumb end user, but would rather still have full control of the computers that they use.
I have now added another patch that was created for the 4.6 kernel, but I am running a 4.4 kernel on my laptop, so tried the patch out on it and it has been working just fine. The newer patch is also below, along with the older one.