Linux going AMD Ryzen with Debian 9 (Stretch)

Written by - 1 comments

Published on - last updated on July 21st 2020 - Listed in Hardware Linux

Ever since AMD announced the new Ryzen processors, I was eager to test such a CPU myself and replace a weaker CPU on a local micro-server running Debian Stretch.
But a couple of public forum posts kept me from buying one. Some of these:

So neither did I get somewhere a real confirmation that Ryzen works as it should but neither a confirmation that it doesn't work at all. I decided to go for it and test it myself. So I ordered an AMD Ryzen 1700 (yes, that's the first generation Ryzen) and a new AM4 motherboard (ASRock AB350 GAMING-ITX).

While waiting for the delivery, I already prepared Debian Stretch to run with a newer Kernel. It seems that full Ryzen support started with Kernel 4.11.0, further improvements and fixes in later releases. But default Debian Stretch ships with 4.10. Luckily Kernel 4.18 is available in stretch-backports. So let's enable backports then!

root@irbwsrvp01 ~ # echo "deb stretch-backports main non-free contrib" > /etc/apt/sources.list.d/backports.list
root@irbwsrvp01 ~ # apt-get update

To install the current Linux Kernel from backports:

root@irbwsrvp01 ~ # apt-get install -t stretch-backports linux-image-amd64
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following additional packages will be installed:
Suggested packages:
  linux-doc-4.18 debian-kernel-handbook
Recommended packages:
  firmware-linux-free irqbalance apparmor
The following NEW packages will be installed:
The following packages will be upgraded:
1 upgraded, 1 newly installed, 0 to remove and 83 not upgraded.
Need to get 45.4 MB of archives.
After this operation, 257 MB of additional disk space will be used.
Do you want to continue? [Y/n]

Just to make sure, I don't run into missing firmware dependencies, I decided to install these packages from backports, too:

root@irbwsrvp01 ~ # apt-get install -t stretch-backports firmware-amd-graphics firmware-linux-nonfree firmware-misc-nonfree firmware-realtek

Followed by reboot:

root@irbwsrvp01 ~ # reboot

The micro-server came up again and booted the new Kernel 4.18:

root@irbwsrvp01 ~ # uname -a
Linux irbwsrvp01 4.18.0-0.bpo.1-amd64 #1 SMP Debian 4.18.6-1~bpo9+1 (2018-09-13) x86_64 GNU/Linux

Yay! Ready for Ryzen!

Two days later I got my packages: The AMD Ryzen 1700 CPU, AM4 ASRock Motherboard, 2 x 8GB DDR4 RAM

AM4 Motherboard ASRock AB350 Mini-ITX with AMD Ryzen 1700

Once I built the new motherboard with the Ryzen CPU into the micro-server it was the moment of truth: Will the server boot?

Side-Note: It did, but there was no video output! What did I do wrong? I tried both HDMI outputs of the motherboard but there was no video output at all, not even showing a POST screen. Turns out the motherboard ASRock B350 Gaming ITX has a lot of video output plugs, but no embedded GPU. On the old motherboard I used an AMD A10 processor which is very weak (compared with Ryzen) but has an embedded GPU. Ryzen itself does not have an embedded GPU. Means: I had to attach a GPU/graphics card on the PCI-Ex slot. Luckily I still had one.

Updated Note July 2020: Scroll down to the end of the article to see the update concerning embedded graphics.

The processor shows up in ASRock's BIOS, so far so good:

ASRock AB350 Bios Ryzen 1700

What about the OS? Will it boot?

And yes. It did!

$ cat /proc/cpuinfo  | head -n 28
processor    : 0
vendor_id    : AuthenticAMD
cpu family    : 23
model        : 1
model name    : AMD Ryzen 7 1700 Eight-Core Processor
stepping    : 1
microcode    : 0x8001136
cpu MHz        : 1481.761
cache size    : 512 KB
physical id    : 0
siblings    : 16
core id        : 0
cpu cores    : 8
apicid        : 0
initial apicid    : 0
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate sme ssbd sev ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca
bugs        : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass
bogomips    : 5988.04
TLB size    : 2560 4K pages
clflush size    : 64
cache_alignment    : 64
address sizes    : 43 bits physical, 48 bits virtual
power management: ts ttp tm hwpstate eff_freq_ro [13] [14]

And multi-threading is correctly working:

$ cat /proc/cpuinfo |grep "core id"
core id        : 0
core id        : 0
core id        : 1
core id        : 1
core id        : 2
core id        : 2
core id        : 3
core id        : 3
core id        : 4
core id        : 4
core id        : 5
core id        : 5
core id        : 6
core id        : 6
core id        : 7
core id        : 7

The view in htop:

AMD Ryzen Linux htop

So far this microserver is now running for 16 days straight, without any issues so far.

$ uptime
 14:23:53 up 16 days,  2:20,  2 users,  load average: 2.25, 3.06, 3.05

TL;DR: AMD Ryzen (1) works very well and fast with Debian Stretch and backported Linux Kernel (4.18)! 

And here's "Team Red" at work:

Debian Stretch running with AMD Ryzen 1700

Update January 9th 2019:
I saw a couple of forum posts from users that complain they get no sensor data from the Ryzen CPU. I cannot confirm that. At least with the backported 4.18 Kernel on Debian 9 and "lm-sensors" package installed, I'm able to read the temperature from the CPU:

# sensors
Adapter: PCI adapter
Tdie:         +38.9°C  (high = +70.0°C)
Tctl:         +38.9°C 

Adapter: PCI adapter
GPU core:     +1.05 V  (min =  +0.80 V, max =  +1.19 V)
temp1:        +38.0°C  (high = +95.0°C, hyst =  +3.0°C)
                       (crit = +105.0°C, hyst =  +5.0°C)
                       (emerg = +135.0°C, hyst =  +5.0°C)

Important here is to know that "k10temp-pci-00c3" is the Ryzen 1700 CPU.

Below that, the nouveau-pci-2600, is a Nvidia GPU (GeForce GT 730).

Update July 21st 2020:

AMD just introduced the new Ryzen 4000 series processors. This model includes a radeon graphics processor (embedded GPU); it is therefore an APU.

AMD Ryzen APU with integrated graphics

Add a comment

Show form to leave a comment

Comments (newest first)

Thierry de Coulon from Switzerland wrote on Mar 23rd, 2019:

Hello! Thank you for this very clear walkthrhough that helped get support form my Ryzen. However, I'd suggest adding many should install the headers at the same time, in case they need to compile a module.