Laptop powers off when suspended and unplugged (F38 Silverblue)

Hi, not sure what information to include here, but I have F38 Silverblue running nearly perfectly on a Lenovo Legion laptop. Only issue I’m encountering currently is that if I close the lid on the laptop and it goes into suspend mode, then I unplug it, the laptop loses power completely and seems to not switch to battery backup mode properly. This doesn’t occur on Windows so I think it must be some sort of software issue in my Fedora config?

Any ideas what to do? Thanks for any assistance

I was able to fix this issue by using a tool called EnvyControl to switch the laptop to using integrated graphics only, and disable the discrete Nvidia GPU. This works for my purposes, because I do not have much use for the discrete GPU when running linux, but this solution may not be super feasible for others. Bonus is that my laptop is running much cooler, quieter and power consumption is reduced by more than half!

Unfortunately, EnvyControl does not work with Silverblue by default because of the way it implements udev rules in immutable parts of the filesystem. I was able to fork it and release a slightly modified version for immutable distros that seems to work as long as you clone the repo and run the python script from CLI. To resolve this feel free to use my fork, or clone the original and edit the script to change instances of /lib/udev/ to /etc/udev/. Hope that helps anyone else experiencing the same issue.

Hopefully a more permanent solution can be found long term. Would be amazing if gnome/fedora devs integrated a way to do graphics switching right into the OS for Nvidia Optimus laptop users.