linuxmint / cinnamon

A Linux desktop featuring a traditional layout, built from modern technology and introducing brand new innovative features.
GNU General Public License v2.0
4.57k stars 745 forks source link

Panel settings fail to launch: monitor_id out of range #12378

Closed DrearyWillow closed 2 months ago

DrearyWillow commented 2 months ago

Distribution

Mint 22

Package version

6.2.9

Graphics hardware in use

AMD Radeon RX 7900 XTX

Frequency

Always

Bug description

The panel settings window is unable to launch. Clicking on the "Panel" icon in System Settings causes System Settings to become unresponsive. Running cinnamon-settings panel shows the following error:

:~$ cinnamon-settings panel
/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py:458: DeprecationWarning: Gtk.Window.set_wmclass is deprecated
  self.window.set_wmclass(wm_class, wm_class)
Loading Panel module
Traceback (most recent call last):
  File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 811, in <module>
    window = MainWindow()
             ^^^^^^^^^^^^
  File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 330, in __init__
    if self.load_sidepage_as_standalone():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 464, in load_sidepage_as_standalone
    self.go_to_sidepage(sp_data.sp, user_action=False)
  File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 185, in go_to_sidepage
    sidePage.build()
  File "/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py", line 212, in build
    self.module.on_module_selected()
  File "/usr/share/cinnamon/cinnamon-settings/modules/cs_panel.py", line 231, in on_module_selected
    self.on_panel_list_changed()
  File "/usr/share/cinnamon/cinnamon-settings/modules/cs_panel.py", line 329, in on_panel_list_changed
    if self.id_or_monitor_position_used(already_defined_panels, monitor_layout, panel_id, monitor_id, position):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/cinnamon/cinnamon-settings/modules/cs_panel.py", line 297, in id_or_monitor_position_used
    if monitor_layout[monitor_id].position_used(position):
       ~~~~~~~~~~~~~~^^^^^^^^^^^^
IndexError: list index out of range

Steps to reproduce

Open System Settings and click on the Panel icon. Alternatively, run cinnamon-settings panel. Booting with different monitor configurations does not resolve the issue (and if I boot with one monitor, the panel on my second monitor does not show at all until reboot).

Expected behavior

The panel settings GUI should launch.

Additional information

I have two monitors with only one panel, which is on the bottom of my second monitor.

Mimicking line 316 in /usr/share/cinnamon/cinnamon-settings/modules/cs_panel.py, I made a python script that reports the current number of monitors. In my testing it always returned the correct amount (when disabling a monitor in Display settings or by simply unplugging it).

import gi
gi.require_version('Gdk', '3.0')
from gi.repository import Gdk
n_mons = Gdk.Screen.get_default().get_n_monitors()
print(f"Number of monitors: {n_mons}")

If I comment out the if statement and add print debugging to id_or_monitor_position_used in cs_panel.py, the Panel menu opens :smiley:

print(f"MONITOR LAYOUT: {monitor_layout}")
print(f"MONITOR ID: {monitor_id}")
 # if monitor_layout[monitor_id].position_used(position):
#     print("cs_panel: Ignoring panel definition with an already-used monitor:position: (ID: %s, Monitor: %d, Position: %s)" % (panel_id, monitor_id, position))
#     return True
:~$ cinnamon-settings panel
/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py:458: DeprecationWarning: Gtk.Window.set_wmclass is deprecated
  self.window.set_wmclass(wm_class, wm_class)
Loading Panel module
MONITOR LAYOUT: [<cs_panel.Monitor object at 0x79e5ef1e3e60>, <cs_panel.Monitor object at 0x79e5ef1e3f50>]
MONITOR ID: 2

Here is my ~/.xsession-errors file for one boot, which has some interesting panel related lines: xsession-errors.txt Gjs-Message: 00:31:11.789: JS LOG: [LookingGlass/info] Ignoring panel definition for nonexistent monitor: 2:2:bottom Gjs-Message: 00:31:12.211: JS LOG: [LookingGlass/info] Role locked: panellauncher

DrearyWillow commented 2 months ago

Okay wait nevermind it seems like I fixed it lol. I simply had to run the script a single time adding the following line above the if statement:

monitor_id = monitor_id - 1
if monitor_layout[monitor_id].position_used(position):
    print("cs_panel: Ignoring panel definition with an already-used monitor:position: (ID: %s, Monitor: %d, Position: %s)" % (panel_id, monitor_id, position))
    return True

It cleaned up some conflicting defs on the next run

:~$ cinnamon-settings panel
/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py:458: DeprecationWarning: Gtk.Window.set_wmclass is deprecated
  self.window.set_wmclass(wm_class, wm_class)
Loading Panel module
cs_panel: Ignoring panel definition with an already-used monitor:position: (ID: 2, Monitor: 1, Position: bottom)
Cleaning up conflicting defs in panels-enabled

And on the next run I removed the monitor_id subtraction line I added, and it runs fine! :smiley:

:~$ cinnamon-settings panel
/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py:458: DeprecationWarning: Gtk.Window.set_wmclass is deprecated
  self.window.set_wmclass(wm_class, wm_class)
Loading Panel module
mattvisa commented 2 months ago

I have this same issue. I can't open the panel under settings if I remove one of three monitors. I can when I reattach the monitor. I am getting this error message. Any ideas on how I can fix this?


Using PAM module (python3-pam) Loading Panel module Traceback (most recent call last): File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 751, in button_press self.side_view_nav(widget, None, category) File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 176, in side_view_nav self.go_to_sidepage(sidePage, user_action=True) File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 185, in go_to_sidepage sidePage.build() File "/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py", line 212, in build self.module.on_module_selected() File "/usr/share/cinnamon/cinnamon-settings/modules/cs_panel.py", line 231, in on_module_selected self.on_panel_list_changed() File "/usr/share/cinnamon/cinnamon-settings/modules/cs_panel.py", line 329, in on_panel_list_changed if self.id_or_monitor_position_used(already_defined_panels, monitor_layout, panel_id, monitor_id, position): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/share/cinnamon/cinnamon-settings/modules/cs_panel.py", line 297, in id_or_monitor_position_used if monitor_layout[monitor_id].position_used(position):


IndexError: list index out of range
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 228, in partial_apport_excepthook
    return apport_excepthook(binary, exc_type, exc_obj, exc_tb)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 144, in apport_excepthook
    os.open(pr_filename, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o640), "wb"
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/var/crash/_usr_share_cinnamon_cinnamon-settings_cinnamon-settings.py.1000.crash'

Original exception was:
Traceback (most recent call last):
  File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 751, in button_press
    self.side_view_nav(widget, None, category)
  File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 176, in side_view_nav
    self.go_to_sidepage(sidePage, user_action=True)
  File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 185, in go_to_sidepage
    sidePage.build()
  File "/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py", line 212, in build
    self.module.on_module_selected()
  File "/usr/share/cinnamon/cinnamon-settings/modules/cs_panel.py", line 231, in on_module_selected
    self.on_panel_list_changed()
  File "/usr/share/cinnamon/cinnamon-settings/modules/cs_panel.py", line 329, in on_panel_list_changed
    if self.id_or_monitor_position_used(already_defined_panels, monitor_layout, panel_id, monitor_id, position):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/cinnamon/cinnamon-settings/modules/cs_panel.py", line 297, in id_or_monitor_position_used
    if monitor_layout[monitor_id].position_used(position):
       ~~~~~~~~~~~~~~^^^^^^^^^^^^
IndexError: list index out of range
mattvisa commented 2 months ago

I have Cinnamon 6.2.9; 6.8.0-45-generic kernel; Linux Mint 22.