Invalid fstrim.service commandline
Issue Report
Bug
Container Linux Version
NAME="Container Linux by CoreOS"
ID=coreos
VERSION=2079.5.1
VERSION_ID=2079.5.1
BUILD_ID=2019-06-05-2258
PRETTY_NAME="Container Linux by CoreOS 2079.5.1 (Rhyolite)"
ANSI_COLOR="38;5;75"
HOME_URL="https://coreos.com/"
BUG_REPORT_URL="https://issues.coreos.com"
COREOS_BOARD="amd64-usr"
Environment
Dell PowerEdge R640
Expected Behavior
● fstrim.service - Discard unused blocks
Loaded: loaded (/usr/lib/systemd/system/fstrim.service; static; vendor preset: disabled)
Active: inactive (dead) since Mon 2019-06-10 00:00:51 UTC; 18h ago
Process: 32120 ExecStart=/sbin/fstrim -av (code=exited, status=0/SUCCESS)
Main PID: 32120 (code=exited, status=0/SUCCESS)
Jun 10 00:00:50 node-03.dev systemd[1]: Starting Discard unused blocks...
Jun 10 00:00:51 node-03.dev systemd[1]: Started Discard unused blocks.
Actual Behavior
● fstrim.service - Discard unused blocks on filesystems from /etc/fstab
Loaded: loaded (/usr/lib/systemd/system/fstrim.service; static; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2019-06-10 18:54:43 UTC; 2s ago
Process: 20986 ExecStart=/sbin/fstrim -Av (code=exited, status=32)
Main PID: 20986 (code=exited, status=32)
Jun 10 18:54:43 node-05.dev systemd[1]: Starting Discard unused blocks on filesystems from /etc/fstab...
Jun 10 18:54:43 node-05.dev fstrim[20986]: fstrim: failed to parse /etc/fstab: No such file or directory
Jun 10 18:54:43 node-05.dev systemd[1]: fstrim.service: Main process exited, code=exited, status=32/n/a
Jun 10 18:54:43 node-05.dev systemd[1]: fstrim.service: Failed with result 'exit-code'.
Jun 10 18:54:43 node-05.dev systemd[1]: Failed to start Discard unused blocks on filesystems from /etc/fstab.
Reproduction Steps
- systemctl start fstrim.service
- systemctl status fstrim.service
Other Information
Newer builds of Container Linux do not populate the /etc/fstab file, so the fstrim.service should be updated.
The ExecStart for fstrim.service is ExecStart=/sbin/fstrim -Av. It should probably be changed to ExecStart=/sbin/fstrim -av
I'd be hesitant to use -a since that may trim filesystems that user does not want trimmed, but yeah, this shouldn't error. Perhaps the unit should have a ConditionPathExists=/etc/fstab instead?
If entries /etc/fstab have a special meaning, then should the file have been removed?
/etc/fstab doesn't really have special meaning. Systemd doesn't even use it directly, a generator reads it and generates mount units which systemd then uses. The default filesystems for CL have their own mount units which means /etc/fstab isn't needed by default.
I'm not sure where this unit is coming from and who is consuming it, but another option is to make a templated unit and use %I as the mountpoint arg from the instantiated service.