# Some problems with FreeBSD 12.1 on a newer system



## Dendros (May 8, 2020)

I have build myself a newer system with a Ryzen 5 1600 AF CPU, 16 GB RAM DDR 4 and RX 470 graphics. FreeBSD 12.1-RELEASE p4 AMD64 with XFCE 4.14 does work on it but there are some hiccups:

1. The system seems to run, how to say, a bit sluggish or stuttering (I'm not sure what term is applicable since English is not my native language) basically it does not run smooth like it does in Debian 10 Linux. I thought that might be due to tearing so I have set "TearFree on" in driver-amdgpu.conf but it made no difference, this stuttering is still present.
It's very obvious when I move windows, they freeze for a second then continue to move then again freeze then move and so on.

2. I'm starting XFCE manually, using the `startx` command and sometimes when I logout from GUI to console there is a message in console thay says something like this: "X server is refusing to die" and the entire system just freezes completely and I cannot switch to another console with Ctrl+Alt+Fn. The only way to get out of this is to reset the system manually.

3. This is more an annoyance than a problem: the `pkg` downloading speed is wildly fluctuating, sometimes is fast then slow then fast again and so on. Before it used to be pretty fast and stable , not so much now.

Are there some tips for these issues?


----------



## jb_fvwm2 (May 8, 2020)

2... can you switch to another login with alt-F2, and shutdown or resume stuff?
3... may be due to heavier saturation of internet in the stay-home 2020 era and
       thus temporary.   If it stalls I just cntlC and restart.


----------



## Dendros (May 9, 2020)

2. No, I tried Alt-F2 as well and other combinations, nothing worked. The only way out was by pressing the reset button and I got some corruption warnings after restart, luckily those were automatically corrected but I guess it's not good if those repeat too often..
3. Perhaps this is the case, then I will just wait for it to solve itself.


----------



## Dendros (May 9, 2020)

Today the problem with X server happened again. Now I can describe it in more detail, basically I logged out from GUI to console then a message appeared saying something like: 


```
waiting for X server to shutdown....
xinit: X server slow to shutdown, sending kill signal
xinit: X server refuses to die
```

But the X server was finally terminated successfully, I logged out of my account from console then logged in again, issued the `startx` command and the system froze completely, only a non-flashing console cursor and a non-moveable mouse cursor were displayed on a black background. The system was completely unresponsive, I could do nothing to exit from this state, could not switch to another console, I was forced to restart the system manually again.

I have read that there are some problems running FreeBSD on Ryzen, it seems that this is true, never had those problems on older hardware. Also I noticed that the system is not only exhibiting stuttering in GUI but also could not play online videos very well, there were dropped frames on Youtube and Twitch and the videos were playing noticeably choppy.

Should I wait for FreeBSD 13 release? Perhaps it will run better on my hardware.


----------



## donallen (May 9, 2020)

Dendros said:


> I have build myself a newer system with a Ryzen 5 1600 AF CPU, 16 GB RAM DDR 4 and RX 470 graphics. FreeBSD 12.1-RELEASE p4 AMD64 with XFCE 4.14 does work on it but there are some hiccups:
> 
> 1. The system seems to run, how to say, a bit sluggish or stuttering (I'm not sure what term is applicable since English is not my native language) basically it does not run smooth like it does in Debian 10 Linux. I thought that might be due to tearing so I have set "TearFree on" in driver-amdgpu.conf but it made no difference, this stuttering is still present.
> It's very obvious when I move windows, they freeze for a second then continue to move then again freeze then move and so on.
> ...



If your /boot/loader.conf is unmodified -- it's as it was when installed -- then console switching will not work when X is running. To fix this, add the following line
to /boot/loader.conf:

hw.vga.textmode=1

Be careful when editing that file -- typos can render your system unbootable, which would require a bit of admin skill to fix.

I always set up a git or fossil repository in /etc and /boot and record the original versions of any files I modify, together with the modified versions. 

One other comment. I, too, have run into problems with FreeBSD that I know I would not encounter with the good Linux distribution I use (Slackware). But FreeBSD has its
own set of virtues that Linux does not have and my experience, at least so far with this version of FreeBSD, is that the problems are solvable. And the community is helpful in that regard. I think the system is good enough to make the effort of doing some detective work worthwhile.


----------



## Dendros (May 9, 2020)

I agree, FreeBSD does have its own virtues, that is why I want to use it alongside Linux.
I have not modified the */boot/loader.conf file *but there is something I don't understand: you say that console switching does not work when X is running but, as I said, I logged out from GUI (X server/XFCE) to console (because I start X manually from console, I'm not using any login manager) so when I did that, I was back to console. Why did console switching not work if the X server was no longer running?
Of course, I will try your solution, perhaps it will work.
And on the other issues, I hope there are solution for them too.


----------



## donallen (May 9, 2020)

Dendros said:


> Today the problem with X server happened again. Now I can describe it in more detail, basically I logged out from GUI to console then a message appeared saying something like:
> 
> 
> ```
> ...



Have you checked the X log file in /var/log to see what driver X is using? You may not have the correct driver installed. I've got a home-built system too on which I'm running FreeBSD (it's a lot older than yours) and its got amd/ati graphics hardware. I needed to install the xf86-video-ati package and also needed to load the radeonkms kernel module just to get X to work at all.  It took some detective work to figure this out. Google is your friend in situations like this.


----------



## Dendros (May 9, 2020)

I already know what driver is used by X because I have set it manually in the driver-amdgpu.conf file. As you might guess from file's name, it's the amdgpu driver. I have set it because I have read that's the appropiate driver for my graphics card, Radeon RX 470.
And in rc.conf I have this:


```
kld_list="amdgpu"
```

According to Xorg.0.log, I have hardware acceleration enabled, everything seems OK, no errors reported.


----------



## donallen (May 9, 2020)

Dendros said:


> I already know what driver is used by X because I have set it manually in the driver-amdgpu.conf file. As you might guess from file's name, it's the amdgpu driver. I have set it because I have read that's the appropiate driver for my graphics card, Radeon RX 470.
> And in rc.conf I have this:
> 
> 
> ...



Have you looked at https://wiki.freebsd.org/Graphics? See the sections AMD Graphics and AMD GPU. There's info there that may be relevant to your setup.


----------



## Dendros (May 9, 2020)

Yes, I did read that wiki page. I have set the amdgpu driver as per instructions from that page, now I'm thinking of removing the Xorg amdgpu driver (xf86-video-amdgpu) that I have installed and just use the modeset driver, perhaps that will work better.


----------



## eldaemon (May 9, 2020)

Is it responsive on the console? About the pkg download speeds, it might be a slow mirror. You could try to ping your mirror and/or something else at the same time to see if it's likely loss related or not.

Wondering if the slowness isn't video related. Although what window manager are you using?


----------



## Dendros (May 10, 2020)

It is responsive on the console, if I don't use X, the system seems run quite well. But I need X for my daily activities so using only text mode is not an option.
Pkg download speeds seems to have been stabilized so maybe you were right about a slow mirror.

I use Xfce 4.14 so my window manager is obviously Xfwm4. Perhaps I have not made myself more clear (and sorry if that's the case, as I said English is not my mother tongue) but it's not about slowness, it's about the system being choppy.
Basically, everything stutters slightly, I think the term is micro-stuttering and that is what I'm facing. And when I play online videos (Youtube or Twitch) there are dropped frames and the result is that videos are stuttering too.

I have deleted the *xf86-video-amdgpu* driver so now X is using the *modesetting* driver. That seems to have solved the freezing problem when I use *startx* or I logout from X to console.
But stuttering still occurs albeit it seems slightly reduced.
Perhaps the future 12.2 release will solve this problem and everything will run smoothly.


----------



## donallen (May 10, 2020)

Dendros said:


> It is responsive on the console, if I don't use X, the system seems run quite well. But I need X for my daily activities so using only text mode is not an option.
> Pkg download speeds seems to have been stabilized so maybe you were right about a slow mirror.
> 
> I use Xfce 4.14 so my window manager is obviously Xfwm4. Perhaps I have not made myself more clear (and sorry if that's the case, as I said English is not my mother tongue) but it's not about slowness, it's about the system being choppy.
> ...



You have made yourself very clear, so no need to apologize for your written English, which is excellent.

One question: did you literally follow the instructions on in the AMD GPU section of the graphics wiki page we discussed? I ask because you mention above that "I have deleted the *xf86-video-amdgpu* driver". There is an xf86-video-amdgpu package, but the wiki instructions do not mention using it. If you have not already done so, I would suggest following the wiki instructions exactly. I ran afoul of this myself, doing things in an ad hoc way with my own AMD system, because at that point I was unaware of the wiki page. Once I found that page and followed its instructions, things got better in a hurry.

Either way -- good luck!


----------



## Dendros (May 10, 2020)

donallen, thanks and you're right, I have not followed the instructions literally. 
I did what the wiki says but I also added the xf86-video-amdgpu package because I thought that this will help (I had a bad experience on an older system that did not run well if there was no xf86-video-amdgpu driver).
But now that I have deleted this package, the system seems to run a bit better but there is still a lot of micro-stuttering, including when playing online videos. It's quite annoying but I might just live with that until the problem will be solved through an update. Or perhaps I will manage to solve it myself although that is unlikely.


----------



## pbp_jackd (May 27, 2021)

Dendros Just curios, did you find a solution ? I'm asking because I have similar effects like you have described. Very choppy desktop experience. My hardware is a bit different though but it's also an AMD graphics card. ( RX 5700XT)


----------



## Dendros (Jun 1, 2021)

Unfortunately no, I haven't managed to find a solution. But I have installed FreeBSD 13.0-RELEASE on the above mentioned system and it seems to run a lot better that FreeBSD 12. There are still some stutterings in Xfce but a lot less noticeable.
Overall, FreeBSD 13 does run much more fluid than 12 on Ryzen, in my experience.


----------



## bsduck (Jun 7, 2021)

You can try both xfwm4 vblank modes to see if one feels more fluid:
`xfwm4 --replace --vblank glx`
`xfwm4 --replace --vblank xpresent`


----------



## Amzo (Jul 3, 2021)

I have the same issue with FreeBSD 13 on a Ryzen 2700x. I can't seem to find any solution for this. Makes the system unusable. Only error I find is:


```
load: 13.81  cmd: sh 66112 [nanslp] 856.24r 0.23u 0.86s 0% 3728k
mi_switch+0xc1 sleepq_catch_signals+0x2e6 sleepq_timedwait_sig+0x12 _sleep+0x199 kern_clock_nanosleep+0x1e1 sys_nano
sleep+0x3b amd64_syscall+0x10c fast_syscall_common+0xf8
```

Which is nano sleep, and it seems like the process isn't going from the sleep state to wake state prooperly, as the system will repsond normally after about a minute, for about 10 minutes then it will happen again.


----------



## grahamperrin@ (Jul 4, 2021)

Amzo said:


> … Only error I find is: …



Amzo is that essentially the same as the error you reported in relation to poudriere? 









						Solved - Poudriere Bulk Hangs sporadically - sleepq_wait_signal
					

When trying to build packages with poudriere, the builds hang every few minutes for a few minutes with the follow:   load: 1.43  cmd: sh 66112 [nanslp] 432.47r 0.13u 0.34s 0% 3728k mi_switch+0xc1 sleepq_catch_signals+0x2e6 sleepq_timedwait_sig+0x12 _sleep+0x199 kern_clock_nanosleep+0x1e1...




					forums.freebsd.org


----------



## grahamperrin@ (Jul 4, 2021)

Dendros said:


> … stutterings in Xfce but a lot less noticeable. …



Can you share a probe of your computer? <https://bsd-hardware.info/>

Also `pkg query -e '%a = 0' %o | sort` to tell what's manually installed.


----------



## Alain De Vos (Jul 4, 2021)

For transparancy, "picom &"


----------



## Amzo (Jul 4, 2021)

grahamperrin said:


> Amzo is that essentially the same as the error you reported in relation to poudriere?
> 
> 
> 
> ...


It's the system in general suffering issues, even out of the box. Poudriere just amplifies it.


----------



## diizzy (Jul 4, 2021)

Are you running the very latest bios and microcode?





						FreshPorts -- sysutils/devcpu-data: AMD and Intel CPUs microcode updates
					

An RC script for use with the cpuctl(4) microcode update facility to keep your processor's firmware up-to-date.  CPU microcode data must be installed from a vendor.  See sysutils/devcpu-data-amd and sysutils/devcpu-data-intel.




					www.freshports.org
				



Also https://lists.freebsd.org/pipermail/freebsd-current/2021-March/079237.html might be of interest


----------



## Dendros (Jul 4, 2021)

grahamperrin: I'm sorry but I no longer run FreeBSD on the Ryzen box, because I have changed the system's case and the new case only supports 2 HDDs, on which I have Windows 10 and Linux separately on each.

As I said, FreeBSD 13 did run much better on Ryzen but not as well as Linux or Windows. I really wish that FreeBSD's problems on Ryzen would be sorted out (and they probably will be). Until then, it seems that it's better to run FreeBSD on a bit older hardware.


----------



## Amzo (Jul 4, 2021)

diizzy said:


> Are you running the very latest bios and microcode?
> 
> 
> 
> ...


I updated the bios yesterday. I should probably install the microcode update, keep forgetting they need to be applied every boot.


----------

