[SOLVED] CAM Command timeout & DSM TRIM

Started by z0rk, October 27, 2023, 09:34:05 PM

Previous topic - Next topic
October 27, 2023, 09:34:05 PM Last Edit: November 04, 2023, 05:30:17 PM by z0rk
OPNsense 23.7.7_1-amd64
FreeBSD 13.2-RELEASE-p3
OpenSSL 1.1.1w 11 Sep 2023

I've just recently deployed a new instance of opnsense. SYSTEM: LOG FILES: GENERAL log shows the following errors:

2023-10-27T11:15:55-07:00 Notice kernel (ada0:ahcich0:0:0:0): DSM TRIM. ACB: 06 01 00 00 00 40 00 00 00 00 01 00
2023-10-27T11:10:17-07:00 Notice kernel (ada0:ahcich0:0:0:0): DSM TRIM. ACB: 06 01 00 00 00 40 00 00 00 00 01 00
2023-10-27T10:06:04-07:00 Notice kernel (ada0:ahcich0:0:0:0): DSM TRIM. ACB: 06 01 00 00 00 40 00 00 00 00 01 00

2023-10-27T11:15:55-07:00 Notice kernel (ada0:ahcich0:0:0:0): CAM status: Command timeout
2023-10-27T11:10:17-07:00 Notice kernel (ada0:ahcich0:0:0:0): CAM status: Command timeout
2023-10-27T10:06:04-07:00 Notice kernel (ada0:ahcich0:0:0:0): CAM status: Command timeout
2023-10-27T09:37:45-07:00 Notice kernel (ada0:ahcich0:0:0:0): CAM status: Command timeout


There are more entries, but for brevity I've just included a sample.
Some searches indicate that this could relate to a hardware problem (SSD drive, SATA cable, or like) or a FreeBSD bug.
My SSD is brand new and SMART reports no errors. BIOS is set to AHCI vs. SATA.
Does anyone have some initial impressions before I explore any other potential hardware issues?

Thank you
OPNsense 24.7.2

defo hardware but not necessarily disk. It means the OS is trying and failing to talk with the storage. Like you say it could be disk controller, cable, ports (loose), etc.
Oftentimes a shutdown, reseating connections and reboot can eliminate.

October 28, 2023, 06:43:52 AM #2 Last Edit: October 28, 2023, 06:45:54 AM by rkubes
There are some cheap SSDs that don't support the trim command and will get hung up on this error. For example, some (or maybe all) of the vnopn brand mini-pcs on Amazon come with SSDs that don't support it. There's documentation on their product page for how to disable the trim command in opnsense, or you might find it by just googling to disable trim in opnsense.

For the vnopn specifically, there's an SSD firmware update you can request from them. I doubt it actually implements trim, it probably just provides a dummy response so the OS doesn't get hung up.

I'm just using the vnopn brand as an example, obviously you'd need to identify your manufacturer and research accordingly. Just hoping this points you in the right direction.

@rkubes
Thanks for this.
I did some more research and found the following at https://forum.opnsense.org/index.php?topic=21898.msg103540#msg103540

Solution:
tunefs -t disable /

I ran this command a week ago and the CAM and TRIM errors disappeared.
The SSD in question is a Lexar NQ100 which was the least expensive SSD I could find on Amazon at the time.
OPNsense 24.7.2