MT#62508 services: Remove any systemd broken service symlinks

Before running «systemctl preset-all» we remove all .wants dependency
directories, because otherwise the preset-all command leaves obsolete
files behind. But «systemctl preset-all» fails if there's any broken
service symlink around, which means we end up with no dependency
information whatsoever implying a severely broken system, that in
addition is then unbootable.

Remove any such broken symlinks before calling «systemctl preset-all».

Change-Id: I58fe650cb04ddb140922563169a7fedb09a8ceac
master
Guillem Jover 3 weeks ago
parent 67564acdaf
commit a09d8f42e2

@ -145,6 +145,10 @@ systemd_daemon_reload_preset() {
log_debug "Running: systemctl daemon-reload 2>&1 || true"
systemctl daemon-reload 2>&1 || true
log_debug "Removing any broken systemd service symlink"
find -L /etc/systemd/system -type l \
| xargs -r rm
log_debug "systemd needs preset-all to enable/disable services (to start them on boot)"
log_debug "Running: rm -rf /etc/systemd/system/*.wants/ || true"
rm -rf /etc/systemd/system/*.wants/ || true

Loading…
Cancel
Save