Closed ThomDietrich closed 4 years ago
Hi @BClark09 I've just hit this as well when I did apt-get remove openhab2 Please have a look, thanks
Hi @mstormi, are you sure this happened with a remove
? AFAIK, there's no function to remove the openhab
user on remove
; only on purge
:
https://github.com/openhab/openhab-linuxpkg/blob/master/resources/control-runtime/postrm
When reading up on what should be done I came across this and think that the following may be the best way of making sure these processes aren't active before the user is deleted:
ps -o pid= -u openhab | xargs kill -9
However, I think we discussed this further in https://github.com/openhab/openhab-linuxpkg/issues/108 in which we came to the conclusion that we shouldn't force delete the user, just gracefully handle it (i.e. if the user exists, don't try to create it again on next install). I still need to think about that properly but we can use the first part of the command above to test for active processes, and list them in the uninstall process.
Oh thought I had responded already. Right, "remove" does not delete the user, still the running frontail process locked some file that "remove" was trying to remove so it was sort of the same root cause. Problem is frontail is run by systemd and will restart another instance as soon as the active one dies (when we kill it) and the new instance is as-blocking as the old one. A proper solution should do something like systemctl stop frontail.service called from openhab2 package preremove script. [not sure about packages but vaguely recall there's that sort of script] Maybe do systemctl disable frontail.service, too ? Does not make sense to run it with no openhab installed, does it? We should also think about doing the inverse (i.e. start frontail service) on openhab2 postinstall. Maybe check for presence of frontail service first (systemctl status frontail.service).
AND, to do it right, we should think about doing the same to ALL other services that to make sense require openhab to be installed as well.
I don't think it's a good idea to refer to other packages if openHAB isn't dependant on them. The openHAB debian package isn't "aware" of openHABian, nor the other packages that it comes with. The packages should be kept completely separate.
What might make sense to to modify the dependant service files when they are installed with openHABian scripts, so that they reference the openHAB service file.
Hmm I agree but don't know if it would work to only add systemd dependencies (and nothing in pkg preremove etc scripts) . Yes frontail is dependant on openhab so adding that dependency into systemd files should result in frontail being shutdown/restarted on openhab shutdown/startup upon openhab pkg removal/installation. But this is just how I think systemd framework should handle this. I'm not deeply enough into it to confirm. Are you?
Frontail and openHAB are not dependent. Frontail just happens to use the log file created by openHAB...
Imho we should 1. change frontail to another user AND/OR fix the issues with the openhab user (as discussed in https://github.com/openhab/openhab-linuxpkg/issues/108)
@BClark09 would PartOf=openhab2 in frontail's systemd config be a solution?
pinging @BClark09
@BClark09
Related to https://github.com/openhab/openhab-linuxpkg/issues/108