kdave / btrfsmaintenance

Scripts for btrfs maintenance tasks like periodic scrub, balance, trim or defrag on selected mountpoints or directories.
GNU General Public License v2.0
900 stars 79 forks source link

incomplete systemd setup instructions in dist-install.sh #67

Closed gschintgen closed 5 years ago

gschintgen commented 5 years ago

Hi, I installed btrfsmaintenance as outlined in README.md and followed the instructions given by dist-install.sh, specifically this one:

However it's also necessary to copy the .service files to the same location, else systemd gives somewhat cryptic error output and the maintenance scripts won't be executed. So I'd like to suggest a slight change to the displayed instructions: "- copy .timer and *.service files [...]".

mfeif commented 5 years ago

Related. I also copied the *.service files, and when I tried to enable them, I got another somewhat cryptic message:

# systemctl enable btrfs-scrub.timer
Created symlink /etc/systemd/system/timers.target.wants/btrfs-scrub.timer → /etc/systemd/system/btrfs-scrub.timer.
# systemctl enable btrfs-scrub.service
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
   instance name specified.

It's a good bet that I don't know what I'm doing; I'm still new to systemd vs older methods.

gschintgen commented 5 years ago

Related. I also copied the *.service files, and when I tried to enable them, I got another somewhat cryptic message:


# systemctl enable btrfs-scrub.service
...
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).
```> # systemctl enable btrfs-scrub.timer
Created symlink /etc/systemd/system/timers.target.wants/btrfs-scrub.timer → /etc/systemd/system/btrfs-scrub.timer.

This was new for me, too: those .service files are not intended to be enabled, they're activated/executed whenever the .timer unit fires. That's why I only proposed to add the step about copying the .service files, so that they're accessible, not trying to enable them.

It actually makes sense: some service units are statically enabled and configured with all their dependencies, while others are dynamically called upon via other means, timers in this case.

Anyway, the documentation should be amended. (Otherwise I'm quite happy with btrfsmaintenance! Thanks!)

kdave commented 5 years ago

Thanks for the suggestion, dist-install and README have been updated.