1

I am having issues with being unable to SSH into my server, running Debian 11. If I try to make a folder or file, I get an error that says mkdir: cannot create directory ‘/tmp/test’: Read-only file system.

As suggested by this link, and a large swath of others, I can fix this by entering safe mode and running fsck.ext4 /dev/sda, but it only helps for 24-48 hours.

I got a new SSD about two weeks ago (smartctl is showing power-on hours of 442), because I was having similar errors and I thought I could be having a bad hard drive, but the same problems are happening with the new one.

Here is the results from sudo smartctl -t long -C /dev/sda: https://pastebin.com/LpHGJTx8

Does anyone happen to know why this may be happening? I can provide any other logs as well, I'm not sure what may be needed

I appreciate any help!

EDIT: I ran a badblocks -sv /dev/sda test and got the following result: Pass completed, 0 bad blocks found. (0/0/0 errors)

EDIT 2: I ran sudo memtest 2048 2 (from this link). These were the results: https://pastebin.com/auUJzvWy

Nikita Kipriyanov
  • 8,033
  • 1
  • 21
  • 39
  • Test RAM thoroughly. And, probably, CPU. Also, which hardware is this? Does it use ECC RAM? Does it use SMT/HT (which makes problems like this worse and more pronounced)? How `fstab` looks? What's is in the `dmesg` immediately after you discover it is readonly again? – Nikita Kipriyanov Feb 02 '22 at 06:27
  • @NikitaKipriyanov Sorry, I forgot to include the most important part :) I'm running an [Intel NUC7CJYH](https://www.intel.com/content/www/us/en/products/sku/126135/intel-nuc-kit-nuc7cjyh/specifications.html). It does not use ECC RAM. The specs say it has 2 cores, 2 threads, so I do not believe it has hyper threading. I have updated my post with the results of a RAM test. – Josh Loecker Feb 02 '22 at 06:34

1 Answers1

1

Bad RAM is the usual cause of the unexpected file system corruption. This seems to be your case too, according to the memtester run.

It is so common so it is recommended to automatically check the file system at regular intervals even if it is marked as clean. For example, please read tune2fs manual. It is mentioned right in the beginning of the page, in the -c option description, and also later, in the -i option.

If you are brave, you may use Linux BadRAM or memory map feature, to tell it to not to use certain memory addresses at all. It'll use only the parts of memory that are healthy. But I wouldn't do that on the computer of non-negligible importance.

Nikita Kipriyanov
  • 8,033
  • 1
  • 21
  • 39
  • Okay, I didn't even think about bad RAM. I realized that was most likely my problem as well after seeing the results...well, off to do some shopping I guess :) I have not heard of tune2fs, but I will be sure to set it up. Thank you very much for your help! – Josh Loecker Feb 02 '22 at 06:59