Page 1 of 1

Uninstalling CyberWatch

Published: October 22, 2021 - 4:26 PM
by thomas789
Good morning,

(Server console used under Windows 10 and WAPT Enterprise 2.1.0.10550 installed on a Debian 10 server, client 2.1 on Ubuntu 21.04).

I am unable to uninstall my CyberWatch Ubuntu agent using the following code:

Code: Select all

def uninstall():
    run('sudo apt remove --purge cyberwatch-agent')
nor with

Code: Select all

def uninstall():
    apt_remove('cyberwatch-agent')
It remains stuck during uninstallation.

On the workstation, if I do:

Code: Select all

root@PC:~# ps aux | grep -i cyber
root      353952  0.0  0.0   2628   636 ?        S    16:16   0:00 /bin/sh -c sudo apt remove --purge cyberwatch-agent
root      353953  0.0  0.0  23312  4428 ?        S    16:16   0:00 sudo apt remove --purge cyberwatch-agent
root      353956  2.0  0.2  89980 67688 ?        S    16:16   0:00 apt remove --purge cyberwatch-agent
root      354233  0.0  0.0  17784  1848 pts/0    S+   16:17   0:00 grep --color=auto -i cyber
And if I run `apt remove --purge cyberwatch-agent` in parallel on the machine, it returns:

Code: Select all

Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 353956 (apt)      
This seems to logically explain the error, but how do we solve it?

(I also tried adding sudo to my package command but no result).

Thanks in advance,

Sincerely, Thomas.

Re: Uninstalling Cyberwatch

Published: October 28, 2021 - 3:17 PM
by dcardon
Hello Thomas,

You can kill the apt processes to unlock the dpkg database.

In your run, you need to add a -y, otherwise the uninstallation won't be silent. It's also preferable to add the noninteractive parameter

Code: Select all

run("LANG=C DEBIAN_FRONTEND=noninteractive apt-get remove -y --purge cyberwatch-agent")
The `apt_remove()` syntax hasn't existed for quite some time (since Wapt 1.7?). You may have found it in the online documentation; there was some confusion between the different versions recently. The command is

Code: Select all

uninstall_apt("cyberwatch-agent")
Sincerely,

Denis