[Solved] Linux Mint freezes on new SSD

Hello!

I recently bought a new M.2 SSD (Kingston A2000 1tb) and installed it in my computer (HP EliteDesk 800 G2 mini). My intention was for it to replace a old SATA ssd (Sandisk X400 SD8SB8U-256G-1006).

The problem I am having is that when using the new SSD and running out of ram, but having a low of swap free, the system freezes and never returns. (It may also be freezing at other times, I’m not sure. I’m sure though that the system always freezes when it runs out of ram).

When I first got the SSD I did a clean install of Linux Mint Cinnamon 20.1. And experienced freezes 2-3 times a day. Thinking that I might have messed up some settings I decided to clone my old install to the new SSD (using gparted).

I now run Linux Mint 20.1 MATE on btrfs, which I cloned from my old SSD (which I have disabled in order to not create any conflicts of UUIDs). I was not able to copy the SWAP partition, so I created a new one and changed my /etc/fstab to use the new one instead, and it’s detected (activity monitor shows available swap).

I have read on some online forums that NCQ on some SSD’s could cause issues like this, although all threads mentioning it, that i found, was from 2012-2014, so it might have been solved.

Therefore I have set the kernel flag “libata.force=noncq”. It might have made the crashes less common, but it still happens every time the ram is filled up (maybe also at other times).

I have tested filling up the ram when using my old SSD. If I do it very quick, the system temporarily freezes whilst swapping to the SSD, but then resumes as if nothing happened. So the difference to the new SSD, is that the new one never recover.

After the freezes I experienced btrfs errors (mostly wrong amount of free space in block) but those was repaired by mounting with the clear_cache option.

Does anyone of you have an idea what could be the problem?

Extra question: If I’ll end up returning the SSD, what is the best way to securely wipe it?

Hi! I do not have any experience with btrfs. On zfs however it is important to have a separate swap partition. Meaning if you use a swap file instead of a standalone partition, in a situation of low ram there will be a race-condition that can lead to the system hanging. You said you had a separate swap partition, but since I do not know too much about your system I wanted to point this out for you to make sure.

Since you asked about securely wiping an SSD, for nvme drives look at the linux tool nvme-cli. It is available one way or another for every major linux distribution. Boot from a linux live disc, install nvme-cli and run nvme format /dev/nvme0 --ses=1 to securely delete the SSD. If you have other nvme drives in your computer you might need to adjust this command. For further instructions please have a look at this link: NVMe Secure Erase. For sata SSDs the tool to delete them securely with is hdparm by the way.

1 Like

Thank you for your answer!

I have a swap partition instead of a swapfile. I checked again so that I don’t also have a swap file, and I did not. Thank you for explaining the reason why a swap partition is preferred

Thank you! I’ll try that if I don’t find a solution to my main problem :slight_smile:

I found a solution. Apparently there is a problem with the firmware of the SSD controller. If I understand it correctly, if the SSD is in sleep deeper than s3 then the controller answers that it has woken up before it is ready to receive requests and therefore locks up.

The workaround is to set the kernel flag: nvme_core.default_ps_max_latency_us=4000

Relevant links I have found:
https://bbs.archlinux.org/viewtopic.php?pid=1926994#p1926994
https://wiki.archlinux.org/index.php/Solid_state_drive/NVMe#Troubleshooting

1 Like

This topic was automatically closed 273 days after the last reply. New replies are no longer allowed.