Following the advice of drm-kmod pkg leads to unbootable system

After a tour of the other BSDs on the machine in question with very mixed results, I changed my mind and decided to revisit this. I've found a workaround that seems to be reliable. I have no idea why it works, but so far, so good (perhaps like the old joke about the guy passing the 50th floor after jumping off the Empire State Building).

Using kld_list in /etc/rc.conf does not work. If you attempt to load radeonkms there, the system will crash when booting. The suggestion (by one of the contributors to this thread) to use "drm" instead of "radeonkms" in kld_list also does not work in my case. The system does not crash, but you get VGA resolution when X is started.

Prior to starting X, logging in as root and doing 'kldload radeonkms' seems to work reliably. I can then log in as myself, startx, and the resolution is correct. So I arranged
for sudo to allow me to do this command without a password and tried adding 'sudo /sbin/kldload radeonkms' to my .xinitrc at the very beginning. This crashes the system after 'startx'. But, if I issue the kldload prior to startx and then do the startx (with the kldload command removed from .xinitrc), it seems to work, though I have very few samples at this point. So there seems to be some sort of timing dependency here.

As I observed earlier, this is really a mess. The documentation is inaccurate and getting the kernel module loaded seems to be fragile. I will try to compose a bug report about this.

Other than this problem, the system seems to work well on this machine, though again, I don't have a lot of data yet.
Have you tried installing x11-drivers/xf86-video-ati yet? My configuration doesn't work without it.

If so, what is the model number of your Radeon device? I have "CPU: AMD A6-6310 APU with AMD Radeon R4 Graphics" (according to dmesg -a | grep -i radeon), with xf86-video-ati installed, and kld_list="acpi_video", on FreeBSD-13.0-RELEASE. Everything works just fine, with any of startx, x11/sddm, or x11/lightdm having been used, tested, and proven for starting graphics, without using /boot/loader.conf or kldload to load any kernel modesetting driver. Instead, X with xf86-video-ati does it automatically right after X starts.
 
Have you tried installing x11-drivers/xf86-video-ati yet? My configuration doesn't work without it.

If so, what is the model number of your Radeon device? I have "CPU: AMD A6-6310 APU with AMD Radeon R4 Graphics" (according to dmesg -a | grep -i radeon), with xf86-video-ati installed, and kld_list="acpi_video", on FreeBSD-13.0-RELEASE. Everything works just fine, with any of startx, x11/sddm, or x11/lightdm having been used, tested, and proven for starting graphics, without using /boot/loader.conf or kldload to load any kernel modesetting driver. Instead, X with xf86-video-ati does it automatically right after X starts.
dmesg: CPU: AMD A8-3850 APU with Radeon(tm) HD Graphics (2900.29-MHz K8-class CPU)
Linux lspci: [AMD/ATI] Sumo [Radeon 6550d]

Yes, I tried installing xf86-video-ati. No help.
 
dmesg: CPU: AMD A8-3850 APU with Radeon(tm) HD Graphics (2900.29-MHz K8-class CPU)
Linux lspci: [AMD/ATI] Sumo [Radeon 6550d]

Yes, I tried installing xf86-video-ati. No help.
Yeah, this is why radeonkms.ko is the correct driver to use. And kld_list="/boot/modules/radeonkms.ko" is the line to use in /etc/rc.conf, you can copy-paste that. And pay attention to typos and spaces - those do make a difference in whether things work or not.
 
Y'know, a lot of times, things don't work because of typos.
Really?? After 57 years of writing code, 44 of them professionally, I'm surprised to learn this. I thought you could just type any old thing at it and it would Do What I Mean :)

Seriously, I checked this carefully. I'm no youngster but I can still type 'radeonkms' and verify that's what I typed. And I did this more than once -- first at the time of my original post and again yesterday, after a fresh install. Same result -- dead system.

I booted Linux (from a USB key) to get the lspci output I provided in my previous message. When I rebooted FreeBSD, 'sudo kldload radeonkms' killed the system. Rebooting again, it worked. (And yes, typed correctly both times.) So this method isn't completely reliable/deterministic.
 
It is advisable to do a cold-restart , i.e. like pull the power plug when you switch from linux to freebsd or vice-versa.
I had the video card being wrongly initialised with a warm-restart. (could even be bios related)
 
Really?? After 57 years of writing code, 44 of them professionally, I'm surprised to learn this. I thought you could just type any old thing at it and it would Do What I Mean :)

Seriously, I checked this carefully. I'm no youngster but I can still type 'radeonkms' and verify that's what I typed. And I did this more than once -- first at the time of my original post and again yesterday, after a fresh install. Same result -- dead system.

I booted Linux (from a USB key) to get the lspci output I provided in my previous message. When I rebooted FreeBSD, 'sudo kldload radeonkms' killed the system. Rebooting again, it worked. (And yes, typed correctly both times.) So this method isn't completely reliable/deterministic.
Y'know, the reason it's not working is because you keep skipping the .ko ending. That's your typo.

Also, don't do sudo on FreeBSD - that's different from Linux. on FreeBSD, the proper way to do it is su root first.
 
Tip, when you compile graphics/drm-kmod with explicit kernel modules enabled , you only normally need:
rc.conf
Code:
 Kernel modules to load after local disks are mounted
kld_list="drm radeonkms"
(nothing more to do)
 
Y'know, the reason it's not working is because you keep skipping the .ko ending. That's your typo.
Wrong. From 'man rc.conf':

"
kld_list (str) A whitespace-separated list of kernel modules to load
right after the local disks are mounted, without any .ko <<<<<<<<<----------------------
extension or path. Loading modules at this point in the boot
process is much faster than doing it via /boot/loader.conf
for those modules not necessary for mounting local disks.


Also, don't do sudo on FreeBSD - that's different from Linux. on FreeBSD, the proper way to do it is su root first.

Says who? sudo is available as an installable package and sudo and su are not equivalent. I'm well aware of the security implications of sudo misuse.
 
Yeah, this is why radeonkms.ko is the correct driver to use. And kld_list="/boot/modules/radeonkms.ko" is the line to use in /etc/rc.conf, you can copy-paste that. And pay attention to typos and spaces - those do make a difference in whether things work or not.
Very interesting. Using the absolute path does work, contrary to what it says in the man page, which I quote again:

kld_list (str) A whitespace-separated list of kernel modules to load
right after the local disks are mounted, without any .ko
extension or path
. Loading modules at this point in the boot
process is much faster than doing it via /boot/loader.conf
for those modules not necessary for mounting local disks.

Emphasis mine. kld_list="radeonkms", which I used based on the man page, does not work. So either this is a bug in the documentation or the code.

There is a closed bug report that relates to this: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234248. I will open a new bug report.

I will use your absolute-path workaround. Hopefully it will prove more reliable than manually loading the module. Thanks for the suggestion.
 
Very interesting. Using the absolute path does work, contrary to what it says in the man page, which I quote again:

kld_list (str) A whitespace-separated list of kernel modules to load
right after the local disks are mounted, without any .ko
extension or path
. Loading modules at this point in the boot
process is much faster than doing it via /boot/loader.conf
for those modules not necessary for mounting local disks.

Emphasis mine. kld_list="radeonkms", which I used based on the man page does not work. So either this is a bug in the documentation or the code.

There is a closed bug report that relates to this: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234248. I will open a new bug report.

I will use your absolute-path workaround. Hopefully it will prove more reliable than manually loading the module. Thanks for the suggestion.
YW. One more thing: On my rig, for some reason, what worked is to have that line be the VERY LAST one in /etc/rc.conf, even though documentation and other forum users said otherwise. I even played with that just to make sure. I'm on 13-RELEASE, BTW.
 
YW. One more thing: On my rig, for some reason, what worked is to have that line be the VERY LAST one in /etc/rc.conf, even though documentation and other forum users said otherwise. I even played with that just to make sure. I'm on 13-RELEASE, BTW.
I'm also running 13.
 
YW. One more thing: On my rig, for some reason, what worked is to have that line be the VERY LAST one in /etc/rc.conf, even though documentation and other forum users said otherwise. I even played with that just to make sure. I'm on 13-RELEASE, BTW.
This is even more interesting. The position of kld_list= in /etc/rc.conf should actually have no impact. I think I have it somewhere on the 14-th line on this system.

kld_list="amdgpu /boot/kernel/tcp_rack.ko"
... and both modules get loaded...
 
kld_list="radeonkms" is suitable in the vast majority of radeonkms FreeBSD 13.⋯ situations.

<https://www.freshports.org/graphics/drm-fbsd13-kmod/#message> is correct for FreeBSD 13.⋯.

… Using the absolute path does work, …

Output, please, from this command (paste as code):

ls /boot/kernel

… there seems to be some sort of timing dependency …

I believe so, for some use cases. From a recent comment by me in GitHub:

"My sense of things is that timely auto-loading of drm … with later auto-loading of radeonkms is less likely to trigger …"

… tried adding 'sudo /sbin/kldload radeonkms' to my .xinitrc at the very beginning. This crashes the system after 'startx'. …

By system crash, do you mean a kernel panic?

kld_list="drm radeonkms"

drm there is superflous.
 
kld_list="radeonkms" is suitable in the vast majority of radeonkms FreeBSD 13.⋯ situations.

Albert Einstein once said "In theory, there's no difference between theory and practice."

Your theory conforms to what the rc.conf man page says. But at least in my practice, it does not work. As I've said multiple times in this thread, the system crashes on boot. And by crash, I mean a freeze. Not ping-able from a nearby Linux system on the same Ethernet and completely unresponsive. There is no on-screen chatter about a kernel panic.
<https://www.freshports.org/graphics/drm-fbsd13-kmod/#message> is correct for FreeBSD 13.⋯.



Output, please, from this command (paste as code):

ls /boot/kernel

It's enormous; I'm not going to paste it here. Why don't you just accept my word that I downloaded

FreeBSD-13.0-RELEASE-amd64-mini-memstick.img.xz

yesterday, dd'ed it to a USB key and installed it (UFS, not ZFS). So the /boot/kernel I have is what you get from a vanilla install.

I believe so, for some use cases. From a recent comment by me in GitHub:

"My sense of things is that timely auto-loading of drm … with later auto-loading of radeonkms is less likely to trigger …"



By system crash, do you mean a kernel panic?

See above.
drm there is superflous.
 
YW. One more thing: On my rig, for some reason, what worked is to have that line be the VERY LAST one in /etc/rc.conf, even though documentation and other forum users said otherwise. I even played with that just to make sure. I'm on 13-RELEASE, BTW.
I didn't expect that to work, but will give it a try.
 
… a freeze. Not ping-able … completely unresponsive. …

Thanks. It's a set of symptoms that I have encountered on countless occasions. Last week, for example.

I have my workaround that involves straying from instructions for kld_list; my straying differs from your straying :)
 
... kld_list="/boot/modules/radeonkms.ko" is the line to use in /etc/rc.conf...
Very interesting. Using the absolute path does work...
... kld_list="radeonkms", which I used based on the man page, does not work...

... I will use your absolute-path workaround. Hopefully it will prove more reliable than manually loading the module. Thanks for the suggestion.
YW. One more thing: On my rig, for some reason, what worked is to have that line be the VERY LAST one in /etc/rc.conf, even though documentation and other forum users said otherwise. I even played with that just to make sure. I'm on 13-RELEASE, BTW
I'm also running 13.
I didn't expect that to work, but will give it a try.
So I did give it a try, but it didn't work... for me. (I'm also running 13.0-RELEASE.)

Let's summarize. We have uncovered at least 2 non-standard and undocumented workarounds to the problem of when and how to load the Radeon kernel mode-setting driver.


Most people who've reported success at loading radeonkms.ko on this forum modify kld_list as follows:

kld_list="radeonkms"


Both astyle and donallen find that doesn't work, and are using this syntax instead:

kld_list="/boot/modules/radeonkms.ko"

(Note: astyle might be using amdgpu.ko instead of radeonkms.ko with this syntax, I'm not sure.)


Both grahamperrin and I are leaving the kms driver out of kld_list altogether.

astyle's graphics card ID: Asus Radeon RX 550 4GB

donallen's graphics card ID: AMD A8-3850 APU with Radeon(tm) HD Graphics (2900.29-MHz K8-class CPU)

My graphics card ID: AMD A6-6310 APU with AMD Radeon R4 Graphics (on a Lenovo G50-45 model laptop)


More about my particular results:
If I pre-load the graphics driver via kld_list using either of the above noted syntaxes, my system will begin thrashing and show a black screen. This will happen regardless of whether or not I attempt to start X. If I act quickly enough, I might be able to switch to a virtual terminal using the CTRL-ALT function keys, but if I wait more than a few seconds, the system will freeze up and quickly become unresponsive to any key combination. It will also become inaccessible to ssh, requiring a power off (system halt) and reboot to recover.
I was able to capture output from dmesg -a showing sequences of drm messages for both normal and abnormal loading of the radeonkms.ko driver. Here is the relevant section showing a normal load sequence; this sequence is essentially the same whether I start X using startx or x11/lightdm:


... and here is the section showing the abnormal load sequence:


Both sequences look essentially the same, up to the line which reads as follows in the normal sequence:
Oct 9 02:14:40 mate kernel: Successfully added WC MTRR for [0xe0000000-0xefffff
ff]: 0;


... that line is not included in the abnormal sequence. The sequences continue to match up to a point where it starts showing timeout errors, which look like this:
Code:
[drm ERROR :uvd_v1_0_ib_test] radeon: fence wait timed out.
[drm ERROR :radeon_ib_ring_tests] radeon: failed testing IB on ring 5 (-60).
[drm ERROR :radeon_vce_ib_test] radeon: fence wait timed out.
[drm ERROR :radeon_ib_ring_tests] radeon: failed testing IB on ring 6 (-60).
[drm ERROR :radeon_vce_ib_test] radeon: fence wait timed out.
[drm ERROR :radeon_ib_ring_tests] radeon: failed testing IB on ring 7 (-60).
Later in the sequence, it starts repeating "stalled" and "GPU lockup" messages like these:
Code:
drmn0: ring 3 stalled for more than 10000msec
drmn0: GPU lockup (current fence id 0x0000000000000001 last fence id 0x000000000
0000003 on ring 3)
drmn0: ring 3 stalled for more than 10801msec
drmn0: GPU lockup (current fence id 0x0000000000000001 last fence id 0x000000000
0000003 on ring 3)
The number of milliseconds in the "stalled" messages continues growing until the system eventually locks up.
 
I posted a bug report about this yesterday. When writing it, I consulted /var/log/messages. There *is* a panic -- a page-fault in the kernel. A stack trace is included, courtesy the kernel debugger.

But things have changed this morning. I shut my system down last night. I attempted to reboot it this morning It took three tries to get the system up, the first two attempts resulted in crashes. This is with the full path to radeonkms.ko in rc.conf. I was fooled, prematurely drawing conclusions about the syntax of the line in rc.conf being causal from too few samples in a probabilistic situation. I think my experience this morning demonstrates that the syntax used in rc.conf is not the causal factor. There is clearly a timing bug in the process by which the radeonkms driver is installed and initialized. I will amend my bug report with this new information.

Unfortunately, this problem is likely to result in my having to switch back to Linux on this system.
 
Yeah, the senses of randomness can cause frustration. I empathise.

Yes, I tried installing xf86-video-ati. No help.

Please retry with the driver installed. Or if it's already present (from an earlier attempt), retry with the driver deleted. Note, this plea is not to doubt your earlier test result(s); it's based on personal experience.

Also try starting once in safe mode, then (if SDDM is enabled and apparent) immediately restart in normal mode.

If SDDM is enabled but not apparent in safe mode, then:
  1. force off the computer
  2. start in single user safe mode
  3. mount -uw / && service zfs onestart
  4. edit /etc/rc.conf to disable auto-start of SDDM
  5. exit to multi-user safe mode then immediately restart in normal mode and … then maybe retry re-enabling auto-start of SDDM, and so on.
If "and so on" makes you want to scream, I'll understand :) I've sort of been there, I nearly abandoned FreeBSD … I don't know when it was (maybe last year), ultimately I was (still am) glad that I stuck with it.

I posted a bug report

Can you share a link? (If you already did so: apologies, I'm blind to it.)
 
Yeah, the senses of randomness can cause frustration. I empathise.



Please retry with the driver installed. Or if it's already present (from an earlier attempt), retry with the driver deleted. Note, this plea is not to doubt your earlier test result(s); it's based on personal experience.

Also try starting once in safe mode, then (if SDDM is enabled and apparent) immediately restart in normal mode.

If SDDM is enabled but not apparent in safe mode, then:
  1. force off the computer
  2. start in single user safe mode
  3. mount -uw / && service zfs onestart
  4. edit /etc/rc.conf to disable auto-start of SDDM
  5. exit to multi-user safe mode then immediately restart in normal mode and … then maybe retry re-enabling auto-start of SDDM, and so on.
If "and so on" makes you want to scream, I'll understand :) I've sort of been there, I nearly abandoned FreeBSD … I don't know when it was (maybe last year), ultimately I was (still am) glad that I stuck with it.
I'll try your suggestions. I'd like to find a reliable workaround for this bug, because once it's up, the system works well on this machine.
Can you share a link? (If you already did so: apologies, I'm blind to it.)
No problem with your eye-sight -- I forgot to include it in my previous message. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259019
 
I'll try your suggestions. I'd like to find a reliable workaround for this bug, because once it's up, the system works well on this machine.

No problem with your eye-sight -- I forgot to include it in my previous message. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259019
FYI, the xf86-video-ati package was *not* installed on my system during all the thrashing about we've been discussing. I have now installed it. I shut the system down (power off) after doing so and rebooted. The system came up without incident. Only one data point, but a tiny bit encouraging.

I also then changed the infamous rc.conf line to
kld_list="radeonkms"

and rebooted. The system came up with the radeonkms driver apparently loaded, because the resolution in X is correct. We didn't need it, but this is further proof
that the syntax of that line in rc.conf is not the issue.
 
Back
Top