Should we look to consider EnvyControl for Nvidia Optimus in the wiki?

Ok well first things first, here’s all that I did exactly, to post my process for this. After I post this I’ll do a reboot to hopefully (fingers crossed) confirm this method works!

*QUICK WARNING: please do not follow this until I have confirmed it is working *

I use Gnome, so with optimus-manager, I also have gdm-prime and libgdm-prime, so I have to uninstall these packages. I know I need to replace these with gdm and libgdm, so I can just install those first and let pacman uninstall the prime versions for me. Simple!

[scott@endeavourOS ~]$ sudo pacman -S gdm libgdm
[sudo] password for scott: 
resolving dependencies...
looking for conflicting packages...
:: gdm and gdm-prime are in conflict. Remove gdm-prime? [y/N] y
:: libgdm and libgdm-prime are in conflict. Remove libgdm-prime? [y/N] y

Package (4)   Old Version           New Version  Net Change  Download Size

gdm-prime     41.0+r15+g23ebe617-1                -4.40 MiB               
libgdm-prime  41.0+r15+g23ebe617-1                -0.63 MiB               
extra/gdm                           41.3-2         4.40 MiB       0.70 MiB
extra/libgdm                        41.3-2         0.63 MiB       0.07 MiB

Total Download Size:   0.77 MiB
Total Installed Size:  5.03 MiB
Net Upgrade Size:      0.00 MiB

:: Proceed with installation? [Y/n] 
:: Retrieving packages...
 libgdm-41.3-2-x86_64   76.7 KiB   258 KiB/s 00:00 [-----------------------] 100%
 gdm-41.3-2-x86_64     716.0 KiB  1102 KiB/s 00:01 [-----------------------] 100%
 Total (2/2)           792.7 KiB  1057 KiB/s 00:01 [-----------------------] 100%
(2/2) checking keys in keyring                     [-----------------------] 100%
(2/2) checking package integrity                   [-----------------------] 100%
(2/2) loading package files                        [-----------------------] 100%
(2/2) checking for file conflicts                  [-----------------------] 100%
(4/4) checking available disk space                [-----------------------] 100%
:: Processing package changes...
(1/2) removing gdm-prime                           [-----------------------] 100%
warning: /etc/gdm/custom.conf saved as /etc/gdm/custom.conf.pacsave
(2/2) removing libgdm-prime                        [-----------------------] 100%
(1/2) installing libgdm                            [-----------------------] 100%
(2/2) installing gdm                               [-----------------------] 100%
Optional dependencies for gdm
    fprintd: fingerprint authentication
:: Running post-transaction hooks...
(1/6) Creating system user accounts...
(2/6) Reloading system manager configuration...
(3/6) Reloading device manager configuration...
(4/6) Arming ConditionNeedsUpdate...
(5/6) Reloading system bus configuration...
(6/6) Compiling GSettings XML schema files...
[scott@endeavourOS ~]$ 

Now I noticed this transaction created a pacsave file (hopefully you already know how to deal with these), so I used the EndeavourOS welcome Pacdiff and Meld option, to view, edit, save, and remove the pacsave file, so that is now good to go.

Next I need to remove optimus-manager and it’s GUI Qt counter part optimus-manager-qt

Source: https://github.com/Askannz/optimus-manager

To uninstall the program, simply remove the optimus-manager package. The auto-generated Xorg config file will be automatically cleaned up.

You can also force cleanup by running optimus-manager --cleanup.

You can also disable optimus-manager by disabling the systemd service optimus-manager.service (needs a reboot to be applied).

FYI, if you want to run the --cleanup command, you need to do that before you uninstall optimus-manager. Also, it’ll require sudo fyi.

So as for the uninstall:

[scott@endeavourOS ~]$ sudo pacman -R optimus-manager optimus-manager-qt
checking dependencies...

Package (2)         Old Version  Net Change

optimus-manager     1.4-4         -0.27 MiB
optimus-manager-qt  1.6.4-1       -0.78 MiB

Total Removed Size:  1.05 MiB

:: Do you want to remove these packages? [Y/n] 
:: Processing package changes...
(1/2) removing optimus-manager-qt                  [-----------------------] 100%
(2/2) removing optimus-manager                     [-----------------------] 100%
optimus-manager : cleaning up auto-generated Xorg conf
optimus-manager : disabling optimus-manager.service
:: Running post-transaction hooks...
(1/4) Reloading system manager configuration...
(2/4) Arming ConditionNeedsUpdate...
(3/4) Updating icon theme caches...
(4/4) Updating the desktop file MIME type cache...
[scott@endeavourOS ~]$

Now my system technically doesn’t have anyway to switch between any GPU, hybrid, integrated, whichever. So now all that’s left is to install EnvyControl, set it to the desired mode, and give my system a reboot and hope upon hope that all goes well.

yay -S envycontrol

[scott@endeavourOS ~]$ yay -S envycontrol
:: Checking for conflicts...
:: Checking for inner conflicts...
[Aur:1]  envycontrol-1.3-1

:: (1/1) Downloaded PKGBUILD: envycontrol
  1 envycontrol                      (Build Files Exist)
==> Diffs to show?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> 
:: (1/1) Parsing SRCINFO: envycontrol
==> Making package: envycontrol 1.3-1 (Fri 25 Feb 2022 08:09:30 PM EST)
==> Retrieving sources...
  -> Cloning envycontrol git repo...
Cloning into bare repository '/home/scott/.cache/yay/envycontrol/envycontrol'...
remote: Enumerating objects: 206, done.
remote: Counting objects: 100% (206/206), done.
remote: Compressing objects: 100% (153/153), done.
remote: Total 206 (delta 112), reused 120 (delta 50), pack-reused 0
Receiving objects: 100% (206/206), 43.49 KiB | 1.67 MiB/s, done.
Resolving deltas: 100% (112/112), done.
==> Validating source files with sha256sums...
    envycontrol ... Skipped
==> Making package: envycontrol 1.3-1 (Fri 25 Feb 2022 08:09:31 PM EST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Updating envycontrol git repo...
Fetching origin
==> Validating source files with sha256sums...
    envycontrol ... Skipped
==> Removing existing $srcdir/ directory...
==> Extracting sources...
  -> Creating working copy of envycontrol git repo...
Cloning into 'envycontrol'...
done.
Switched to a new branch 'makepkg'
==> Sources are ready.
==> Making package: envycontrol 1.3-1 (Fri 25 Feb 2022 08:09:32 PM EST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Entering fakeroot environment...
==> Starting package()...
running install
/usr/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running build
running build_py
creating build
creating build/lib
copying envycontrol.py -> build/lib
running install_lib
creating /home/scott/.cache/yay/envycontrol/pkg/envycontrol/usr
creating /home/scott/.cache/yay/envycontrol/pkg/envycontrol/usr/lib
creating /home/scott/.cache/yay/envycontrol/pkg/envycontrol/usr/lib/python3.10
creating /home/scott/.cache/yay/envycontrol/pkg/envycontrol/usr/lib/python3.10/site-packages
copying build/lib/envycontrol.py -> /home/scott/.cache/yay/envycontrol/pkg/envycontrol/usr/lib/python3.10/site-packages
byte-compiling /home/scott/.cache/yay/envycontrol/pkg/envycontrol/usr/lib/python3.10/site-packages/envycontrol.py to envycontrol.cpython-310.pyc
writing byte-compilation script '/tmp/tmptrseb7u2.py'
/usr/bin/python -Wignore:The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives:DeprecationWarning /tmp/tmptrseb7u2.py
removing /tmp/tmptrseb7u2.py
running install_egg_info
running egg_info
creating envycontrol.egg-info
writing envycontrol.egg-info/PKG-INFO
writing dependency_links to envycontrol.egg-info/dependency_links.txt
writing entry points to envycontrol.egg-info/entry_points.txt
writing top-level names to envycontrol.egg-info/top_level.txt
writing manifest file 'envycontrol.egg-info/SOURCES.txt'
reading manifest file 'envycontrol.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'envycontrol.egg-info/SOURCES.txt'
Copying envycontrol.egg-info to /home/scott/.cache/yay/envycontrol/pkg/envycontrol/usr/lib/python3.10/site-packages/envycontrol-1.3-py3.10.egg-info
running install_scripts
Installing envycontrol script to /home/scott/.cache/yay/envycontrol/pkg/envycontrol/usr/bin
==> Tidying install...
  -> Removing libtool files...
  -> Purging unwanted files...
  -> Removing static library files...
  -> Stripping unneeded symbols from binaries and libraries...
  -> Compressing man and info pages...
==> Checking for packaging issues...
==> Creating package "envycontrol"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: envycontrol 1.3-1 (Fri 25 Feb 2022 08:09:34 PM EST)
==> Cleaning up...
loading packages...
resolving dependencies...
looking for conflicting packages...

Package (1)  New Version  Net Change

envycontrol  1.3-1          0.03 MiB

Total Installed Size:  0.03 MiB

:: Proceed with installation? [Y/n] 
(1/1) checking keys in keyring                     [-----------------------] 100%
(1/1) checking package integrity                   [-----------------------] 100%
(1/1) loading package files                        [-----------------------] 100%
(1/1) checking for file conflicts                  [-----------------------] 100%
(1/1) checking available disk space                [-----------------------] 100%
:: Processing package changes...
(1/1) installing envycontrol                       [-----------------------] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
[scott@endeavourOS ~]$ 

Okay, so thankfully it built from the AUR no issues! Great, now I can set the mode and reboot and see how things go.

EnvyControl has 3 supported modes: integrated, nvidia, hybrid. I want only the nvidia option. Once you run the command, you’ll have to reboot for changed to take effect. This is in contrast to optimus-manager which once the command is issued, your system is instantly rebooted, so any work you left unsaved would be lost. Personally, I like the approach of rebooting when I’m ready that envycontrol takes.

sudo envycontrol --switch nvidia ##this will switch the mode to nvidia gpu. now off to reboot.

envycontrol --status ##checks the status of the currently used mode

That should be the whole list of converting from optimus-manager to envycontrol. Now I just gotta reboot and report back, but if you don’t hear from me again in a minute, I’m probably staring at a black screen frantically trying to figure out what to do in a TTY :sweat_smile:

Edit: it did not go well and was not a success this time.