[SOLVED] LXC Container systemd service fstrim fails

prahn

Active Member
Dec 19, 2020
67
5
28
49
I installed an LXC Container with Nextcloud, based on the Turnkey template, which is running fine for a while now.
However the systemd service "fstrim" has the status failed and will not start.
What can I do to fix that?

Code:
root@cloud ~# systemctl status fstrim       
* fstrim.service - Discard unused blocks on filesystems from /etc/fstab
   Loaded: loaded (/lib/systemd/system/fstrim.service; static; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2024-01-22 20:10:38 UTC; 46s ago
     Docs: man:fstrim(8)
  Process: 749773 ExecStart=/sbin/fstrim -Av (code=exited, status=32)
 Main PID: 749773 (code=exited, status=32)
      CPU: 2ms

Jan 22 20:10:38 cloud systemd[1]: Starting Discard unused blocks on filesystems from /etc/fstab...
Jan 22 20:10:38 cloud fstrim[749773]: fstrim: failed to parse /etc/fstab: No such file or directory
Jan 22 20:10:38 cloud systemd[1]: fstrim.service: Main process exited, code=exited, status=32/n/a
Jan 22 20:10:38 cloud systemd[1]: fstrim.service: Failed with result 'exit-code'.
Jan 22 20:10:38 cloud systemd[1]: Failed to start Discard unused blocks on filesystems from /etc/fstab.
Jan 22 20:10:38 cloud systemd[1]: fstrim.service: Consumed 2ms CPU time.

I tried to disable the service with "systemctl disable fstrim" but the service is still in an error state?!
The volume of the container resides on a ZFS volume, so no Autorim should be needed at all!
 
Last edited:
Hey,
To disable fstrim, you have to disable the timer, not the service:
Code:
systemctl disable fstrim.timer

The unit will still show up as failed until the system is rebooted or systemctl reset-failed fstrim.service, since the last time it ran, it failed.