OPNsense Forum

Archive => 23.7 Legacy Series => Topic started by: z0rk on October 27, 2023, 09:34:05 PM

Title: [SOLVED] CAM Command timeout & DSM TRIM
Post by: z0rk on October 27, 2023, 09:34:05 PM
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
Title: Re: CAM Command timeout & DSM TRIM
Post by: cookiemonster on October 27, 2023, 10:27:27 PM
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.
Title: Re: CAM Command timeout & DSM TRIM
Post by: rkubes on October 28, 2023, 06:43:52 AM
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.
Title: Re: [SOLVED] CAM Command timeout & DSM TRIM
Post by: z0rk on November 04, 2023, 05:38:16 PM
@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.