Cannot Delete User

10,505

Solution 1

First simply remove entire dir /opt/logstash sudo rm -rf /opt/logstash/ and then try to remove logstash with sudo apt-get remove logstash

Solution 2

Try the following :

in terminal type : w

then see after the username an output like this : pts/2

now type :

fuser -k /dev/pts/2

This should kick the user, now try to delete it

Share:
10,505

Related videos on Youtube

Binyomin Trager
Author by

Binyomin Trager

Updated on September 18, 2022

Comments

  • Binyomin Trager
    Binyomin Trager over 1 year

    I am trying to uninstall logstash, but sudo apt-get remove logstash fails because the user is being used by a process. If I try to manually delete the logstash user, I cannot because even when I kill the process, a new one immediately pops up. For example, if I check for processes using logstash:

    ps -fp $(pgrep -u logstash)
    

    I get

    UID        PID  PPID  C STIME TTY          TIME CMD
    logstash 17376     1 99 10:04 ?        00:00:10 /usr/bin/java -Djava.io.tmpdir=/
    

    Then I try to kill the process and delete the user:

    sudo killall -KILL -u logstash
    sudo userdel logstash
    

    But now logstash is already being used by another process:

    userdel: user logstash is currently used by process 17794
    

    How can I delete the logstash user?

  • Binyomin Trager
    Binyomin Trager about 10 years
    Thank you for your response. I only see my username with a pts/1 after it, and my username again with tty7 after it. When I do fuser -k /dev/pts/1 it just closes my terminal, but the logstash user is still being used.
  • nux
    nux about 10 years
    are you logging in with same user you want to delete ?
  • Binyomin Trager
    Binyomin Trager about 10 years
    I don't think so... I am logged in as myself btrager and I am trying to delete logstash.
  • nux
    nux about 10 years
    reboot your pc then try again
  • Binyomin Trager
    Binyomin Trager about 10 years
    When I try lsof | grep logstash, and kill the process, I have the same problem that a new one starts immediately after I kill it.
  • Binyomin Trager
    Binyomin Trager almost 10 years
    That one finally worked. Thanks! If you could give a little more explanation I would appreciate it, and others might benefit from it as well.