So recently I installed Linux or more specifically Pop!_OS on my Razer Blade 17 Pro laptop from mid 2021 and had an annoying issue with the laptop going back to sleep after waking it up. I was being so fed up with the recent Windows 11 shenanigans and Adobe bs I decided to permenantly go to Linux even if it makes it harder to me to edit photos that I usually had done via Lightroom and videos via Adobe Premier Pro.
It worked like a charm pretty much out of the box which is usually the experience you have with Linux these days except for one thing and that was when the computer would wake up from sleep, it went back to sleep after about 10-20 seconds. Very annoying so I went searching for the answer and while I didn't really figure out exactly why it does that I at least found the solution for it.
The solution is very simple, you just have to run two commands in a terminal window.
If you are inexperienced with the terminal or with Linux, the terminal is simply a program in which you can run text based commands in order to manage your computer. Think of it like your text based interface to control your computer. It is very powerful.
However, find your terminal app installed and it's as easy as clicking on "Applications" in and then clicking on terminal. Here you can paste the following commands with ctrl + shift + v:
sudo kernelstub -a button.lid_init_state=open
When that is done, run the following in order to reboot your computer:
sudo reboot
Congrats, now you probably have a working sleep/hibernation/suspend if you had the same issue as me. If not, you probably have another issue.