DietPi-Services | Do not "disable" controlled services
- 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
- Disable a service using
update-rc.d -f service_name remove - 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.dare re-started during the update process.
Additional Information:
- As far as I am aware, the given service was not updated during the upgrade.
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-servicesor by adding a line like- service_nameto/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).
Thanks as always for your detailed explanation of the issue and I think your planned changes are a great solution.
Let me open the issue to track the planned enhancement. I thought there was already one about it, but I couldn't find it.
All done for DietPi v8.16 😃.