DietPi icon indicating copy to clipboard operation
DietPi copied to clipboard

DietPi-Services | Do not "disable" controlled services

Open Wondering-Soul opened this issue 3 years ago • 3 comments

  • DietPi version | 8.4.2
  • Distro version | Bullseye 1
  • Kernel version | 5.15.32+
  • SBC model | RPi B+ (armv6l)
  • Power supply used | Official RaspberryPi Supply 5.1V / 2.5A
  • SD card used | 16GB SanDisk Ultra

Foreword: I am not entirely certain if this is working as intended or not. I understand that setting service priorities etc with update-rc.d is not a perfect solution. I know that if I were to run update-rc.d -f lighttpd remove, the service would no longer start at boot, however if the package is updated this change will be reversed. I am aware that I can specify specific run levels to ensure that a given service doesn't restart when upgraded, I am wondering whether this is the limitation I am running into or whether DietPi is just ignoring changes made with update-rc.d or if the services are registered with DietPi separately somewhere?

Steps to reproduce

  1. Disable a service using update-rc.d -f service_name remove
  2. Run dietpi-update

Expected behaviour

  • DietPi Updater should stop all registered running services, complete the update and restart ONLY the enabled services to ensure we return to the same state we were in before updating.

Actual behaviour

  • Services previously disabled with update-rc.d are re-started during the update process.

Additional Information:

  • As far as I am aware, the given service was not updated during the upgrade.

Wondering-Soul avatar May 03 '22 11:05 Wondering-Soul

Many thanks for your report.

This is a known limitation:

  • All DietPi-controlled services are "disabled" from the init system point of view, so that they are not started by the init system at boot but by DietPi-Services in well defined order. However, systemd allows simple ordering as well, so that we aim to change this to allow more parallelism at boot and remove this "DietPi-controlled" vs "disabled" confusion.
  • Until now however this means that disabling the service (when it is DietPi-controlled already) doesn't change something. You need to "exclude" it either in dietpi-services or by adding a line like - service_name to /boot/dietpi/.dietpi-services_include_exclude. However, it is then neither stopped nor started before/after DietPi updates.

update-rc.d btw is the SysV service utility, while DietPi uses systemd as init system:

systemctl disable service_name

This is synced with the SysV runtime levels as well, if the service is actually a SysV service.

DietPi Updater should stop all registered running services, complete the update and restart ONLY the enabled services to ensure we return to the same state we were in before updating.

That would be inconsistent. If a service is not stopped, it must not be started, and if a service is not started afterwards, it must not be stopped beforehand. Basically what I aim to do is to simply use the systemctl is-enabled service_name status to decide whether to stop/start services before/after DietPi maintenance tasks (updates, software installs, backups).

MichaIng avatar May 03 '22 12:05 MichaIng

Thanks as always for your detailed explanation of the issue and I think your planned changes are a great solution.

Wondering-Soul avatar May 06 '22 21:05 Wondering-Soul

Let me open the issue to track the planned enhancement. I thought there was already one about it, but I couldn't find it.

MichaIng avatar May 07 '22 11:05 MichaIng

All done for DietPi v8.16 😃.

MichaIng avatar Mar 30 '23 15:03 MichaIng