Call for testing: optimus-switch

It was going so well... now I discovered a problem, tell me if you need some info to help me fix this, I'm running lightdm with i3wm and at the beginning everything was working fine, now when I boot with the power cable plugged it does fine until I login, then I can move the cursor for like 2 seconds and the system hangs and I can't do anything, this happens only with intel mode and only if the power cable is plugged after login, or if I remove the power cable while on the login screen

UPDATE:
After trying everything related to power management I noticed that the system would hang after pulseaudio started, so I disabled it and the system would run normally, but as soon as the daemon autostarted pulseaudio the system would hang, I look up on pulseaudio troubleshooting and I saw a fix for excessive CPU usage, adding load-module module-udev-detect tsched = 0, and this fixed my problem, but I had other issues related with the standard powermanagement that manjaro installed for me, so I uninstalled everything related to power management and installed powertop and for now everything is working fine

Coming from optimus manager, I switched to it and so far it has been working as intended. There was an issue in which the nvidia gpu wouldn't shut down, or be disabled during intel mode, but I've managed to fix those (As of writing this post, I've only confirmed the latter, will edit this post when I confirm the former.) by changing the acpi_call to the right one.

Thanks @dglt for making this!

1 Like

Installed SDDM on 5.4. Black screen upon restart. I can access grub but what should I input to restore the system? Here is the thread I started to work around fixing it.

Update to my last post here:

My laptop with Nvidia mode on won't reboot or shut down normally while trying to switch to Intel only mode. I have to force shut it down on order to switch from Nvidia to Intel.

I checked if the Nvidia mode can shut down or reboot normally (without switching to Intel mode) and it works just fine.

Here is the code that is displayed when I try to reboot from Nvidia to Intel:

IMG_20200425_151745

Additionally this happens:
IMG_20200425_162001

Any help would be appreciated.

Edit: Forgot to mention that switching from Intel to Nvidia through rebooting works just fine.

1 Like

hey I have the same problem, thought to have fixed it but the I noticed I was in nvidia mode, so I am in the same boat, I don't what's causing this

Oh and also I had to comment out a line in my alsa config

pcm.hdmi cards.pcm.hdmi

this was causing a freeze after login in intel mode. don't know why alsa doesn't handle this error but I will search about this and update here and on alsa

UPDATE:
in intel mode suspension doesn't work, it locks up the system

1 Like

how are you switching modes? from CLI? or from marjaroptimus indicator?

i cant make sense of why switching modes would hang at all, there are no Xorg/Xsetup commands run in the switching scripts. the only thing changing modes does is move configuration files around.

switch to intel mode then boot/reboot a couple times without switching between reboots and see if the hang happens. do the same for nvidia mode. i dont think the switch is causing the problem but instead you possibly have trouble shutting down on one mode but not the other.

and try using another kernel to see if this happens there as well

@dglt. My little program should not be interfering with how your scripts work. To make sure, I even built in a warning dialog if an error occurs and built in a delay before it reboots to make sure that it has finished running.

1 Like

good to know, since the errors show that Xsetup is what's hanging then that would mean the Xsetup script itself never finished running when the system booted.

@AztecFitnessGod also post these outputs.

inxi -Fxxxza --no-host
cat /etc/switch/intel/no-optimus.sh
cat /etc/switch/nvidia/optimus.sh
1 Like

If needed, the reboot delay can be adjusted by editing the reboot.sh located in /usr/share/manjaroptimus-appindicator/scripts/ . Currently, the script is set to sleep for 5 before running.

1 Like
no-optimus.sh
#!/bin/sh

#this script is run as a display setup script
#that replaces the one used by nvidia/prime.
##
#this powers-down/disables the nvidia dGPU and
#removes it from /sys/bus/pce/devices
#for the current boot. this is reset after reboot.
# PLEASE READ BELOW TO ENABLE THIS

xrandr --auto

#This ensures that LightDM doesn't fail after locking the screen or logging out
#edit "0000:01:00.0" to match your bus id if it's different.

if [ -d "/sys/bus/pci/devices/0000:01:00.0" ]
then

echo 'auto' > '/sys/bus/pci/devices/0000:01:00.0/power/control'  #adjust busid if needed

fi



#to find out what acpi_call disables your nvidia gpu,
#run this command
#
#` sudo /usr/share/acpi_call/examples/turn_off_gpu.sh ` 
#
#and see which acpi_call is returned as "works!" and then edit line 38 to match if needed.
#default BusID is set to 0000:01:00.0 (syntax is important) 
#be sure to edit lines 16,19,36,38,39 to match your BusID and working acpi_call if needed
#then uncomment lines 38,39


if [ -d "/sys/bus/pci/devices/0000:01:00.0" ]
then
echo '\_SB.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call 
echo -n 1 > '/sys/bus/pci/devices/0000:01:00.0/remove' 

fi

optimus.sh
#!/bin/sh

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
inxi

System:    Host: manjaro Kernel: 5.4.34-1-MANJARO x86_64 bits: 64 compiler: gcc v: 9.3.0 
           parameters: initrd=\amd-ucode.img initrd=\intel-ucode.img initrd=\initramfs-5.4-x86_64.img 
           root=UUID=1a5f7eff-66df-4567-a8be-39e235fd74d5 rw acpi_osi=! acpi_osi="Windows 2009" psmouse.intertouch=1 
           Desktop: i3 4.18 info: i3bar dm: LightDM 1.30.0 Distro: Manjaro Linux 
Machine:   Type: Laptop System: Micro-Star product: GS65 Stealth Thin 8RF v: REV:1.0 serial: <filter> Chassis: type: 10 
           serial: <filter> 
           Mobo: Micro-Star model: MS-16Q2 v: REV:1.0 serial: <filter> UEFI: American Megatrends v: E16Q2IMS.10B 
           date: 05/14/2018 
Battery:   ID-1: BAT1 charge: 22.9 Wh condition: 75.7/80.3 Wh (94%) volts: 15.8/15.2 model: MSI BIF0_9 type: Li-ion 
           serial: N/A status: Charging 
CPU:       Topology: 6-Core model: Intel Core i7-8750H bits: 64 type: MT MCP arch: Kaby Lake family: 6 model-id: 9E (158) 
           stepping: A (10) microcode: CA L2 cache: 9216 KiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 52815 
           Speed: 1001 MHz min/max: 800/4100 MHz Core speeds (MHz): 1: 998 2: 996 3: 994 4: 996 5: 959 6: 951 7: 957 8: 957 
           9: 943 10: 957 11: 981 12: 989 
           Vulnerabilities: Type: itlb_multihit status: KVM: Split huge pages 
           Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable 
           Type: mds mitigation: Clear CPU buffers; SMT vulnerable 
           Type: meltdown mitigation: PTI 
           Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl and seccomp 
           Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization 
           Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional, IBRS_FW, STIBP: conditional, RSB filling 
           Type: tsx_async_abort status: Not affected 
Graphics:  Device-1: Intel UHD Graphics 630 vendor: Micro-Star MSI driver: i915 v: kernel bus ID: 00:02.0 chip ID: 8086:3e9b 
           Device-2: NVIDIA GP104M [GeForce GTX 1070 Mobile] vendor: Micro-Star MSI driver: nvidia v: 440.82 bus ID: 01:00.0 
           chip ID: 10de:1ba1 
           Display: x11 server: X.Org 1.20.8 driver: modesetting,nvidia resolution: 1920x1080~144Hz 
           OpenGL: renderer: GeForce GTX 1070 with Max-Q Design/PCIe/SSE2 v: 4.6.0 NVIDIA 440.82 direct render: Yes 
Audio:     Device-1: Intel Cannon Lake PCH cAVS vendor: Micro-Star MSI driver: snd_hda_intel v: kernel bus ID: 00:1f.3 
           chip ID: 8086:a348 
           Device-2: NVIDIA GP104 High Definition Audio driver: snd_hda_intel v: kernel bus ID: 01:00.1 chip ID: 10de:10f0 
           Sound Server: ALSA v: k5.4.34-1-MANJARO 
Network:   Device-1: Intel Wireless-AC 9560 [Jefferson Peak] vendor: Bigfoot Networks driver: iwlwifi v: kernel port: 5000 
           bus ID: 00:14.3 chip ID: 8086:a370 
           IF: wlo1 state: up mac: <filter> 
           Device-2: Qualcomm Atheros Killer E2500 Gigabit Ethernet vendor: Micro-Star MSI driver: alx v: kernel port: 3000 
           bus ID: 3d:00.0 chip ID: 1969:e0b1 
           IF: enp61s0 state: down mac: <filter> 
Drives:    Local Storage: total: 465.76 GiB used: 66.63 GiB (14.3%) 
           ID-1: /dev/nvme0n1 vendor: Crucial model: CT500P1SSD8 size: 465.76 GiB block size: physical: 512 B logical: 512 B 
           speed: 31.6 Gb/s lanes: 4 serial: <filter> rev: P3CR013 scheme: GPT 
           ID-2: /dev/nvme1n1 vendor: Samsung model: MZVLB512HAJQ-00000 size: 476.94 GiB block size: physical: 512 B 
           logical: 512 B speed: 31.6 Gb/s lanes: 4 serial: <filter> rev: EXA7201Q scheme: GPT 
Partition: ID-1: / raw size: 476.44 GiB size: 467.96 GiB (98.22%) used: 32.38 GiB (6.9%) fs: ext4 dev: /dev/nvme1n1p2 
           ID-2: /boot raw size: 512.0 MiB size: 511.0 MiB (99.80%) used: 72.0 MiB (14.1%) fs: vfat dev: /dev/nvme1n1p1 
Sensors:   System Temperatures: cpu: 44.0 C mobo: N/A gpu: nvidia temp: 38 C 
           Fan Speeds (RPM): N/A 
Info:      Processes: 249 Uptime: 1m Memory: 15.48 GiB used: 465.2 MiB (2.9%) Init: systemd v: 244 Compilers: gcc: 9.3.0 
           clang: 10.0.0 Shell: zsh v: 5.8 running in: urxvtd inxi: 3.0.37 

it hangs also when doing mhwd or lspci when in intel mode, I have read the arch linux optimus page and it says that on some systems powering off the gpu before starting the X server can cause some issues, I don't know if this is related

first make sure that acpi_call is actually built for that kernel.

dkms status

if not, make sure that linux56-headers is installed. you should have the headers of each installed kernel. if mhwd-kernel -li lists linux54 and linux56 then you should have linux56-headers and linux54-headers installed. dkms status should show it as installed for both of those kernels.

if they are installed, you could try adding a short sleep to the no-optimus.sh script so it's delayed a bit.

edit this section of /etc/switch/intel/no-optimus.sh to match

if [ -d "/sys/bus/pci/devices/0000:01:00.0" ]
then
sleep 10
echo '\_SB.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call 
echo -n 1 > '/sys/bus/pci/devices/0000:01:00.0/remove' 

fi

save/exit, then set intel mode again to apply the changes and reboot, then see if the problem still exists. if it's still happening then it might be the acpi_call your using thats hanging. to test that you can comment out these lines

sleep 10
echo '\_SB.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call 
echo -n 1 > '/sys/bus/pci/devices/0000:01:00.0/remove' 

then set intel mode to apply changes and reboot. after your on the desktop open a terminal and try running each command manually (requires root shell)

su
#enter root pw
echo '\_SB.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call
echo -n 1 > '/sys/bus/pci/devices/0000:01:00.0/remove'

do either of those commands hang or give an error?

dkms is built for my kernel, I tried adding sleep 10 but it didn't change anything, I have also noticed that if I start with power plugged and then remove it in intel mode the whole system hangs( I have removed every powermanagement software I had), tried commenting those lines and running them as root in terminal and they don't give any erros, maybe I could fix this with some bios settings, but I don't really know what

UPDATE:
so I tried a different acpi call and everything seems working, I don't really know if the gpu is really powered off, powertop doesn't show usage on it but I'm not sure, I will do further testing
\_SB.PCI0.PEG0.PEGP._DSM
this is the acpicall that I am using now

I rebooted twice with intel mode and on both reboots my laptop boots in just fine.

As for the way I switch modes, I use the CLI, but I first discovered the error when trying to switch from manjaroptimus indicator, so I used timeshift, installed it again, and it's still there, even when using the CLI, so I can say it's not the indicator's fault.

For the terminal commands...

Inxi
System:    Kernel: 5.6.6-1-MANJARO x86_64 bits: 64 compiler: gcc v: 9.3.0 
           parameters: BOOT_IMAGE=/boot/vmlinuz-5.6-x86_64 root=UUID=bb20b6c4-1fa1-4c1f-bf10-9e0780863b7b rw quiet apparmor=1 
           security=apparmor resume=UUID=f5e88830-ac68-4323-93c7-f96422c0de22 udev.log_priority=3 
           Desktop: KDE Plasma 5.18.4 tk: Qt 5.14.2 wm: kwin_x11 dm: SDDM Distro: Manjaro Linux 
Machine:   Type: Laptop System: Acer product: Aspire E5-576G v: V1.29 serial: <filter> 
           Mobo: KBL model: Ironman_SK v: V1.29 serial: <filter> UEFI: Insyde v: 1.29 date: 07/21/2017 
Battery:   ID-1: BAT1 charge: 10.1 Wh condition: 38.0/40.9 Wh (93%) volts: 15.0/14.6 model: LGC AS16A8K type: Li-ion 
           serial: <filter> status: Charging 
CPU:       Topology: Quad Core model: Intel Core i5-8250U bits: 64 type: MT MCP arch: Kaby Lake family: 6 model-id: 8E (142) 
           stepping: A (10) microcode: CA L2 cache: 6144 KiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 28808 
           Speed: 800 MHz min/max: 400/3400 MHz Core speeds (MHz): 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 800 
           Vulnerabilities: Type: itlb_multihit status: KVM: Split huge pages 
           Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable 
           Type: mds mitigation: Clear CPU buffers; SMT vulnerable 
           Type: meltdown mitigation: PTI 
           Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl and seccomp 
           Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization 
           Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional, IBRS_FW, STIBP: conditional, RSB filling 
           Type: tsx_async_abort status: Not affected 
Graphics:  Device-1: Intel UHD Graphics 620 vendor: Acer Incorporated ALI driver: i915 v: kernel bus ID: 00:02.0 
           chip ID: 8086:5917 
           Display: x11 server: X.Org 1.20.8 driver: intel compositor: kwin_x11 resolution: 1920x1080~60Hz 
           OpenGL: renderer: Mesa Intel UHD Graphics 620 (KBL GT2) v: 4.6 Mesa 20.0.4 direct render: Yes 
Audio:     Device-1: Intel Sunrise Point-LP HD Audio vendor: Acer Incorporated ALI driver: snd_hda_intel v: kernel 
           bus ID: 00:1f.3 chip ID: 8086:9d71 
           Sound Server: ALSA v: k5.6.6-1-MANJARO 
Network:   Device-1: Intel Dual Band Wireless-AC 3168NGW [Stone Peak] driver: iwlwifi v: kernel port: 5040 bus ID: 03:00.0 
           chip ID: 8086:24fb 
           IF: wlp3s0 state: up mac: <filter> 
           Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Acer Incorporated ALI driver: r8169 
           v: kernel port: 3000 bus ID: 04:00.1 chip ID: 10ec:8168 
           IF: enp4s0f1 state: down mac: <filter> 
           IF-ID-1: vmnet1 state: unknown speed: N/A duplex: N/A mac: <filter> 
           IF-ID-2: vmnet8 state: unknown speed: N/A duplex: N/A mac: <filter> 
Drives:    Local Storage: total: 1.82 TiB used: 444.92 GiB (23.9%) 
           ID-1: /dev/sda vendor: Seagate model: ST2000LM007-1R8174 size: 1.82 TiB block size: physical: 4096 B logical: 512 B 
           speed: 6.0 Gb/s rotation: 5400 rpm serial: <filter> rev: ACM1 scheme: GPT 
Partition: ID-1: / raw size: 63.96 GiB size: 62.71 GiB (98.04%) used: 56.87 GiB (90.7%) fs: ext4 dev: /dev/sda7 
           ID-2: /home raw size: 955.67 GiB size: 939.67 GiB (98.33%) used: 387.82 GiB (41.3%) fs: ext4 dev: /dev/sda8 
           ID-3: swap-1 size: 3.91 GiB used: 16.3 MiB (0.4%) fs: swap swappiness: 60 (default) cache pressure: 100 (default) 
           dev: /dev/sda6 
Sensors:   System Temperatures: cpu: 54.0 C mobo: N/A 
           Fan Speeds (RPM): N/A 
Info:      Processes: 266 Uptime: 15m Memory: 3.72 GiB used: 1.96 GiB (52.5%) Init: systemd v: 244 Compilers: gcc: 9.3.0 
           clang: 10.0.0 Shell: bash v: 5.0.16 running in: yakuake inxi: 3.0.37 

I'm using intel mode when running this command, so the nvidia gpu isn't shown in the output.

no-optimus
#!/bin/sh

#this script is run as a display setup script
#that replaces the one used by nvidia/prime.
##
#this powers-down/disables the nvidia dGPU and
#removes it from /sys/bus/pce/devices
#for the current boot. this is reset after reboot.
# PLEASE READ BELOW TO ENABLE THIS

xrandr --auto

#This ensures that LightDM doesn't fail after locking the screen or logging out
#edit "0000:01:00.0" to match your bus id if it's different.

if [ -d "/sys/bus/pci/devices/0000:01:00.0" ]
then

  echo 'auto' > '/sys/bus/pci/devices/0000:01:00.0/power/control'  #adjust busid if needed

fi



#to find out what acpi_call disables your nvidia gpu,
#run this command
#
#` sudo /usr/share/acpi_call/examples/turn_off_gpu.sh ` 
#
#and see which acpi_call is returned as "works!" and then edit line 38 to match if needed.
#default BusID is set to 0000:01:00.0 (syntax is important) 
#be sure to edit lines 16,19,36,38,39 to match your BusID and working acpi_call if needed
#then uncomment lines 38,39


if [ -d "/sys/bus/pci/devices/0000:01:00.0" ]
then
  echo '\_SB_.PCI0.RP01.PXSX._DSM' > /proc/acpi/call 
  echo -n 1 > '/sys/bus/pci/devices/0000:01:00.0/remove' 

fi

optimus
#!/bin/sh
# run at root before login dialog appears

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

And so that I can show I have the acpi call that works...

gpu_switch_check
Trying \_SB.PCI0.P0P1.VGA._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.P0P2.VGA._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.OVGA.ATPX: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.OVGA.XTPX: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.P0P3.PEGP._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.P0P2.PEGP._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.P0P1.PEGP._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.MXR0.MXM0._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG1.GFX0._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG0.GFX0.DOFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG1.GFX0.DOFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG0.PEGP._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.XVR0.Z01I.DGOF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEGR.GFX0._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG.VID._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG0.VID._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.P0P2.DGPU._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.P0P4.DGPU.DOFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.IXVE.IGPU.DGOF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.RP00.VGA._PS3: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.RP00.VGA.P3MO: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.GFX0.DSM._T_0: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.LPC.EC.PUBS._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.P0P2.NVID._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.P0P2.VGA.PX02: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.PEGP.DGFX._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.VGA.PX02: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG0.PEGP.SGOF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.AGP.VGA.PX02: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG0.PEGP._DSM: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.RP01.PEGP._DSM: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.GFX0._DSM: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
works!
Trying \_SB_.PCI0.RP01.PXSX._DSM: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
works!
Trying \_SB.PCI0.PEG.VID._DSM: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.PEG0.PEGP._DSM: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.AGP.VGA.PX02: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG0.PEGP._DSM_OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.RP01.PEGP._DSM_OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.GFX0._DSM_OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.RP01.PXSX._DSM_OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG.VID._DSM_OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.PEG0.PEGP._DSM_OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.AGP.VGA.PX02._DSM_OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG0.PEGP._DSM._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.RP01.PEGP._DSM._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.GFX0._DSM._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.RP01.PXSX._DSM._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG.VID._DSM._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.PEG0.PEGP._DSM._OFF: /etc/switch/gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed

I used the second acpi call, first one didn't hide the nvidia gpu when using intel mode.

For the kernel, I'm using 5.6 (as seen in the inxi output), redin0s is using the 5.4 kernel, and the problem persists for him, so I will try to use a 5.5 kernel to see if the problem persists when using the 5.5 kernel. I will keep you updated when I have the results.

Update: I tried the 5.5 kernel, and no it did not fix the issue. I used dkms status and acpi calls for both kernels (5.5 and 5.6) are installed.

Update 2: Fixed optimus output, I was reposting the output of no-optimus.sh before this edit. Anyways it is now fixed.

hey it's me again, my concerns for the gpu still powered up are true, my laptop msi gs65 8rf has a led near the power button which turns orange when the nvidia gpu is being used and white when it is not, but it stays full on orange everytime, I will uninstall and try with the driver hybrid-prime and check if it does the same thing or not and if I gain on power consumption or not, power consumption is my main concern now, I would like the battery to last 4 hours, but I can't get more than 1:30.

UPDATE:
I don't know why or how, but I'm getting less power drain with the hybrid prime drivers, the orange light isn't turning white but now the estimated time has gone from 1:30 with full charge to 4:00 while at 60%

1 Like

Does the hybrid drivers affect your laptop's performance? Because less power drain often means less performance.

Optimus-switch on Intel mode works fine while booting into 4.19 kernel. I know this because I do not see any nVidia related info when I use PowerTop. I also noticed the temperatures were considerably lower and the battery remaining was showing higher numbers. However this is not the case when I login to 5.4 kernel. On Intel-mode I noticed that nVidia is not powering down and still shows up on PowerTop. Please note my inxi output below. It shows up in Audio but not in GPU or Graphics. Please help to fix this.

inxi - Fxxxza --no-host

System:    Kernel: 5.4.35-1-MANJARO x86_64 bits: 64 compiler: gcc v: 9.3.0 
           parameters: BOOT_IMAGE=/boot/vmlinuz-5.4-x86_64 root=UUID=5e0d9376-6c32-4a83-96f4-c9efc39f65fe rw 
           scsi_mod.use_blk_mq=1 nopti spectre_v2=off net.ifnames=0 rd.udev.log-priority=3 quiet apparmor=1 security=apparmor 
           udev.log_priority=3 
           Desktop: Xfce 4.14.2 tk: Gtk 3.24.13 info: xfce4-panel wm: xfwm4 dm: LightDM 1.30.0 Distro: Manjaro Linux 
Machine:   Type: Laptop System: Acer product: Aspire E5-575G v: V1.45 serial: <filter> 
           Mobo: Acer model: Ironman_SK v: V1.45 serial: <filter> UEFI: Insyde v: 1.45 date: 07/23/2018 
Battery:   ID-1: BAT1 charge: 17.2 Wh condition: 40.7/62.2 Wh (65%) volts: 10.9/11.1 model: PANASONIC AS16B5J type: Li-ion 
           serial: <filter> status: Discharging 
CPU:       Topology: Dual Core model: Intel Core i5-6200U bits: 64 type: MT MCP arch: Skylake family: 6 model-id: 4E (78) 
           stepping: 3 microcode: D6 L2 cache: 3072 KiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 19204 
           Speed: 760 MHz min/max: 400/2800 MHz Core speeds (MHz): 1: 636 2: 693 3: 684 4: 684 
           Vulnerabilities: Type: itlb_multihit status: KVM: Split huge pages 
           Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable 
           Type: mds mitigation: Clear CPU buffers; SMT vulnerable 
           Type: meltdown status: Vulnerable 
           Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl and seccomp 
           Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization 
           Type: spectre_v2 status: Vulnerable, IBPB: disabled, STIBP: disabled 
           Type: tsx_async_abort status: Not affected 
Graphics:  Device-1: Intel Skylake GT2 [HD Graphics 520] vendor: Acer Incorporated ALI driver: i915 v: kernel bus ID: 00:02.0 
           chip ID: 8086:1916 
           Display: x11 server: X.Org 1.20.8 driver: intel resolution: 1366x768~60Hz 
           OpenGL: renderer: Mesa Intel HD Graphics 520 (SKL GT2) v: 4.6 Mesa 20.0.5 direct render: Yes 
Audio:     Device-1: Intel Sunrise Point-LP HD Audio vendor: Acer Incorporated ALI driver: snd_hda_intel v: kernel 
           bus ID: 00:1f.3 chip ID: 8086:9d70 
           Device-2: NVIDIA GM107 High Definition Audio [GeForce 940MX] vendor: Acer Incorporated ALI driver: snd_hda_intel 
           v: kernel bus ID: 01:00.1 chip ID: 10de:0fbc 
           Sound Server: ALSA v: k5.4.35-1-MANJARO 
Network:   Device-1: Qualcomm Atheros QCA9377 802.11ac Wireless Network Adapter vendor: Lite-On driver: ath10k_pci v: kernel 
           port: 5040 bus ID: 03:00.0 chip ID: 168c:0042 
           IF: wlan0 state: up mac: <filter> 
           Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Acer Incorporated ALI Acer Aspire E5-575G 
           driver: r8169 v: kernel port: 3000 bus ID: 04:00.1 chip ID: 10ec:8168 
           IF: eth0 state: down mac: <filter> 
Drives:    Local Storage: total: 1.14 TiB used: 91.29 GiB (7.8%) 
           ID-1: /dev/sda vendor: HGST (Hitachi) model: HTS721010A9E630 size: 931.51 GiB block size: physical: 4096 B 
           logical: 512 B speed: 6.0 Gb/s rotation: 7200 rpm serial: <filter> rev: A3J0 scheme: MBR 
           ID-2: /dev/sdb vendor: SK Hynix model: HFS256G39TND-N210A size: 238.47 GiB block size: physical: 4096 B 
           logical: 512 B speed: 6.0 Gb/s serial: <filter> rev: 1P10 scheme: GPT 
Partition: ID-1: / raw size: 115.05 GiB size: 112.74 GiB (97.99%) used: 91.29 GiB (81.0%) fs: ext4 dev: /dev/sdb4 
           ID-2: swap-1 size: 7.87 GiB used: 0 KiB (0.0%) fs: swap swappiness: 60 (default) cache pressure: 100 (default) 
           dev: /dev/sdb3 
Sensors:   System Temperatures: cpu: 50.0 C mobo: N/A 
           Fan Speeds (RPM): N/A 
Info:      Processes: 171 Uptime: 10m Memory: 7.65 GiB used: 1.23 GiB (16.1%) Init: systemd v: 244 Compilers: gcc: 9.3.0 
           Shell: bash v: 5.0.16 running in: xfce4-terminal inxi: 3.0.37 

mhwd -li

> Installed PCI configs:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
    video-nvidia-430xx            2019.10.25               false            PCI


Warning: No installed USB configs!

no-optimus.sh

if [ -d "/sys/bus/pci/devices/0000:01:00.0" ]
then
  sleep 10
  #echo '\_SB.PCI0.GFX0._DSM' > /proc/acpi/call 
  echo '\_SB_.PCI0.RP01.PXSX._DSM' > /proc/acpi/call
  echo -n 1 > '/sys/bus/pci/devices/0000:01:00.0/remove' 

fi

dkms status

acpi_call, 1.1.0, 4.19.118-1-MANJARO, x86_64: installed
acpi_call, 1.1.0, 5.4.35-1-MANJARO, x86_64: installed

edit /etc/switch/intel/no-optimus.sh and comment out the above line, make sure you set intel mode again after the edit to apply the changes and reboot. this still allows for the gpu to be turned off but the gpu should show 0% power usage in powertop . this way you can see if the gpu is actually powered down or not and if it's not then run the gpu_switch_check.sh script as root and try checking powertop again to see if it powered down, also post the output of that script (sometimes there is more than 1 acpi call that "Works!"

make sur

I followed the steps suggested by you. Commented out the line and set intel mode again and reboot. It was not powerdown...so executed gpu_switch_check.sh. Unfortunately it does not seem to power down the nVidia card.

no-optimus.sh

if [ -d "/sys/bus/pci/devices/0000:01:00.0" ]
then
  sleep 5
  #echo '\_SB.PCI0.GFX0._DSM' > /proc/acpi/call 
  echo '\_SB_.PCI0.RP01.PXSX._DSM' > /proc/acpi/call
  #echo -n 1 > '/sys/bus/pci/devices/0000:01:00.0/remove' 

fi

Powertop

The battery reports a discharge rate of 11.7 W
The power consumed was 233 J
System baseline power is estimated at 10.8 W

Power est.    Usage     Device name
  4.83 W    100.0%        USB device: 2.4G Receiver (Compx)
              0.0 pkts/s  Network interface: eth0 (r8169)
  1.00 W     18.5%        CPU misc
            100.0%        Radio device: ath10k_pci
  278 mW     18.5%        CPU core
  250 mW     18.5%        DRAM
            100.0%        Radio device: acer-wmi
              0.6 pkts/s  Network interface: wlan0 (ath10k_pci)
    0 mW    100.0%        USB device: xHCI Host Controller
    0 mW    100.0%        Radio device: acer-wmi
    0 mW    100.0%        Radio device: btusb
    0 mW      9.6%        Display backlight
    0 mW      0.0%        Audio codec hwC0D0: Realtek
            100.0%        PCI Device: Qualcomm Atheros QCA9377 802.11ac Wireless Network Adapter
            100.0%        PCI Device: Intel Corporation Sunrise Point-LP PCI Express Root Port #11
            100.0%        PCI Device: Intel Corporation Device 9d1b
            100.0%        PCI Device: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers
            100.0%        PCI Device: Intel Corporation Sunrise Point-LP SATA Controller [AHCI mode]
            100.0%        PCI Device: Intel Corporation Sunrise Point-LP PCI Express Root Port #1
            100.0%        PCI Device: NVIDIA Corporation GM107 [GeForce 940MX]
            100.0%        PCI Device: NVIDIA Corporation GM107 High Definition Audio Controller [GeForce 940MX]
            100.0%        PCI Device: Intel Corporation Sunrise Point-LP Thermal subsystem
            100.0%        PCI Device: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller
            100.0%        PCI Device: Realtek Semiconductor Co., Ltd. RTL8411B PCI Express Card Reader
            100.0%        PCI Device: Intel Corporation Skylake GT2 [HD Graphics 520]

gpu_switch_check.sh

Trying \_SB.PCI0.P0P1.VGA._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.P0P2.VGA._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.OVGA.ATPX: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.OVGA.XTPX: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.P0P3.PEGP._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.P0P2.PEGP._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.P0P1.PEGP._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.MXR0.MXM0._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG1.GFX0._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG0.GFX0.DOFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG1.GFX0.DOFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG0.PEGP._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.XVR0.Z01I.DGOF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEGR.GFX0._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG.VID._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG0.VID._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.P0P2.DGPU._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.P0P4.DGPU.DOFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.IXVE.IGPU.DGOF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.RP00.VGA._PS3: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.RP00.VGA.P3MO: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.GFX0.DSM._T_0: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.LPC.EC.PUBS._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.P0P2.NVID._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.P0P2.VGA.PX02: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.PEGP.DGFX._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.VGA.PX02: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG0.PEGP.SGOF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.AGP.VGA.PX02: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG0.PEGP._DSM: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.RP01.PEGP._DSM: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.GFX0._DSM: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
works!
Trying \_SB_.PCI0.RP01.PXSX._DSM: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
works!
Trying \_SB.PCI0.PEG.VID._DSM: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.PEG0.PEGP._DSM: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.AGP.VGA.PX02: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG0.PEGP._DSM_OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.RP01.PEGP._DSM_OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.GFX0._DSM_OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.RP01.PXSX._DSM_OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG.VID._DSM_OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.PEG0.PEGP._DSM_OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.AGP.VGA.PX02._DSM_OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG0.PEGP._DSM._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.RP01.PEGP._DSM._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.GFX0._DSM._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.RP01.PXSX._DSM._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB.PCI0.PEG.VID._DSM._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed
Trying \_SB_.PCI0.PEG0.PEGP._DSM._OFF: gpu_switch_check.sh: line 63: warning: command substitution: ignored null byte in input
failed

This seems to be working perfectly fine when I boot in to 4.19 as can be seen from the output of Powertop

The battery reports a discharge rate of 7.70 W
The power consumed was 0.00 J
System baseline power is estimated at 12.4 W

Power est.    Usage     Device name
  5.03 W    100.0%        USB device: 2.4G Receiver (Compx)
              0.0 pkts/s  Network interface: eth0 (r8169)
  1.29 W     72.5%        CPU misc
  954 mW     72.5%        CPU core
            100.0%        Radio device: ath10k_pci
  519 mW     62.9%        Audio codec hwC0D0: Realtek
  264 mW     72.5%        DRAM
            100.0%        Radio device: acer-wmi
              0.0 pkts/s  Network interface: wlan0 (ath10k_pci)
    0 mW    100.0%        USB device: xHCI Host Controller
    0 mW    100.0%        Radio device: btusb
    0 mW    100.0%        Radio device: acer-wmi
    0 mW      9.6%        Display backlight
            100.0%        PCI Device: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers
            100.0%        PCI Device: Qualcomm Atheros QCA9377 802.11ac Wireless Network Adapter
            100.0%        I2C Device (i2c-SYNA7DB5:00): SYNA7DB5:00
            100.0%        PCI Device: Intel Corporation Device 9d1b
            100.0%        PCI Device: Intel Corporation Sunrise Point-LP PCI Express Root Port #11
            100.0%        PCI Device: Intel Corporation Sunrise Point-LP SATA Controller [AHCI mode]
            100.0%        PCI Device: Realtek Semiconductor Co., Ltd. RTL8411B PCI Express Card Reader
            100.0%        PCI Device: Intel Corporation Skylake GT2 [HD Graphics 520]
            100.0%        PCI Device: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller
            100.0%        PCI Device: Intel Corporation Sunrise Point-LP Thermal subsystem
             65.7%        PCI Device: Intel Corporation Sunrise Point-LP HD Audio
              0.0%        Audio codec hwC0D2: Intel

I just installed Manjaro Gnome 20 on new ssd on Lenovo P50.
will write here what I do
MHWD suggested to install prime nvidia 440 which I know is wrong because my Fermi card is not supported by nvidia 440, yes no second screen was visible. Installing nvidia 390 with bumblebee, no second screen again, nvidia wanted to run sudo nvidia-xconfig when I did it and restarted no second screen and resolution breaks it is now only 960x540 on main display.
removing bumblebee
trying only nvidia390xx
after restart only second screen is active, internal not in nvidia menu, when I disconnect cable no internal screen when connect back both are black.
My solution for two displays (I do not care if I run all the time on NVIDIA I just do not want to switch it in BIOS)
Installed nvidia430xx deleted from /etc/X11 everything what mentioned nvidia, reboot I have two displays, disconnect HDMI, connect works.

if it works with 4.19 then use 4.19 unless there is some specific reason to use 5.4, 4.19 is still an lts kernel and is still maintained.

Forum kindly sponsored by