EDIT: Thanks to billy72 I've found a valid workaround by updating to BIOS version 3.50 (with AGESA Combo-AM4 220.127.116.11) and setting "global c-state control" on "disabled" and "power supply idle control" to "typical current idle". If you plan to do this make sure to read the posts below to get a better idea on how to do it.
Not sure if this is the correct section since I don't really know if this problem is hardware or software related.
I recently built a computer with a Ryzen 5 2600 processor and b450 motherboard (Asrock b450M pro4). I Installed both windows and Linux in dual boot because I want to use the former for gaming and the latter for programming, however regardless of the distribution used (Ubuntu, Debian, KDE Neon), Linux freezes 10-15 minutes after boot, and the only way to recover is by hard rebooting the computer.
I've found similar topics on the internet and a most of them suggest disabling zenstate c6 (although it didn't do anything for a lot of users it seems), so I tried disabling them though both BIOS (AMD CBS) and Linux (I used zenstates.py from here GitHub - r4m0n/ZenStates-Linux: Dynamically edit AMD Ryzen processor P-States but for some reason the c6 package state becomes enabled again after rebooting, though c6 cores remains disabled); another thing that I did was edit grub.conf by adding "rcu_nocbs=0-7" and updating it (I also tried adding "processor.max_cstate=1" but running "sudo update-grub" returned "processor.max_cstate=1: not found"). All of this didn't solve anything. I also read about AGESA being possibly the culprit, though my motherboard has the BIOS updated to version 3.30, so it's well up-to-date from that point of view.
I was thinking that maybe the problem is related to the Linux kernel (currently 5.0-something, sorry I didn't take note, if you need to know I'll edit with the actual version) since Windows run perfectly, so maybe dowgrading it or installing an old distro image might do the trick?
Any help troubleshooting this or finding a workaround is greatly appreciated.