question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't switch due to Key Error, and manager in inconsistent state

See original GitHub issue

Describe the bug Trying to run any optimus-manager commands gives me:

ERROR: a GPU setup was initiated but Xorg post-start hook did not run.
Log at /var/log/optimus-manager/switch/switch-20201203T103246.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.

The mentioned log file:

[35] INFO: # Xorg pre-start hook
[35] INFO: Previous state was: {'type': 'pending_pre_xorg_start', 'requested_mode': 'nvidia', 'current_mode': None}
[35] INFO: Requested mode is: nvidia
[35] INFO: Checking for GDM display servers
[1202] INFO: Available modules: ['nouveau', 'bbswitch', 'nvidia', 'nvidia_drm', 'nvidia_modeset', 'nvidia_uvm']
[1202] INFO: Unloading modules ['nouveau'] (if loaded)
[1256] INFO: Loading module nvidia
[1996] INFO: Loading module nvidia_drm
[2747] INFO: Loaded extra Intel Xorg options (0 lines)
[2748] INFO: Loaded extra Intel Xorg options (1 lines)
[2748] INFO: Writing to /etc/X11/xorg.conf.d/10-optimus-manager.conf
[2748] INFO: Writing state {'type': 'pending_post_xorg_start', 'switch_id': '20201203T103246', 'requested_mode': 'nvidia'}
[2748] INFO: Xorg pre-start hook completed successfully.

Also, when trying to switch from the graphical interface I get this in the journal:

Dec 03 10:26:37 host python3[1723]: [54608] INFO: Received command : {
Dec 03 10:26:37 host python3[1723]:     "args": {
Dec 03 10:26:37 host python3[1723]:         "mode": "nvidia"
Dec 03 10:26:37 host python3[1723]:     },
Dec 03 10:26:37 host python3[1723]:     "type": "switch"
Dec 03 10:26:37 host python3[1723]: }
Dec 03 10:26:37 host python3[1723]: [54608] INFO: Writing requested GPU mode nvidia
Dec 03 10:26:37 host python3[1723]: [54608] ERROR: Invalid command  "{
Dec 03 10:26:37 host python3[1723]:     "args": {
Dec 03 10:26:37 host python3[1723]:         "mode": "nvidia"
Dec 03 10:26:37 host python3[1723]:     },
Dec 03 10:26:37 host python3[1723]:     "type": "switch"
Dec 03 10:26:37 host python3[1723]: }
Dec 03 10:26:37 host python3[1723]: " ! Key error : 'current_mode'

This coincided with the update to python 3.9, so might be related to #349, but I’ve reinstalled all the related packages already.

System info Please include :

  • Your distribution: arch
  • Your desktop manager: i3
  • You display manager: LightDM
  • The version of optimus-manager you are using : latest stable release (optimus-manager)
  • Your custom optimus-manager configuration file at /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)
# - custom: use custom scripts at /etc/optimus-manager/nvidia-enable.sh and /etc/optimus-manager/nvidia-disable.sh
# - 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).
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=no

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

# 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, LXDE, 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

# GPU mode to use at computer startup. Possible values: nvidia, intel, hybrid, auto
# "auto" is a special mode that auto-detects if the computer is running on battery
# and selects a proper GPU mode. See the other options below.
startup_mode=nvidia
# GPU mode to select when startup_mode=auto and the computer is running on battery.
# Possible values: nvidia, intel, hybrid
startup_auto_battery_mode=nvidia
# GPU mode to select when startup_mode=auto and the computer is running on external power.
# Possible values: nvidia, intel, hybrid
startup_auto_extpower_mode=nvidia


[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, uxa
# 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

# Set to yes if you want to use optimus-manager with external Nvidia GPUs (experimental)
allow_external_gpus=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. Note: does not work in hybrid mode.
# - triple_buffer : enable triple buffering.
options=overclocking

Logs Run optimus-manager --status in a console, and if an error message appears, post it here: see above

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Askannzcommented, Jan 5, 2021

Not sure yet, there are a few changes I would like to implement before releasing a new version, but I haven’t had a ton of time/motivation for that recently.

You can use optimus-manager-git in the meantime, it points to the master branch which includes this commit.

1reaction
Askannzcommented, Dec 13, 2020

@biggus-dickus, @gabrieleavi, @ksdrummer The problem should now be fixed on GDM (see https://github.com/Askannz/optimus-manager/commit/27405889297fb68a89468ce92b3c88b8b5cbaab6).

Seems that LightDM breaks for a different reason, though. @nicklan, do you have any custom configuration in /etc/lightdm/lightdm.conf or /etc/lightdm/lightdm.conf.d/ ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Access reports that databases are in an 'inconsistent state'
and then type Command. Right-click on Command Prompt and choose Run as administrator. Close the command prompt window.
Read more >
The database manager resources are in an inconsistent state ...
Cause. The request failed because the database manager resources are in an inconsistent state. This can occur if: DB2 was incorrectly terminated (on...
Read more >
Why become referential constraints inconsistent after updating ...
The ObjectContext might be in an inconsistent state. Inner exception message: A referential integrity constraint violation occurred: The ...
Read more >
SAP message SAPAPO-TSM241 Inconsistent state: No. of ch
The system issues an error message and will not allow you to continue with this transaction until the error is resolved. In general...
Read more >
HA Sync Failure Due to Inconsistent Management Settings
Issue In High Availability (HA), management settings are not synchronized to the peer device so you can receive sync errors due to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found