Categories
all tutorials

Fixing NVME SSD Problems On Linux

Not too long ago, I got myself a nice 500GB PCI-e NVME SSD, for those who don’t know what that is, it’s basically a very fast SSD. The model I got is a Kingston A2000 and I must say, it’s a very good drive for the price. It was fine and all but I ran into OS lock-ups where randomly, without any warning, the main drive would behave as if someone has unplugged it. I couldn’t even install Fedora at one point, it failed to format the drive! Of course, this is unacceptable and something had to be done… Let’s begin with a back story.

Install Windows… why?

Yes, I’ve tested it on Windows 10 and I’ve had no issues regarding OS lockups. Of course, I could just use Windows and be done with it but because we don’t do that around here, I had to find a solution to this and so, the research began.

Bug report, hooray!

I found this bug report and reading some of the things people posted, it looked like it wasn’t going to be fixed due to the mixed responses people gave. Luckily, after testing some GRUB options out, I found one that worked perfectly. All I had to do was add a line to my GRUB_CMDLINE_LINUX and reload the GRUB configuration. That’s it!

The solution

Open up a terminal, and find your GRUB file, generally it is /etc/default/grub but check your distribution’s documentation. Open it up in a text editor with superuser privileges. I’ll use vim for this…

sudo vim /etc/default/grub

Then, in the GRUB_CMDLINE_LINUX part, simply append the code below into the GRUB_CMDLINE_LINUX=””, to the end of it.

nvme_core.default_ps_max_latency_us=0

It should look something like this after you’ve done it, don’t copy what I have as your system will have different.

That’s it, append to the end but inside the double-quotes.

Save and exit the text editor, then run the following command

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

Then reboot!

If you want to check if the command worked, you can run the following command and the expected output should be 0:

cat /sys/module/nvme_core/parameters/default_ps_max_latency_us
Excellent!

Hopefully that should fix your NVME problems. If you want to keep up-to-date on the bug-report, consider checking here once in a while.

5 replies on “Fixing NVME SSD Problems On Linux”

Thank you so so so much for this article! It was the only thing that helped me with my NVMe Linux problem.
I have a XPS 9570 that is running Linux and Windows (just for gaming). It came with a SK Hynix 500GB NVMe that made zero problems under Linux. Then I upgraded to a Kingston A2000 1TB NVMe and the problems started…
I also had random freezes especially when I started to write a lot of data to the SSD (big downloads, system updates etc.). dmesg said something about the NVMe controller resetting.
I’ve researched a lot about compatibility problems with the A2000 and Linux and also the controller that is used by this SSD. Nothing…
In Windows I had no problems.

So I opened a RMA and Kingston replaced the SSD within one week (great service btw!). But after one day the problems started again…

So I researched again without any hope and thought I wasted my money on this SSD.

And then I found your article that you’ve written a few days before my new SSD from Kingston service arrived 😀

Again: Big big thanks to you!

So when you pick the USB as boot-device, you get presented with a GRUB boot screen which where you can pick to “Install Fedora …” or “Test this media & install …” Highlight the one you want to go into and press “E” on your keyboard (if you’re booting with EFI). If you’re using legacy mode to boot, you might need to press “TAB”. You will then go into edit mode.

Go to the end of the line “vmlinuz …. …. quiet ” and append “nvme_core.default_ps_max_latency_us=0” (no quotes).

Again, if you’re on UEFI, you will press “Ctrl+x” which will boot into Fedora with the new changes. If you’re using legacy mode, pressing enter should suffice.

Hope this helps!

Hi. Thanks!!! It worked perfectly.

Just a note for other users I had to use F10 to save the new changes in the Grub menu because Ctrl+X wasn’t working.

Thanks again. Hopefully we get an upstream fix soon.

Leave a Reply

Your email address will not be published. Required fields are marked *

Blue Captcha Image
Refresh

*