Installing OpenSuse Tumbleweed on an AMD Ryzen7 laptop with NVidia graphics

I recently bought a laptop with an AMD Ryzen7 4800H with hybrid graphics (Radeon and NVidia GTX 1650 Ti) and installed OpenSuse Tumbleweed.

I chose Tumbleweed over Leap 15.2 as I experienced serious issues with the older kernel shipped with 15.2. The system was not stable at all. Tumbleweed had kernel 5.9 at that time and currently runs 5.10 which works fine for the Ryzen CPU.

Basically everything worked out of the box with the exception of the proprietary graphics driver which is of course not installed by default. The rest of this artical describes the things I had to do to get everything working.

I have chosen this hardware combination since I wanted a powerful AMD Ryzen laptop CPU with powerful 3D graphics while still being small enough. I wanted to have a dedicated Radeon graphics to avoid proprietary nvidia drivers (which makes it hard to track down and fix stability issues), but there weren't any offers available so I opted for a NVidia card.

Since I don't care for battery time I choose to always use the dedicated graphics card. Otherwise I would have just used the integrated Radeon graphics of the 4800H CPU, which is reasonable fast for normal using.

Installation

First I booted and installed OpenSuse Tumbleweed from a current DVD image (on USB drive of course). During installation I chose NOT to install the nouveau driver since it did not really support the GTX 1650 Ti anyway and I want to use the proprietary driver.

At this point the integrated Radeon graphics should just work with AMDGPU driver.

I have added the nvidia repo to the opensuse repositories and install the package nvidia-glG05 and suse-prime. The later is for selecting which graphics card to use.

After a reboot, I ran

prime-select

to select the nvidia card for the main graphics card.

At this point, everything runs as expected. The CPU is fully supported by the kernel, WiFi/Bluetooth works, sound as well and the 3D driver is running fine.

Remaining issues

Hibernation

While suspend (to ram) worked out-of-the box, hibernate (or suspend to disk) did not work. The following steps are necessary to enable it: After reboot you should be able to select hibernate from the lockin/lockout screen, but you can try it out manually be executing
systemctl hibernate

HDMI audio

Another thing which did not work directly was audio output over HDMI. Turned out the reason why it wasn't working was the prime-select package I have installed to be able to switch to the dedicated graphics cards. Otherwise it would probably just worked.

The reason why it was not working was a special udev rule set that have been installed by the package prime-select. To be able to disabled the dedicated graphics card on demand to reduce power usage and therefore increase battery time, the nvidia audio and usb devices had to be removed. Of course, since the audio device is removed, HDMI audio does not work.

I prefer to have HDMI audio working and don't care about battery life time, so I hat to remove the udev rule. One way is to deinstall the "prime-select" tool but I am not sure if this have some side effect for the nvidia driver. So I decided to just remove the udev file. Of course, whenever the prime-select package is updated, I have to remove it again.

For reference, the udev rule in question is the file

/usr/lib/udev/rules.d/90-nvidia-udev-pm*

USB autosuspend

Another minor issue is the USB autosuspend feature of the linux kernel. It has nothing to do with the opensuse installation itself, but this is something one might want to disable to be able to charge USB devices even if they are not in used.

You can disabled the power suspend individually for each USB device by writing "-1" into the autosuspend file in the /sys/ filesystem:

echo -1 >/sys/devices/pci0000:00/0000:00:1a.0/usb3/power/autosuspend
(of course adjust the address to the correct address of your device).

You can also disable it completely for all newly connected devices by writing "-1" to the file of the usbcore module:

echo -1 >/sys/module/usbcore/parameters/autosuspend
And you can also add a kernel parameter to disable it on startup:
usbcore.autosuspend=-1
Of course this will reduce battery life time a bit.

Final notes

One issue left is the use of hybrid graphics. In theory it should be possible to use the Radeon graphics as default and only use the NVidia on demand. For some little time I tried to play around with xrandr and the graphics provider settings but with no success. However, I do not care about this feature as I wanted to have a dedicated graphics anyway and the systems runs on main power most of the time.
tags: opensuse2 tumbleweed1
newer (2021-03-16): Code completion for emacs with LSP
older (2019-10-20): Terminal alternatives on Linux