How to solve the issue with the uninstallation:

  1. Open a new SSH session, terminal to the server
  2. Issue this command lsof /var/lib/dpkg/lock The command will return with a process ID (PID)
  3. Insert the PID into this command to kill the process: kill -9 PID
  4. Use this command dpkg --configure -a to fix the package manager.
  5. Run these commands to make sure the BitNinja agent is restarted (don't use service bitninja restart)
    1. service bitninja stop
    2. service bitninja status
    3. service bitninja start
  6. Issue this command to remove BitNinja apt-ger purge 'bitninja*'

If the installation process fails you might need to repeat steps 1-4.