Optimus-prime cannot launch because of gnome?

Hi everyone,

I’m trying to set-up Optimus to switch between my GPU. I’ve followed the guide here : https://github.com/Askannz/optimus-manager#important--gnome-and-gdm-users

However, when I try to launch optimus, this what I get :

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

This might not be related to Gnome, but I need to start somewhere. Does anyone know what I might try to do to fix that ? I’ve followed the steps of the tutorial (with gdm-prime and removing the #,etc.)

Thanks a lot !

Just one question to make sure, did you run X11 session or Wayland?

1 Like

Thank your for your answer !

I will sound dumb, but I actually don’t know. What is the way to chose between one another ?

You can check this post. You can switch in the login screen (select bottom right settings icon) and choose between xorg/X11 or Wayland. You should try Xorg.

1 Like

If you did all the steps on the guide you should be booting of xorg already. Post your:

inxi -Faz

Please

1 Like

Here you go, thank you for your help !

System:
  Kernel: 6.1.9-arch1-1 arch: x86_64 bits: 64 compiler: gcc v: 12.2.1
    parameters: initrd=\f6a01ca4afd94d6fab859f42c28d48a9\6.1.9-arch1-1\initrd
    nvme_load=YES rw root=UUID=d2c35011-896a-4f37-9492-1561e2286f40
    systemd.machine_id=f6a01ca4afd94d6fab859f42c28d48a9
  Desktop: GNOME v: 43.2 tk: GTK v: 3.24.36 wm: gnome-shell dm: GDM v: 43.0
    Distro: EndeavourOS base: Arch Linux
Machine:
  Type: Laptop System: Acer product: Aspire VN7-793G v: V1.03
    serial: <superuser required>
  Mobo: KBL model: Neptune_KLS v: V1.03 serial: <superuser required>
    UEFI: Insyde v: 1.03 date: 02/17/2017
Battery:
  ID-1: BAT0 charge: 24.8 Wh (53.1%) condition: 46.7/52.5 Wh (88.9%)
    volts: 11.9 min: 11.4 model: LGC AC14A8L type: Li-ion serial: <filter>
    status: not charging
  Device-1: hidpp_battery_0 model: Logitech Wireless Mouse MX Master 2S
    serial: <filter> charge: 50% (should be ignored) rechargeable: yes
    status: N/A
CPU:
  Info: model: Intel Core i7-7700HQ bits: 64 type: MT MCP arch: Kaby Lake
    gen: core 7 level: v3 note: check built: 2018 process: Intel 14nm family: 6
    model-id: 0x9E (158) stepping: 9 microcode: 0xF0
  Topology: cpus: 1x cores: 4 tpc: 2 threads: 8 smt: enabled cache:
    L1: 256 KiB desc: d-4x32 KiB; i-4x32 KiB L2: 1024 KiB desc: 4x256 KiB
    L3: 6 MiB desc: 1x6 MiB
  Speed (MHz): avg: 3402 high: 3620 min/max: 800/3800 scaling:
    driver: intel_pstate governor: powersave cores: 1: 3620 2: 3400 3: 3500
    4: 2800 5: 3500 6: 3501 7: 3501 8: 3400 bogomips: 44817
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities:
  Type: itlb_multihit status: KVM: VMX disabled
  Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT
    vulnerable
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable
  Type: meltdown mitigation: PTI
  Type: mmio_stale_data mitigation: Clear CPU buffers; SMT vulnerable
  Type: retbleed mitigation: IBRS
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: IBRS, IBPB: conditional, RSB filling,
    PBRSB-eIBRS: Not affected
  Type: srbds mitigation: Microcode
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel HD Graphics 630 vendor: Acer Incorporated ALI driver: i915
    v: kernel arch: Gen-9.5 process: Intel 14nm built: 2016-20 ports:
    active: eDP-1 empty: DP-1, DP-2, HDMI-A-1, HDMI-A-2 bus-ID: 00:02.0
    chip-ID: 8086:591b class-ID: 0300
  Device-2: NVIDIA GP106M [GeForce GTX 1050 Ti Mobile]
    vendor: Acer Incorporated ALI driver: nvidia v: 525.85.05
    alternate: nouveau,nvidia_drm non-free: 525.xx+
    status: current (as of 2022-12) arch: Pascal code: GP10x
    process: TSMC 16nm built: 2016-21 pcie: gen: 1 speed: 2.5 GT/s lanes: 16
    link-max: gen: 3 speed: 8 GT/s bus-ID: 01:00.0 chip-ID: 10de:1c21
    class-ID: 0302
  Device-3: Chicony HD WebCam type: USB driver: uvcvideo bus-ID: 1-9:4
    chip-ID: 04f2:b573 class-ID: 0e02
  Display: x11 server: X.Org v: 21.1.6 with: Xwayland v: 22.1.7
    compositor: gnome-shell driver: X: loaded: modesetting dri: iris gpu: i915
    display-ID: :1 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22")
    s-diag: 582mm (22.93")
  Monitor-1: eDP-1 model: AU Optronics 0x109d built: 2014 res: 1920x1080
    hz: 60 dpi: 128 gamma: 1.2 size: 381x214mm (15x8.43") diag: 437mm (17.2")
    ratio: 16:9 modes: 1920x1080
  API: OpenGL v: 4.6 Mesa 22.3.4 renderer: Mesa Intel HD Graphics 630 (KBL
    GT2) direct render: Yes
Audio:
  Device-1: Intel CM238 HD Audio vendor: Acer Incorporated ALI
    driver: snd_hda_intel v: kernel bus-ID: 00:1f.3 chip-ID: 8086:a171
    class-ID: 0403
  Sound API: ALSA v: k6.1.9-arch1-1 running: yes
  Sound Server-1: PulseAudio v: 16.1 running: no
  Sound Server-2: PipeWire v: 0.3.65 running: yes
Network:
  Device-1: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter
    vendor: Lite-On driver: ath10k_pci v: kernel pcie: gen: 1 speed: 2.5 GT/s
    lanes: 1 bus-ID: 02:00.0 chip-ID: 168c:003e class-ID: 0280 temp: 44.0 C
  IF: wlan0 state: up mac: <filter>
  Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Acer Incorporated ALI driver: r8169 v: kernel pcie: gen: 1
    speed: 2.5 GT/s lanes: 1 port: 3000 bus-ID: 03:00.0 chip-ID: 10ec:8168
    class-ID: 0200
  IF: enp3s0 state: down mac: <filter>
Bluetooth:
  Device-1: Lite-On type: USB driver: btusb v: 0.8 bus-ID: 1-7:3
    chip-ID: 04ca:3016 class-ID: e001
  Report: bt-adapter ID: hci0 rfk-id: 4 state: up address: <filter>
Drives:
  Local Storage: total: 1.14 TiB used: 172.41 GiB (14.7%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/sda maj-min: 8:0 vendor: SK Hynix model: HFS256G39TND-N210A
    size: 238.47 GiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
    type: SSD serial: <filter> rev: 1P10 scheme: GPT
  ID-2: /dev/sdb maj-min: 8:16 vendor: Seagate model: ST1000LM035-1RK172
    size: 931.51 GiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
    type: HDD rpm: 5400 serial: <filter> rev: ACM1 scheme: GPT
Partition:
  ID-1: / raw-size: 237.49 GiB size: 232.7 GiB (97.98%)
    used: 78.11 GiB (33.6%) fs: ext4 dev: /dev/sda2 maj-min: 8:2
Swap:
  Alert: No swap data was found.
Sensors:
  System Temperatures: cpu: 38.0 C pch: 32.5 C mobo: N/A
  Fan Speeds (RPM): N/A
Info:
  Processes: 311 Uptime: 20h 46m wakeups: 36938 Memory: 15.51 GiB
  used: 3.31 GiB (21.3%) Init: systemd v: 252 default: graphical
  tool: systemctl Compilers: gcc: 12.2.1 Packages: 1182 pm: pacman pkgs: 1175
  libs: 336 tools: yay pm: flatpak pkgs: 0 pm: snap pkgs: 7 Shell: Bash

Is it possible that I only have Gnome and Gnome classic ? I thought Xorg was installed be default but I might need to install it manually.

Thank your for your hep !

Ok. Gnome defaults to Wayland (and one can select Xorg) unless you have Nvidia graphics, then it uses Xorg/X11 per default and no Wayland option is displayed. As I recall.

Display: x11 server: X.Org v: 21.1.6 with: Xwayland v: 22.1.7
    compositor: gnome-shell driver: X: loaded: modesetting dri: iris gpu: i915
    display-ID: :1 screens: 1

I was just checking, I think you can exclude Wayland as your problem as you are running the right session, as you can see in the hardware output above.

Honestly I only had problems with hybrid Intel/Nvidia, Optimus etc. and decided to switch to only Nvidia GPU when necessary in the bios settings (select only discrete GPU). Downside it uses more battery then.

Edit: If you want to go that route (using only discrete GPU) you need to blacklist the nouveau driver else you may boot into black screen.

1 Like

This is how I run my Legion Advantage - just because in my head it doesn’t make sense to have the graphics and never use them. . .

But battery life blows hahahahaha

2 Likes

Read the errors, as the message suggests. :person_shrugging:

1 Like

The default gdm package from the Archlinux repositories is not compatible with optimus-manager, so you must replace it with this patched version : gdm-prime (also replaces libgdm). The patch was written by Canonical for Ubuntu and simply adds two script entry points specifically for Prime switching. The package is otherwise identical to the official one.

Gnome launches Wayland sessions by default, which are incompatible with optimus-manager. To force Xorg sessions, You need to edit the file /etc/gdm/custom.conf and remove the # before the line #WaylandEnable=false.

1 Like

Indeed you’re right, sorry I’m not used to this and I overlooked the message telling me there was a log file.

[12] INFO: # Xorg pre-start hook
[12] INFO: Previous state was: {'type': 'pending_pre_xorg_start', 'requested_mode': 'integrated', 'current_mode': None}
[12] INFO: Requested mode is: integrated
[315] INFO: Available modules: ['nouveau', 'nvidia', 'nvidia_drm', 'nvidia_modeset', 'nvidia_uvm']
[315] INFO: Unloading modules ['nvidia_drm', 'nvidia_modeset', 'nvidia_uvm', 'nvidia'] (if loaded)
[427] INFO: switching=none, nothing to do
[451] INFO: Writing to /etc/X11/xorg.conf.d/10-optimus-manager.conf
[452] INFO: Writing state {'type': 'pending_post_xorg_start', 'switch_id': '20230202T225208', 'requested_mode': 'integrated'}
[452] INFO: Xorg pre-start hook completed successfully.

Still I don’t know how to interpret this.

Anyway thank your for your answer !

Yes, those steps were followed, gdm-prime is installed and I have modified the custom.conf, so its seems it doesn’t come from this. :confused:

Actually I think I wouldn’t mind doing this ! This might solve my problem specifically but I still don’t get why Optimus would not launch.

Maybe it’s not the right place to ask this, but why the nouveau driver would need to be blacklisted ?

Anyway, I’ll try to do that if the log I’ve just posted cannot help further !

Thank you again !

Because nouveau may conflict with Nvidia driver and load instead. You can try first switching to Nvidia only (from hybrid to discrete) in bios. Try rebooting and see if it works.

If not, here how to do it in Grub.

If you use systemd boot (default on recent eos Cassini iso), I don’t know how to proceed.

Backup your stuff first. If you boot to black screen, no panic, you can undo this and/or always switch to TTY and troubleshoot things. Additional infos…

Remember, Nvidia and Wayland do not work well together if at all.Thats why on Pop OS for example you are automatically brought into Xorg session at login with Nvidia graphics.

1 Like

The upstream nvidia package (if it is used), has already nouveau blacklisted, by default.

2 Likes

I’ve maybe found another tip on my problem.

As I was looking at Steam because I had trouble launching gales with proton, I’ve tried running Steam from the terminal as I’ve read it may give me additional data in case of errors.

And it seems that Xorg with not be working well, although I don’t understand why :confused:
This, for example, was what the terminal told me when I tried to launch steam-runtime :

Could not connect to X session manager: None of the authentication protocols specified are supported
Could not connect to X session manager: None of the authentication protocols specified are supported
Xlib: sequence lost (0x10000 > 0x127) in reply type 0x21!
Xlib: sequence lost (0x10000 > 0x17f) in reply type 0xc!

(steam:37481): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()
vkCreateInstance failed with error -1
BInit - Unable to initialize Vulkan!
local (potentially out of sync) copy of roaming config loaded - 379 bytes.
ioctl (GFEATURE): Invalid argument
ioctl (GFEATURE): Invalid argument
ioctl (GFEATURE): Invalid argument
ioctl (GFEATURE): Broken pipe
ioctl (GFEATURE): Broken pipe
ioctl (GFEATURE): Broken pipe
BRefreshApplicationsInLibrary 1: 1ms
roaming config store loaded successfully - 379 bytes.
migrating temporary roaming config store

And also, the terminal repeats this indefinitely at the end :

Xlib: sequence lost (0x10000 > 0x2a0c) in reply type 0xc!
Xlib: sequence lost (0x10000 > 0x2a0f) in reply type 0xc!
Xlib: sequence lost (0x10000 > 0x2a0c) in reply type 0xc!
Xlib: sequence lost (0x10000 > 0x2a0f) in reply type 0xc!

Now, I’m really beginning to learn how to read logs like this and my only hint is that there is a problem here ^^'. But I cannot get what ? Is it possible that I’m missing something for Xorg to run normally ? Or is this completely unrelated to the original problem ?

I’m really sorry if that’s not quite clear.

My point was only that Nvidia and Wayland are a no go, or at least it was like that in the past ± two years. Nvidia hybrid can be a pain to troubleshoot. It’s good you are courageous and patient to fix it!

Recently I was surprised when trying to run my nvidia 540M card from Waylnad that it works.
And maybe for the subject author’s card, could you try using a bumblebee? I don’t want to be misunderstood, just asking

I would avoid bumblebee! It is the least preferred method and to my opinion the worst.

Note from arch wiki

Bumblebee has significant performance issues[1][2]. See NVIDIA Optimus for alternative solutions.

https://wiki.archlinux.org/title/bumblebee