optimus-manager: Failing on version 1.3

First and foremost, thank you for an awesome tool 🙏

Describe the bug

optimus-manager is failing to start / execute after updating to version 1.3. The logs are, sadly, not giving much to go on. The previous versions have worked fine.

System info

os     Arch Linux
host   XPS 15 7590
wm     i3wm
kernel 5.6.11-arch1-1

I’m using regular login with xinitrc and startx. Running version 1.3-1 from the AUR.

etc/optimus-manager/optimus-manager.conf:

[optimus]

# This parameter defines the method used to power switch the Nvidia card. See the documentation
# for a complete description of what each value does. Possible values :
#
# - nouveau : load the nouveau module on the Nvidia card.
# - bbswitch : power off the card using the bbswitch module (requires the bbswitch dependency).
# - acpi_call : try various ACPI method calls to power the card on and off (requires the acpi_call dependency)
# - none : do not use an external module for power management. For some laptop models it's preferable to
#           use this option in combination with pci_power_control (see below).
#           With that option set, you can also use the scripts nvidia-enable.sh and nvidia-disable.sh to
#           execute custom commands for power management.
switching=none

# Enable PCI power management in Intel mode.
# This option is incompatible with acpi_call and bbswitch, so it will be ignored in those cases.
pci_power_control=yes

# Remove the Nvidia card from the PCI bus.
# May prevent crashes caused by power switching.
# Ignored if switching=nouveau or switching=bbswitch.
pci_remove=yes

# Reset the Nvidia card at the PCI level before reloading the nvidia module.
# Ensures the card is in a fresh state before reloading the nvidia module.
# May fix some switching issues. Possible values :
#
# - no : does not perform any reset
# - function_level : perform a light "function-level" reset
# - hot_reset : perform a "hot reset" of the PCI bridge. ATTENTION : this method messes with the hardware
#         directly, please read the online documentation of optimus-manager before using it.
#         Also, it will perform a PCI remove even if pci_remove=no.
#
pci_reset=no

# Automatically log out the current desktop session when switching GPUs.
# This feature is currently supported for the following DE/WM :
# KDE Plasma, GNOME, XFCE, Deepin, i3, Openbox, AwesomeWM, bspwm
# If this option is disabled or you use a different desktop environment,
# GPU switching only becomes effective at the next graphical session login.
auto_logout=yes


[intel]

# Driver to use for the Intel GPU. Possible values : modesetting, intel
# To use the intel driver, you need to install the package "xf86-video-intel".
driver=modesetting

# Acceleration method (corresponds to AccelMethod in the Xorg configuration).
# Only applies to the intel driver.
# Possible values : sna, xna
# Leave blank for the default (no option specified)
accel=

# Enable TearFree option in the Xorg configuration.
# Only applies to the intel driver.
# Possible values : yes, no
# Leave blank for the default (no option specified)
tearfree=

# DRI version. Possible values : 2, 3
DRI=3

# Whether or not to enable modesetting for the nouveau driver.
# Does not affect modesetting for the Intel GPU driver !
# This option only matters if you use nouveau as the switching backend.
modeset=yes

[nvidia]

# Whether or not to enable modesetting. Required for PRIME Synchronization (which prevents tearing).
modeset=yes

# Whether or not to enable the NVreg_UsePageAttributeTable option in the Nvidia driver.
# Recommended, can cause poor CPU performance otherwise.
PAT=yes

# DPI value. This will be set using the Xsetup script passed to your login manager.
# It will run the command
# xrandr --dpi <DPI>
# Leave blank for the default (the above command will not be run).
DPI=96

# If you're running an updated version of xorg-server (let's say to get PRIME Render offload enabled),
# the nvidia driver may not load because of an ABI version mismatch. Setting this flag to "yes"
# will allow the loading of the nvidia driver.
ignore_abi=no

# Comma-separated list of Nvidia-specific options to apply.
# Available options :
# - overclocking : enable CoolBits in the Xorg configuration, which unlocks clocking options
#   in the Nvidia control panel.
# - triple_buffer : enable triple buffering.
options=overclocking

Logs

% optimus-manager --status
ERROR: a GPU setup was initiated but Xorg post-start hook did not run.
Log at /var/log/optimus-manager/switch/switch-20200511T163522.log
If your login manager is GDM, make sure to follow those instructions:
https://github.com/Askannz/optimus-manager#important--gnome-and-gdm-users
If your display manager is neither GDM, SDDM nor LightDM, or if you don't use one, read the wiki:
https://github.com/Askannz/optimus-manager/wiki/FAQ,-common-issues,-troubleshooting

Cannot execute command because of previous errors.

/var/log/optimus-manager/switch/switch-20200511T163522.log:

[15] INFO: # Xorg pre-start hook
[16] INFO: Requested mode is: intel
[16] INFO: Checking for GDM display servers
[761] INFO: Available modules: ['nouveau', 'nvidia', 'nvidia_drm', 'nvidia_modeset', 'nvidia_uvm']
[761] INFO: Unloading modules ['nvidia_drm', 'nvidia_modeset', 'nvidia_uvm', 'nvidia'] (if loaded)
[763] INFO: Removing Nvidia from PCI bus
[782] WARNING: pci_remove is enabled, pci_power_control option ignored.
[798] INFO: Loaded extra Intel Xorg options (0 lines)
[798] INFO: Loaded extra Intel Xorg options (0 lines)
[798] INFO: Writing to /etc/X11/xorg.conf.d/10-optimus-manager.conf
[798] INFO: Writing state {'type': 'pending_post_xorg_start', 'switch_id': '20200511T163522', 'requested_mode': 'intel'}
[799] INFO: Xorg pre-start hook completed successfully.

/var/log/optimus-manager/daemon/daemon-20200511T163521.log:

% cat                                                                                             ~
[34] INFO: # Daemon pre-start hook
[34] INFO: Removing /etc/X11/xorg.conf.d/10-optimus-manager.conf (if present)
[36] INFO: Copying /etc/optimus-manager/optimus-manager.conf to /var/lib/optimus-manager/tmp/config_copy.conf
[38] INFO: Startup mode is: intel
[38] INFO: Writing state {'type': 'pending_pre_xorg_start', 'requested_mode': 'intel', 'current_mode': None}
[38] INFO: Daemon pre-start hook completed successfully.
[38] INFO: Calling Xorg pre-start hook.
[1] INFO: # Commands daemon
[1] INFO: Opening UNIX socket
[1] INFO: Awaiting commands

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 23 (4 by maintainers)

Commits related to this issue

Most upvoted comments

@2mc I just had this issue and fixed it like this; After closing the X server, your machine needs to run sudo prime-switch.

I did this by adding it at the end of the .xinit file (note: do not use exec, so the execution is halted)

...

prime-offload &
openbox
sudo prime-switch

Doing this approach you’d have to add the following line to your sudo-config;

%wheel ALL=(ALL) NOPASSWD: /usr/bin/prime-switch

This way you can run sudo commands without the password prompt for this specific command

Still in progress of smoothing it out (sometimes I need to reboot), but it works for me now.

Optimus Manager 1.3 is essentially broken. Cannot use it for anything and there’s no solution to fix the issue.

Solution is to downgrade to Optimus Manager 1.2

So, I managed to get everything working perfectly 👍

First we need to enable running prime-switch as sudo without the password prompt by adding via visudo:

sqve ALL=(ALL) NOPASSWD: /usr/bin/prime-switch

The following commits adds the rest:

@mechaprabal Looks like a typical case of the Nvidia GPU not coming back online. To confirm it, try disabling all power management options. Are you sure switching from intel to nvidia was working with version 1.2.2, with the same power management options enabled ? In any case, it’s a different problem, so please open a new issue.

@2mc how do you run prime-offload ?

@qumaciel what is your display manager ? if you don’t use one, make sure prime-offload and prime-switch and run as explained by @sQVe and @larsveelaert.

@soumendu041 I can’t reproduce the issue, lightdm works fine with optimus-manager here. Do you have custom configuration in /etc/lightdm/lightdm.conf or /etc/lightdm/lightdm.conf.d/ that would override the property display-setup-script set by optimus-manager ?