Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Invalid fstrim.service commandline #2591

Open
dpgeekzero opened this issue Jun 10, 2019 · 4 comments
Open

Invalid fstrim.service commandline #2591

dpgeekzero opened this issue Jun 10, 2019 · 4 comments

Comments

@dpgeekzero
Copy link

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

  1. systemctl start fstrim.service
  2. 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

@ajeddeloh
Copy link

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?

@dpgeekzero
Copy link
Author

If entries /etc/fstab have a special meaning, then should the file have been removed?

@ajeddeloh
Copy link

/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.

@lucab
Copy link

lucab commented Jun 12, 2019

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.

karelzak pushed a commit to util-linux/util-linux that referenced this issue Apr 28, 2020
The timer and service units run `fstrim --fstab`, which strictly
depends on `/etc/fstab` being present in the OS. This adds relevant
condition statements to the units, in order to skip them and avoid
runtime failures.

Ref: #673 (comment)
Ref: coreos/bugs#2591
Ref: coreos/fedora-coreos-tracker#468

Signed-off-by: Luca BRUNO <luca.bruno@coreos.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants