Linux sleep modes and issues

Hello everyone, I haven’t blogged for a long time. Whether it was a job change or the problems I had, I could not spare time and prepare content.

I want to start by writing how I solved a problem I had on my own computer. First, let’s go back to the beginning of the story. Those who have read my previous articles know that the first thing I did after coming back from the military was to format my computer. I started everything from scratch. There is no problem so far, but when I want to put my computer to sleep, it goes into sleep mode, when I want to wake it up again, it does not respond. It stayed on the black screen. I had this problem before and I fixed it. Since I don’t remember how I solved it, I had to solve it by doing research again. I wanted to share an article about this condition for those who suffer from it. Let’s start.

Sleep Modes

There are three types of sleep states. Let’s look at these in order. Each mode has its own advantages and disadvantages.

1- Suspend To Ram

When you put your computer to sleep in this mode, the information of the applications and files that are currently open on your computer are transferred to RAM and the rest of the hardware is turned off. In this way, you can keep your computer in this mode for a long time with lower energy.

Advantage; Since ram is a fast hardware, you can resume your computer from sleep mode in a short time and continue from where you left off, this time may vary according to your computer’s hardware. It is between 5–15 seconds on average.

Disadvantage; ram is a permanent solution, so if your computer goes out of power, all the information on the ram will be deleted, it is impossible to continue from where you left off when you turn your computer back on when the power comes on.

2- Suspend To Disk

With this mode, when your computer goes into sleep mode, all processes and the hardware to be recorded on the disk are turned off. It is the sleep mode that saves the most electricity. With this mode, the computer can stay in sleep state for long periods of time with much lower electricity consumption.

Advantage; Since the information is recorded on the disc, you can continue from where you left off when you turn on your computer even when the power is cut off.

Disadvantage; Your computer will boot a little slower than sleeping on ram. You can shorten this situation a little more by using SSD. Today, with the widespread use of SSDs, these times have become even shorter.

3- Sleep on both ram and disk (Suspend Hybrid)

In this mode, both ram and disk sleep are performed, in fact, you can think of it as a combination of the two modes I wrote above. All information is recorded on ram and disk. In case of power failure, the process continues on the disk, when the power is not cut off, the process continues on the ram.

Sleep state on linux

Since we are familiar with computer sleep modes, let’s take a closer look at them on linux.

When you put your computer to sleep mode, your computer hardware (CPU, GPU etc.) and kernel must be in harmony. In addition, the hardware drivers must be suitable for the operating system to have full control over these hardware.

The basis of sleep mode problems on Linux is due to the inconsistency or misconfiguration of what I wrote above.

Solution ?

In the linux mint distribution I use, I saw that the problem was with the video card driver. To elaborate a little more on the subject; I saw that the video card driver in use on my computer is the driver provided by the video card manufacturer, and I noticed that this driver causes problems with the kernel or other hardware in the sleep state.

I solved the video card driver by using another open source driver instead of the one provided by the manufacturer. After making this change, when I put my computer to sleep and want to wake it up again, I saw that it opened without any problems.

You can try this way and check if the problem is solved. If your problem persists, you can search the internet with your motherboard or video card -suspend to ram intel, suspend to disk nvidia- and use the solution found by other users who have experienced this problem before.

Hope to see you in the next article

This article was first published on the website on 14 jun 2021.