Problem Switching Graphic Cards With bbswitch

Goal:

Connect to my TV via HDMI while my laptop is running on Nvidia dGPU.

What I’ve Tried Already:

  1. I’ve followed all the instructions in this guide, I believe I haven’t missed any step.
  2. I’ve used the nouveau switching mode in the optimus-manager-qt app and everytime I try to swtich to Nvidia/Hybrid, nothing happens, I just log back with Intel mode.
  3. I tried different settings as mentioned in this atricle.

The Problem:

As nouveau didn’t work I though I’d try using bbswitch. This is where I messed up, I ignorantly installed the linux414-bbswitch package instead of linux58-bbswitch as @XRaTiX pointed. (You can look at the whole incident in towards the end of this post I made recently).

However, when I uninstalled linux414 package and installed linux58, my system would just boot to the company logo, and it just freezes(I can’t open any tty session, I’ve tried all function keys).

I’ve even tried installing linux58 while keeping the linux414 package and it still doesn’t boot into a display.

Logs:

Here are some interesting logs, that might help, happy to share anything else if necessary.

>>> sudo prime-run nvidia-settings

ERROR: NVIDIA driver is not loaded


ERROR: Unable to load info from any available system

For some reason, inxi -G, prints that the driver for nvidia is nouveau although I have hybrid-prime-450xx:

>>> inxi -G                                                                  
Graphics:
  Device-1: Intel UHD Graphics 630 driver: i915 v: kernel 
  Device-2: NVIDIA GP107M [GeForce GTX 1050 Mobile] driver: nouveau 
  v: kernel 
  Device-3: Chicony HP Wide Vision HD type: USB driver: uvcvideo 
  Display: x11 server: X.org 1.20.8 driver: modesetting 
  resolution: <xdpyinfo missing> 
  OpenGL: renderer: Mesa Intel UHD Graphics 630 (CFL GT2) v: 4.6 Mesa 20.1.7

As mhwd shows, I have 450xx

>>> mhwd -li                                                                 
> Installed PCI configs:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
video-hybrid-intel-nvidia-450xx-prime            2019.10.25               false            PCI
     video-modesetting            2020.01.13                true            PCI
           video-linux            2018.05.04                true            PCI


Warning: No installed USB configs!
>>>  pacman -Qqs nvidia                                                      
lib32-libvdpau
lib32-nvidia-450xx-utils
libvdpau
libxnvctrl
linux414-nvidia-450xx
mhwd-nvidia-340xx
mhwd-nvidia-390xx
mhwd-nvidia-418xx
mhwd-nvidia-430xx
mhwd-nvidia-435xx
mhwd-nvidia-440xx
mhwd-nvidia-450xx
nvidia-450xx-utils
nvidia-prime
xf86-video-nouveau

I’ll add more logs in a new comment. @michaldybczak please help!

>>> inxi -Fazy                                                            [1]
System:
  Kernel: 5.8.6-1-MANJARO x86_64 bits: 64 compiler: N/A 
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.8-x86_64 
  root=UUID=56d77d09-dec0-4408-b59c-9e65207adba1 rw quiet apparmor=1 
  security=apparmor resume=UUID=8a55e655-a595-4619-847e-091f12bb98da 
  udev.log_priority=3 
  Desktop: GNOME 3.36.6 tk: GTK 3.24.23 wm: gnome-shell dm: GDM 3.36.3 
  Distro: Manjaro Linux 
Machine:
  Type: Laptop System: HP product: HP Pavilion Notebook v: N/A 
  serial: <filter> Chassis: type: 10 serial: <filter> 
  Mobo: HP model: 84F8 v: 08.11 serial: <filter> UEFI: AMI v: F.29 
  date: 07/17/2020 
Battery:
  ID-1: BAT0 charge: 39.3 Wh condition: 52.7/52.7 Wh (100%) volts: 11.2/11.6 
  model: HP Primary type: Li-ion serial: N/A status: Discharging 
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: D6 
  L2 cache: 9216 KiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx 
  bogomips: 52815 
  Speed: 900 MHz min/max: 800/4100 MHz Core speeds (MHz): 1: 900 2: 900 3: 900 
  4: 900 5: 900 6: 900 7: 900 8: 901 9: 900 10: 900 11: 900 12: 900 
  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: 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: srbds mitigation: Microcode 
  Type: tsx_async_abort status: Not affected 
Graphics:
  Device-1: Intel UHD Graphics 630 vendor: Hewlett-Packard driver: i915 
  v: kernel bus ID: 00:02.0 chip ID: 8086:3e9b 
  Device-2: NVIDIA GP107M [GeForce GTX 1050 Mobile] vendor: Hewlett-Packard 
  driver: nouveau v: kernel bus ID: 01:00.0 chip ID: 10de:1c8d 
  Device-3: Chicony HP Wide Vision HD type: USB driver: uvcvideo bus ID: 1-6:4 
  chip ID: 04f2:b56d 
  Display: x11 server: X.org 1.20.8 compositor: gnome-shell 
  driver: modesetting resolution: <xdpyinfo missing> 
  OpenGL: renderer: Mesa Intel UHD Graphics 630 (CFL GT2) v: 4.6 Mesa 20.1.7 
  direct render: Yes 
Audio:
  Device-1: Intel Cannon Lake PCH cAVS vendor: Hewlett-Packard 
  driver: snd_hda_intel v: kernel alternate: snd_soc_skl,snd_sof_pci 
  bus ID: 00:1f.3 chip ID: 8086:a348 
  Sound Server: ALSA v: k5.8.6-1-MANJARO 
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet 
  vendor: Hewlett-Packard driver: r8169 v: kernel port: 4000 bus ID: 02:00.0 
  chip ID: 10ec:8168 
  IF: eno1 state: down mac: <filter> 
  Device-2: Realtek RTL8822BE 802.11a/b/g/n/ac WiFi adapter 
  vendor: Hewlett-Packard driver: rtw_8822be v: N/A modules: rtw88_8822be 
  port: 3000 bus ID: 03:00.0 chip ID: 10ec:b822 
  IF: wlo1 state: up mac: <filter> 
Drives:
  Local Storage: total: 585.00 GiB used: 43.94 GiB (7.5%) 
  SMART Message: Required tool smartctl not installed. Check --recommends 
  ID-1: /dev/sda vendor: Samsung model: MZNLN128HAHQ-000H1 size: 119.24 GiB 
  block size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s serial: <filter> 
  rev: 3H3Q scheme: GPT 
  ID-2: /dev/sdb vendor: Crucial model: CT500MX500SSD1 size: 465.76 GiB 
  block size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s serial: <filter> 
  rev: 023 scheme: GPT 
RAID:
  Hardware-1: Intel 82801 Mobile SATA Controller [RAID mode] driver: ahci 
  v: 3.0 port: 6060 bus ID: 00:17.0 chip ID: 8086.282a rev: 10 
Partition:
  ID-1: / raw size: 205.27 GiB size: 201.55 GiB (98.19%) 
  used: 43.94 GiB (21.8%) fs: ext4 dev: /dev/sdb4 
Swap:
  Kernel: swappiness: 60 (default) cache pressure: 100 (default) 
  ID-1: swap-1 type: partition size: 4.00 GiB used: 0 KiB (0.0%) priority: -2 
  dev: /dev/sdb3 
Sensors:
  System Temperatures: cpu: 40.0 C mobo: N/A gpu: nouveau temp: 36 C 
  Fan Speeds (RPM): N/A 
Info:
  Processes: 350 Uptime: 36m Memory: 7.59 GiB used: 2.26 GiB (29.8%) 
  Init: systemd v: 246 Compilers: gcc: 10.2.0 Packages: 1288 pacman: 1285 
  lib: 308 flatpak: 0 snap: 3 Shell: Zsh v: 5.8 running in: gnome-terminal 
  inxi: 3.1.05 

As said in other thread, unistall:

video-linux 

Try switching, notice date stamps and then check logs:

journalctl -b -p3

journalctl -u optimus-manager.service

journalctl -u gdm.service

Xorg log at /var/log/Xorg.xxx.log or ~/.local/share/xorg/Xorg.xxx.log .

Kernel logs : journalctl -k

I assume, you switched to gdm-prime?

Okay, I’ve just uninstalled video-linux, here’s mhwd -li now:

> Installed PCI configs:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
video-hybrid-intel-nvidia-450xx-prime            2019.10.25               false            PCI
     video-modesetting            2020.01.13                true            PCI


Warning: No installed USB configs!

I didn’t try swtiching yet, but journalctl -b -p3 shows a ton ACPI BIOS ERRORS.

Try setting ACPI kernel arguments. I can’t find the proper post on the archived forum, so I’m copying from my notices:

How to Choose the Proper ACPI Kernel Argument

The introduction of Optimus laptops have created new challenges for Linux users. One of the biggest issues is having the proprietary graphics card work when the system boots. Many times the advice given is to add an Advanced Configuration and Power Interface (acpi ) kernel parameter to grub. While a specific acpi kernel parameter may be given, it is sometimes not appropriate to the hardware it is being applied to. This can cause system instability and some functions of the laptop to not work properly. Once the user does find a parameter that works, they are told to add it to their grub config file so it will be automatically load at boot. This can cause its own problems. If the user does not use the proper syntax when adding this parameter, it will be ignored and not work. Let’s take a look at how to choose the proper acpi kernel parameter and then how to properly add it to the grub config file.

Before you decide which acpi kernel parameter you need, you have to ask yourself one question.

Do I even need an acpi kernel parameter?

Short of digging through logs and looking for acpi errors, there are several ways to see if an acpi kernel parameter is needed.

This is probably the easiest way to tell if you need an acpi kernel parameter. This problem can be seen whether you are running Linux from a Live USB or it is installed to a local hard drive. When you shut down your computer and it hangs before shutting down, or it hangs and you have to push the power button to shut it down, you may need an acpi kernel parameter.

You are using an Optimus laptop and you have installed the nVidia proprietary driver. You boot your laptop and it hangs on the following steps

a. “Started TLP system startup/shutdown”
b. “reached target graphical interface”
c. An error message about configuring “Backlight”
d. Your laptop just boots to a black screen and the fans start to run constantly.

If any of these behaviors are noticed, you may need to add the acpi kernel parameter.

This requires a little more effort on the user. Press “E” on the grub screen and remove the “quiet” kernel parameter before you boot your computer. As your computer boots, you will be presented with a list of what is being loaded. Before the kernel starts loading, it does a quick hardware check. If it has a problem with powering up any hardware, it will list an acpi error. If you see an acpi error, you may need an acpi kernel parameter.
Choosing an acpi kernel parameter.

The bios or UEFI in use by your laptop looks for certain “identifiers” in how to handle your hardware based on the Operating System (OS) it was designed to operate. It does this through acpi “calls” from the operating system to the bios. When you see problems such as listed above, that means the bios does not understand the calls being sent to it by the OS. The good thing is, since acpi used by both Windows and Linux follow the UEFI specifications1, they both use the same OSI strings to identify what OS is used. Unlike the Windows kernel, the Linux kernel can determine what “power calls” are sent to the bios by the use of these OSI Strings in the acpi kernel parameter. By adding these parameters, you can basically tell Linux to “mimic” the acpi calls sent by another OS.

When you purchased your laptop, it probably came with Windows pre-installed. The version of Windows that was installed is your first clue in figuring out which OSI String your acpi kernel parameter needs. From Windows 2000 to Windows 8.1, you can use the Windows release name to find the OSI String you should use. Windows 10, however, since it uses a “rolling release” model, finding the OSI String you need to use requires a little more work. To find your Windows install’s version number, open a command prompt in Windows and type, winver . This will give your Windows version in the following manner, Windows 10 version 1607 . That is the information you need to determine the OSI String your kernel parameter needs.

Once you have your version of Windows, use the below chart to find how your version of Windows needs to be represented in the kernel parameter.

OSI Arguments for Windows 2

OSI String Target OS
Windows 2000 Windows 2000
Windows 2001 Windows XP
Windows 2001 SP1 Windows XP SP1
Windows 2001.1 Windows Server 2003
Windows 2001 SP2 Windows XP SP2
Windows 2001.1 SP1 Windows Server 2003 SP1
Windows 2006 Windows Vista
Windows 2006 SP1 Windows Vista SP1
Windows 2006.1 Windows Server 2008
Windows 2009 Windows 7, Win Server 2008 R2
Windows 2012 Windows 8, Win Server 2012
Windows 2013 Windows 8.1
Windows 2015 Windows 10
Windows 2016 Windows 10, version 1607
Windows 2017 Windows 10, version 1703
Windows 2017.2 Windows 10, version 1709
Windows 2018 Windows 10, version 1803
Windows 2018.2 Windows 10, version 1809
Once you have your OSI string, you now have all the information needed for your kernel parameter.

To have Linux mimic your version of Windows, you need to add the following kernel parameter, acpi_osi='OSI String’3

Examples

Windows 7 - acpi_osi=‘Windows 2009’

Windows 10 ver. 1709 – acpi_osi=‘Windows 2017’

You will notice that Windows 10 version 1709 has an OSI String of Windows 2017.2 and I used Windows 2017 instead. In my testing, I found that Windows 2017.2 was not recognized as a valid argument.

Note on acpi_osi=!

This argument disables all vendor strings that maybe present. It should only be used if one of the above OSI strings does not work on its own. If you use it when it is not needed, you maybe able to boot without any acpi errors, but your touchpad or wifi will not work. It also must be used in combination one of the above OSI strings.

Example

acpi_osi=! acpi_osi=‘Windows 2012’

This will disable all the vendor strings and then tell the kernel to “mimic” Windows 8 when it talks to the bios.

Note for Dell Laptops

Sometimes the above kernel parameters will not work properly on some Dell laptops. If that is the case, you can try the following: acpi_rev_override=# Replace the “#” with a number between 1 to 5. In order to have this kernel parameter applied properly, cold booting (shutting your system down completely before restarting) your laptop twice may be required.

Adding the acpi kernel to grub

Once you have found the kernel argument that works the best for your hardware, you need to add it to grub in order to have it applied every time you boot your system. This is easier than it sounds. The problem most users have is syntax or how to type it on the appropriate line. They key to having the argument recognized is to only use “single quotes”, or as we call them in the United States, the apostrophe.

To add the argument to grub, open a terminal, and type the following:

sudo nano /etc/default/grub

Add the kernel argument to the following line: GRUB_CMDLINE_LINUX_DEFAULT .

Example

GRUB_CMDLINE_LINUX_DEFAULT=“acpi_osi=‘Windows 2018’ rd.udev.log-priority=3 bootsplash.bootfile=bootsplash-themes/manjaro/bootsplash nvme_core.default_ps_max_latency_us=5500”
or

GRUB_CMDLINE_LINUX_DEFAULT=“acpi_rev_override=1 acpi_backlight=vendor quiet splash resume=/dev/sda4 resume_offset=1363968”
ctrl+x to exit and “Y” to save.

sudo update-grub

Now your kernel argument has been added to grub and will be loaded every time you boot your laptop.

This is by no means an exhaustive guide in the use of acpi kernel parameters. That would require a much longer document. Instead it gives some basic instructions that one can follow to get their system up and running. If you are still having acpi issues, and need help solving it, there are a couple of options open to you. First off, search the forum to see if your problem has been solved before. If that does not solve your issue, create a new support thread on the forum discussing your issue.

Sources

1 https://uefi.org/specifications 1

2 How to Identify the Windows Version in ACPI by Using _OSI - Windows drivers | Microsoft Docs 3

3 https://www.kernel.org/doc/Documentation/admin-guide/kernel-parameters.txt 9

1 Like

Also, if I try switching now (after uninstalling video-linux), using nouveaue switching, I get this warning:
ss

I noticed that MHWD generally struggles with uninstallation. So to fix it, uninstall all mhwd configurations:

video-modesetting 

and

video-hybrid-intel-nvidia-450xx-prime

and then install your drivers again by using:

sudo mhwd -a pci nonfree 0300

All in the same session. Once you are done, reboot. In my experience, this usually fixes are pains with drivers. However, you must go later through driver configs, as showed on the optimus-manager guide and check if conf’s aren’t brought back. If so, disable them again, so they wouldn’t conflict with optimus-manager.

Alright, this might take more than a couple minutes, and it’s pretty late right now, I will read the ACPI params you’ve put and reinstall all drivers tomorrow. Would you mind if I sent you a DM if I get busy and can’t continue tomorrow?

I’ve had too many bad experiences already to do this once again :sweat:

DM? Meaning? For me DM is Display Manager. Did you mean PM (Private Message)? The thing is, I have a huge project before me and I probably won’t have time to check forums. I will be working 10-11 hours per day for a while, so helping others on forum won’t be possible, so I can’t promise anything.

Just tried adding the ACPI parameter but I’m still getting the same errors, used this link, I’m running Windows 10, version 2004, so I used acpi_osi='Windows 2020'.

All the errors are of this kind:

ACPI BIOS Error (bug): Failure creating named object [\_SB.PCI0.XHC.RHUB.GPLD], AE_ALREre creating named object [\_SB.PCI0.XHC.RHUB.GPLD], AE_ALREADY_EXISTS (20200528/dswload2-326)
ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20200528/psobject-220)

Also, the last few lines of journalctl show:

Oct 01 02:12:18 studio systemd-modules-load[302]: Failed to find module 'nvidia'
Oct 01 02:12:18 studio systemd-modules-load[302]: Failed to find module 'nvidia-drm'
Oct 01 02:12:20 studio kernel: nouveau 0000:01:00.0: disp: chid 0 mthd 008c data 00000000 0000508c 0000102c
Oct 01 02:12:20 studio systemd-udevd[429]: could not read from '/sys/module/pcc_cpufreq/initstate': No such device
Oct 01 02:12:25 studio bluetoothd[986]: Failed to set mode: Blocked through rfkill (0x12)
Oct 01 02:12:30 studio gdm-password][1455]: gkr-pam: unable to locate daemon control file

Well, some errors are just from hardware and you can’t do much about it. I also have some errors and live with them - I see no consequences anyway.

ACPI errors happen quite often, and they can manifest in various ways, so this could impact a small, not noticeable thing. You can try google the error, maybe something can be done. If not, ignore it.

Those should walk away when you reinstall all driver configurations.

Oct 01 02:12:25 studio bluetoothd[986]: Failed to set mode: Blocked through rfkill (0x12)

Some bluetooth issue, not relevant here. May be a minor issue.

studio gdm-password][1455]: gkr-pam: unable to locate daemon control file

This sounds suspicious. Optimus-manager uses DM to switch between sessions and during the switch DM should ask for password. If that can’t work, DM may be erroring out and that conflicts with optinus-manager. Of course, it may be also some minor issue that has no important consequences. At this moment I have only suspicions and I may be wrong. Google it.

I ask again, did you install gdm-prime? It’s needed for optimus-manager with gdm.

As a side note, even if you have gdm-prime, it often hangs in a black screen. GDM in general works badly with optimus-manager.

Yes, I do have it installed:

Do I need to have libgdm-prime as well? I don’t remember seeing that anywhere.
I’ve always ignored ACPI errors, ever since I had Ubuntu installed as I never really faced a problem, and I haven’t faced any practical issue on Manjaro either, so I’m going to ignore them.

Yeah, probably it’s good to install libgdm-prime. Without it, gdm-prime will work like usual gdm, at least this is how I understand it.

Okay, installing it now. About reinstalling the graphic drivers, do you think using the manjaro settings GUI app would do? Or there a cleaner method?

Terminal is usually more talkative, so if something is wrong, you get more answers there. Basically:

sudo mhwd -r pci video-nvidia (or name of the any driver you wish to uninstall)

and then use the:

sudo mhwd -a pci nonfree 0300

to install the newest drivers automatically.

To be precise, that what you see on the list are not drivers per se. Those are DRIVER CONFIGURATIONS, so they contain one or more drivers, plus proper packages plus proper configs that are already set so the whole should work.

In Manjaro it’s best to use mhwd for those operations. Manual actions usually break things. So learn about mhwd and use it, either by UI or terminal. As said, terminal is usually more informative but you can use whatever you prefer.

Done. journalctl still outputs this though:

Oct 01 02:59:14 studio kernel: nouveau 0000:01:00.0: disp: chid 0 mthd 008c data 00000000 0000508c 0000102c
Oct 01 02:59:18 studio bluetoothd[935]: Failed to set mode: Blocked through rfkill (0x12)
Oct 01 02:59:24 studio gdm-password][1462]: gkr-pam: unable to locate daemon control file

Also I tried switching GPUs using nouveau, but no result, I just get logged out and see the company logo.

Sorry, don’t have more time today. If you try all possible ways to fix it, uninstall optimus-manager, revert configs to active state and try optimus-switch. It’s more basic but also less prone to issues because it switches cards during reboot, not during session switch, so DM doesn’t come into play here.

I have moved the 90-mhwd.conf to a .bak file. And this is what I have in /etc/X11:

.  ..  mhwd.d  xinit  xorg.conf.d

Should I touch any of the other two? Switching doesn’t work even now.

Oh my god, it’s working!

But it’s a workaround of sorts, when I switch I hit the company logo, but then if I open tty1 it opens the login screen~

1 Like

So GDM is still malfunctioning, but at least it’s not a show stopper now.

1 Like