I have not been able to reproduce this, but sometimes koha-remove fails because the user is logged in. I have no idea how that happens, since the instance-specific user cannot log in at all, and there is no trace of them being logged in.
Perhaps deluser/userdel are complaining that the user is logged in because the zebra daemon still running as that user. Maybe the daemon has not finished shutting down by the time the deluser command is run?
I think the daemon has not finished shutting down by the time the deluser command is run. Could a wait, pkill or sleep be put before the deluser?
hmm, this sounds quite plausible. I think a ps -u instance-koha test loop with (say) a 5 second sleep might be a useful solution here.
Not sure if this really adds anything, but here goes: I have been moving some instances around today, and done some koha-removes. In the beginning I was getting errors because the koha user for the given instance was logged in. Now I have tried several times to run koha-stop-zebra before I run koha-remove, and now I'm not getting the error about the logged in user. At least that seems to confirm the theory from comment #2.
Steps to reproduce: - Run: $ koha-create --create-db favourite_name - Run: $ koha-remove favourite_name => FAIL: koha-indexer is still running for user favourite_name-koha
Created attachment 56701 [details] [review] Bug 4880: Make koha-remove stop all instance's services This patch makes koha-remove stop all instance's services before attempting to remove the system user, Before this patch, only zebra was stopped. To test: - Run: $ sudo koha-create --created-db favourite_name - Run: $ sudo koha-remove favourite_name => FAIL: koha-indexer is still running for user favourite_name-koha - Run: $ sudo koha-create --created-db another_name $ sudo koha-plack --enable another_name $ sudo koha-plack --start another_name $ sudo koha-indexer --stop another_name $ sudo koha-remove another_name => FAIL: koha-plack is still running for user another_name-koha - Apply the patch - Repeat the previous tests, with new names => SUCCESS: Everything works as expected :-D - Sign off :-D
*** Bug 17054 has been marked as a duplicate of this bug. ***
I did 1)sudo koha-create --create-db f_name, and got: Koha instance is empty, no staff user created. Starting Zebra server for f_name [ ok ] Starting Koha indexing daemon for f_name:. 2) sudo koha-remove f_name, and got: Removing Koha instance f_name Stopping Zebra server for f_name userdel: user f_name-koha is currently used by process 4793 /usr/sbin/deluser: `/usr/sbin/userdel f_name-koha' returned error code 8. Exiting.
(In reply to Lucio Moraes from comment #8) > userdel: user f_name-koha is currently used by process 4793 > /usr/sbin/deluser: `/usr/sbin/userdel f_name-koha' returned error code 8. > Exiting. Was this before or after applying the patch? If it was before, it confirms the bug. If it was after the patch should probably be marked as Failed QA.
(In reply to Lucio Moraes from comment #8) > I did > > 1)sudo koha-create --create-db f_name, and got: > Koha instance is empty, no staff user created. > Starting Zebra server for f_name > [ ok ] Starting Koha indexing daemon for f_name:. > > 2) sudo koha-remove f_name, and got: > > Removing Koha instance f_name > Stopping Zebra server for f_name > userdel: user f_name-koha is currently used by process 4793 > /usr/sbin/deluser: `/usr/sbin/userdel f_name-koha' returned error code 8. > Exiting. If you are testing the patch, please make sure you are running the patched koha-remove. The command should look like kohaclone/debian/scripts/koha-remove f_name
Can anyone sign this, please? :-)
Created attachment 56910 [details] [review] Bug 4880: Make koha-remove stop all instance's services This patch makes koha-remove stop all instance's services before attempting to remove the system user, Before this patch, only zebra was stopped. To test: - Run: $ sudo koha-create --created-db favourite_name - Run: $ sudo koha-remove favourite_name => FAIL: koha-indexer is still running for user favourite_name-koha - Run: $ sudo koha-create --created-db another_name $ sudo koha-plack --enable another_name $ sudo koha-plack --start another_name $ sudo koha-indexer --stop another_name $ sudo koha-remove another_name => FAIL: koha-plack is still running for user another_name-koha - Apply the patch - Repeat the previous tests, with new names => SUCCESS: Everything works as expected :-D - Sign off :-D Signed-off-by: Lucio Moraes <lmoraes@catalyst.net.nz>
Created attachment 56965 [details] [review] Bug 4880: Make koha-remove stop all instance's services This patch makes koha-remove stop all instance's services before attempting to remove the system user, Before this patch, only zebra was stopped. To test: - Run: $ sudo koha-create --created-db favourite_name - Run: $ sudo koha-remove favourite_name => FAIL: koha-indexer is still running for user favourite_name-koha - Run: $ sudo koha-create --created-db another_name $ sudo koha-plack --enable another_name $ sudo koha-plack --start another_name $ sudo koha-indexer --stop another_name $ sudo koha-remove another_name => FAIL: koha-plack is still running for user another_name-koha - Apply the patch - Repeat the previous tests, with new names => SUCCESS: Everything works as expected :-D - Sign off :-D Signed-off-by: Lucio Moraes <lmoraes@catalyst.net.nz> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Pushed to master for 16.11, thanks Tomas!
Pushed in 16.05. Will be in 16.05.06.
Pushed to 3.22.x, will be in 3.22.13