From what I can see, people on later versions of Ubuntu (14.10, 15.04) are running into this issue. This is likely due to Ubuntu's move to the systemd init engine (what starts and stops system services).
The error you're seeing is the package's pre-removal script trying to interact with the init system and failing spectacularly.
We could assume that that's all the script is going to do. You could ignore its failure and use the dpkg
--force-all
flag to just carry on.
sudo dpkg -P --force-all avg2013flx
It's slightly risky if the script does more than that. We could have a look and just edit (and even fix) the pre-removal script:
sudoedit /var/lib/dpkg/info/avg2013flx.prerm
... But you need to understand what the problem is to fix it. It's undoubtedly something around a line like service stop avg
. I don't have it installed (or have a want to install it just for this) so you'll have to fish around (or edit your question to include it and I'll have a look).
This has come up before on Ubuntu Forums with a fairly trivial fix:
sudo ln -s /bin/true /etc/init.d/avgd
sudo apt-get remove --purge avg2013flx
This just makes sure a fake copy of the init script exists for the removal script, allowing it to complete. Given the other answers suggest just removing the script, my original --force-all
suggestion should be just as safe.