Dpkg Remove to Stop Processes

How force remove when post-installation script always fail

You may need to manually remove the package using:

sudo dpkg --purge --force-all package

Replace package with the name of the package.

Do note: its recommended to report a bug if the package is not yours or is unknown to you what the script does.

dpkg : how to ignore error in post/pre scripts

Well, personally I have no idea about this either. If --force-all doesn't work, I would simply edit /var/lib/dpkg/info/blablabla.postrm to get it right. You're removing the package so won't be worried about the script which will be soon removed, will you?

Removing broken packages in Ubuntu

I faced this problem with a broken package, rvm. I tried many things like sudo apt install -f and sudo dpkg --purge --force-all rvm but nothing worked. Finally I managed to find a blog post that explains how to remove broken packages on Debian/Ubuntu.

Here are the steps.

  1. Find your package in /var/lib/dpkg/info, for example using: ls -l /var/lib/dpkg/info | grep <package>

  2. Move the package folder to another location, like suggested in the blog post I mentioned before.

     sudo mv /var/lib/dpkg/info/<package>.* /tmp/
  3. Run the following command:

     sudo dpkg --remove --force-remove-reinstreq <package>

So as an example I solved my problem by executing the following commands in a terminal:

sudo mv /var/lib/dpkg/info/rvm.* /tmp/
sudo dpkg --remove --force-remove-reinstreq rvm

`dpkg --configure -a` hangs

This is a confirmed bug.

https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1621336

A workaround is listed:

https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1621336/comments/4

Adding the workaround from Axel Kämpfe since the links seems to be broken:

  1. Start a rootshell with "sudo -i"
  2. Run echo "bash -c 'service snapd.boot-ok start'" | at now + 4 min
  3. Then run apt install snapd (if it argues about canceled dpkg processes use the dpkg --configure -a. Then wait for at least 4 minutes. The hanging should gone then.

Good luck! :)

/Patrik

How can kill all the processes triggered by hotkey with some smart way?

From the extended context you provided the first thing that comes to my mind is using a PID-file and a companion command.

Something like this:

# cr.sh
ffmpeg ... &
# note down pid
echo $! >/tmp/cr.pid

# cr-stop.sh
kill $(cat /tmp/cr.pid)

then you should be able to use cr-stop.sh to stop ffmpeg.



Related Topics



Leave a reply



Submit