Learn a lot, one byte at a time.

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

# For Fedora, Arch Linux, etc.
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

# For Ubuntu, Debian, Linux Mint, etc. (debian-based)
sudo update-grub

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.

« »