Closed ThomDietrich closed 4 years ago
Interesting, would you be able to know which process was 597? I'm assuming it wasn't openHAB as this process is killed if it can't shutdown safely during uninstall?
It might make sense to stop any the processes owned by openhab
during a purge?
It's the frontail log viewer. In openHABian this service uses the openhab user. I can now see that this decision was a mistake... Still the error shouldn't occur. No, I don't think we can expect the user to only be used for openhab itself. It might be better to deal with it. I.e.:
As for step two: Why did it fail actually? I wasn't able to figure that out.
Yeah, definitely shouldn't fail on reinstall in this case. Will have a play to replicate and try to fix. Thanks!
Hey @ThomDietrich, do you think it would be a good idea to kill all processes belonging to openhab
?
pkill -U openhab
userdel openhab
will return no errors.
Hey Ben, I'm not sure where you are headed. Didn't we agree to not force-delete the user?
Sorry, I may have forgotten what we had discussed. And came at it from the same (incorrect) angle. 😖
No, I don't think we can expect the user to only be used for openhab itself
Yes, I agree (like I did last time...) 😄
I'm currently trying to work out why the reinstall completed partially. The details about creating the user is in the preinst stage, and each of these files have the -e flag set. It looks like they already skip adding it if the user already exists.
Maybe you could check if the user exists prior to creating it? Also I'd suggest to add warning messages on both sides:
User
openhab
already exists on the system.User
openhab
couldn't be deleted. You may want to do that manually...
Hey @BClark09 I'm currently going through all my openHABian issues and found the one related to this issue. What would you suggest to do here?
Best! Hope you are doing fine ;)
Hey @ThomDietrich! Hope you are well too!
I've not had a good amount of time to have a look at this properly yet. I'm still a bit confused at why openHAB fails to reinstall properly. I couldn't replicate the exact error above, but I did run into problems. The preinst script already checks for an existing user.
My suggestion so far would be to make a simple check (and as you suggested, warn) for PIDs belonging to the user/group to see if that has any effect on the reinstall. The postrm script will become something like:
purge)
removeOpenHABInit
if [ -z "$(ps -o pid= -u openhab)" ]; then
if getent passwd $OH_USER > /dev/null 2>&1; then
deluser --system --quiet $OH_USER || true
fi
if getent group $OH_GROUP > /dev/null 2>&1; then
delgroup --system --quiet $OH_GROUP || true
fi
else
echo "The 'openhab' user has other active processes and cannot be deleted."
echo " You may want to delete the user and group manually."
fi
rm -rf /var/log/openhab2
rm -rf /var/lib/openhab2
rm -rf /usr/share/openhab2
rm -rf /etc/openhab2
exit 0
;;
is this still an issue after all ?
It's also linked to https://github.com/openhab/openhabian/issues/285
Finally did something about this. So sorry for the delay 😞!
The above is just my first theory. I've executed
sudo apt purge openhab2
. An error was shown:Next I reinstalled openhab2 but the service was not able to start:
The problem was solved by another purge followed by a manual removal of the user (after stopping the other service under the user), followed by a successful reinstall.
Related to https://github.com/openhab/openhabian/issues/285