-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use systemd.device units instead of running systemctl enable
/disable
#112
Comments
i.e. idiomatic example would be:
And then add this to the timer and service
The script would then get the full sysfs path as an argument (e.g. Systemd already adds |
Because the unit files have nothing in their |
That happens to be the case today, but it should probably be fixed so it doesn't become a bug in the future (if it isn't already one today with ENI detach while the instance is stopped). |
Description
systemd supports device units (systemd.device) which are dynamically created/deleted/reloaded on device hot-attach/hot-detach/change.
Update the udev rules and systemd unit files to use this instead of
systemctl enable
/disable
.Background
The current udev rules create/delete + start/stop systemd units by running
systemctl enable
/disable --now
on ENI hot-attach/detach.This is undesirable for a few reasons:
/etc/systemd/system
(e.g. NixOS).systemctl enable
/disable
creates/deletes symlinks to systemd unit files elsewhere on the system (e.g./lib/systemd/system
) in/etc/systemd/system
.remove
event (if it does it at all. It might not if there's a power outage or the system crashes and the ENI is removed before the subsequent boot).Even without switching to systemd.device units, the udev rules should be doing
systemctl start
/stop
instead ofsystemctl enable
/disable
.See NixOS/nixpkgs#355111 (comment) for a more detailed discussion.
Notes
BindsTo=
can be used to tie units together (e.g. the policy refresh service and timer units).Requisite=
).The text was updated successfully, but these errors were encountered: