bayasdev / envycontrol

Easy GPU switching for Nvidia Optimus laptops under Linux
https://bayas.dev/envycontrol
MIT License
1.18k stars 60 forks source link

[REQUEST] Add support for Immutable Operating systems (Like Kinoite, Silverblue...) #114

Closed FlaareZero closed 5 months ago

FlaareZero commented 1 year ago

Is your feature request related to a problem? Please describe. I've noticed that using Envycontrol on Kinoite just doesn't work OOTB. Since Kinoite, Silverblue and the likes all use immutable images to be as stable as possible, you can't write directly the changes on the system, so afaik Envycontrol can't operate properly.

Describe the solution you'd like The current envycontrol relies on the /lib folder to setup the various rules to switching, for example, to only use the Intel GPU when using the -s integrated command. Since most system folders are read-only, we could instead rely on /etc/lib that can be RW and apply the changes there.

Describe alternatives you've considered There's also rpm-ostree kargs "%command" that can be used to setup kernel arguments on Silverblue. Could be useful to add all the required custom commands there

kenos1 commented 1 year ago

See https://github.com/bayasdev/envycontrol/issues/49

alongwhile commented 9 months ago

I can confirm that simply cloning the repo and editing the python script to replace /lib/udev/ with /etc/udev/ in 2 places was enough to get this working for me running Fedora Silverblue 38 w/ Gnome Wayland

I forked it here if anyone wants to use it but you can easily edit the original script yourself as well.

I'll continue to add or update my version if people can commit some changes since I'm sure it can be improved for further compatibility. @bayasdev has indicated in the past that he has no plans to support immutable distros so hopefully this can help others somewhat.

klmcwhirter commented 5 months ago

See this comment https://github.com/bayasdev/envycontrol/issues/49#issuecomment-1992001554

@bayasdev - Thoughts?

bayasdev commented 5 months ago

See this comment #49 (comment)

@bayasdev - Thoughts?

IMO immutable distros are cool for container environments but not for desktop users, support is not planned at this moment

klmcwhirter commented 5 months ago

Have you ever had to manage machines in a classroom? That is just one use case where an immutable distro is a must for desktops. Besides that the approach of using /etc/udev looks to be the right thing to do from a design perspective. And if that just happens to solve their problem, why not? Is there a specific reason you use /lib/udev instead?

Thanks.

On Tue, Mar 12, 2024 at 9:15 AM, Victor @.***> wrote:

See this comment #49 (comment)

@bayasdev - Thoughts?

IMO immutable distros are cool for container environments but not for desktop users, support is not planned at this moment

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

bayasdev commented 5 months ago

Hi @klmcwhirter!

Have you ever had to manage machines in a classroom? That is just one use case where an immutable distro is a must for desktops

That sounds like a reasonable use-case for running an immutable distribution of Linux, of course if they don't teach programming courses to their students.

And how many classroom machines are laptops with Nvidia GPUs?

Is there a specific reason you use /lib/udev instead?

IIRC Ubuntu's nvidia-prime was using that path since I took inspiration from their integrated graphics mode that got removed in later versions of the distro. If you're sure we won't break things we can safely replace it and keep the old path as UDEV_INTEGRATED_PATH_OLD so cleanup procedure takes care of it.

TBH I've not had enough bandwidth to test your nvidia-more-battery POC as I no longer work from my Linux laptop.