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:
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:
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.
Open the file
sudo nano /var/lib/dpkg/info/avg2012lms.prerm
and replace this
case "$1" in
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d avgd stop
case "$1" in
# if which invoke-rc.d >/dev/null 2>&1; then
# invoke-rc.d avgd stop
# /etc/init.d/avgd stop
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.