Troubleshooting Graphics Issues with Kali Linux 2019.2 on an Inspiron 11 3180 (AMD A6-9220e Radeon R4)


It's time to refresh Kali on the systems I take down to DEF CON each year and I was surprised to see Kali didn't "just work" out of the box on my inspiron 3180 like it has in the past. In troubleshooting the issue it appears that there is kernel issue that can cause graphical issues like freezing, flickering and black screen in Linux kernel 4.19 (used by Kali 2019.2).

References

Symptoms

Installation of Kali using the GUI installer worked without issue for me. After logging in to the desktop I found that I could successfully open any number of terminals and work for an hour or so without issue. After an hour the screen would freeze with the exception of the mouse cursor. I can also replicate the behavior by trying to load Firefox at any time.

When the screen freezes I can force a refresh by pressing Ctrl-Alt-F2 followed by Ctrl-Alt-F7 (you might have to do this a couple times for the screen to actually refresh). Clearly this is a sub-optimal way of navigating the desktop in Linux :)

In looking at the logs this one stood out:

# dmesg | grep gpu
[    3.184858] [drm] amdgpu kernel modesetting enabled.
[    3.192646] fb: switching to amdgpudrmfb from EFI VGA
[    3.194127] amdgpu 0000:00:01.0: kfd not supported on this ASIC
[    3.194235] amdgpu 0000:00:01.0: VRAM: 80M 0x000000F400000000 - 0x000000F404FFFFFF (80M used)
[    3.194237] amdgpu 0000:00:01.0: GART: 1024M 0x0000000000000000 - 0x000000003FFFFFFF
[    3.194524] [drm] amdgpu: 80M of VRAM memory ready
[    3.194526] [drm] amdgpu: 2917M of GTT memory ready.
[    3.194545] [drm] GART: num cpu pages 262144, num gpu pages 262144
[    3.194736] amdgpu 0000:00:01.0: firmware: direct-loading firmware amdgpu/stoney_pfp.bin
[    3.194761] amdgpu 0000:00:01.0: firmware: direct-loading firmware amdgpu/stoney_me.bin
[    3.194781] amdgpu 0000:00:01.0: firmware: direct-loading firmware amdgpu/stoney_ce.bin
[    3.194805] amdgpu 0000:00:01.0: firmware: direct-loading firmware amdgpu/stoney_rlc.bin
[    3.194932] amdgpu 0000:00:01.0: firmware: direct-loading firmware amdgpu/stoney_mec.bin
[    3.196170] amdgpu 0000:00:01.0: firmware: direct-loading firmware amdgpu/stoney_sdma.bin
[    3.196504] amdgpu 0000:00:01.0: firmware: direct-loading firmware amdgpu/stoney_uvd.bin
[    3.197023] amdgpu 0000:00:01.0: firmware: direct-loading firmware amdgpu/stoney_vce.bin
[    3.226506] [drm:construct [amdgpu]] *ERROR* construct: Invalid Connector ObjectID from Adapter Service for connector index:2! type 0 expected 3
[    3.376696] fbcon: amdgpudrmfb (fb0) is primary device
[    3.429686] amdgpu 0000:00:01.0: fb0: amdgpudrmfb frame buffer device
[    3.445534] [drm] Initialized amdgpu 3.27.0 20150101 for 0000:00:01.0 on minor 0

Detour

I found a number of resources online that seemed to point me to configuring specific kernel options to address the freezing/flickering behavior I was experiencing (Specifically: amdgpu.dc=0 amdgpu.dpm=0), but neither of those options worked on my system. There seems to be an issue with Kernel 4.19 and AMD Stoney Ridge. These settings held off the behavior for a time, but it always returned.

The solution required a more invasive change to my system.

Solution

After searching for hours I found someone was able to address the behavior by updating to kernel 5.0.2. This approach worked for me. To update the kernel on Kali to a 5.x release I followed these steps:

  • First, ensure you remove (assuming you added them) the options for amdgpu.dc=0 and amdgpu.dpm=0
    • vim /etc/default/grub
    • Change the GRUB_CMDLINE_LINUX_DEFAULT line to remove the options
    • Save the file
    • Run update-grub
  • Add this line to /etc/apt/sources.list:
    • deb http://deb.debian.org/debian experimental main
  • apt-update
  • apt-cache search linux-image
  • apt install linux-image-5.0.0-trunk-amd64-unsigned
  • apt install linux-headers-5.0.0-trunk-amd64

At this point you should be ready for a reboot. Remember this is experimental so while it worked for me YMMV.

Other Notes

  • I could replicate the screen freeze behavior by live-booting from the Kali USB stick
  • Setting the linux kernel parameter nomodeset did not work as it disables kernel mode setting (KMS) which is required for the amdgpu driver
  • To view the boot parameters that are in use (not just set in grub config) you can run cat /proc/cmdline -or- `dmesg | grep "Command Line"