This is the full error message and you gave us only two lines (bold in the message below)
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
avg2012lms*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 157 MB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 515099 files and directories currently installed.)
Removing avg2012lms (2012.1795) ...
Failed to stop avgd.service: Unit avgd.service not loaded.
invoke-rc.d: initscript avgd, action "stop" failed.
dpkg: error processing package avg2012lms (--purge):
subprocess installed pre-removal script returned error exit status 5
Errors were encountered while processing:
avg2012lms
E: Sub-process /usr/bin/dpkg returned an error code (1)
A similar error might see when you install the package. In other words, the whole thing was not running.
Therefore
Open the file /var/lib/dpkg/info/avg2012lms.prerm
sudo nano /var/lib/dpkg/info/avg2012lms.prerm
and replace this
case "$1" in
remove|deconfigure|upgrade)
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d avgd stop
else
/etc/init.d/avgd stop
fi
with this
case "$1" in
remove|deconfigure|upgrade)
# if which invoke-rc.d >/dev/null 2>&1; then
# invoke-rc.d avgd stop
# else
# /etc/init.d/avgd stop
# fi
and now again
sudo apt-get remove --purge avg2012lms
sudo apt-get install --reinstall ubuntu-desktop
Finally you should search running avgd
processes and kill them.
apt-cache policy avg2012lms
, the output offind /opt -type d -iname '*avg*'
– A.B. Sep 27 '15 at 08:42