I have Windows Subsystem for Linux running Ubuntu 16.04 (but with Linux Mint 19 packages). At one point, I made the mistake of installing a different kernel, which also installed grub-pc and friendly-recovery. I managed to remove grub-pc with apt, but friendly-recovery is stuck. I have tried the following to remove it:

cat > /usr/sbin/policy-rc.d <<EOF
exit 101
chmod +x /usr/sbin/policy-rc.d
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl
#### Next command tried
apt remove friendly-recovery
#### Next command tried
dpkg --remove --force-remove-reinstreq friendly-recovery
#### Finally...
dpkg --purge --force-remove-reinstreq friendly-recovery

None of them removed friendly-recovery. I always get this log output:

(Reading database ... 145035 files and directories currently installed.)
Removing friendly-recovery (0.2.38) ...
/usr/sbin/grub-probe: error: failed to get canonical path of `rootfs'.
dpkg: error processing package friendly-recovery (--purge):
 installed friendly-recovery package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:

This solution on GitHub didn't fix my issue.

I am now stuck not being able to change the installed packages (apt and dpkg always error processing friendly-recovery, no matter what package I am trying to install/remove).

What can I do to fix this? I can't think of anything but fully reinstalling WSL.


According to the output, the post-removal script subprocess failed.

The friendly-recovery post-removal script is /var/lib/dpkg/info/friendly-recovery.postrm.

You can bypass this script by replacing its entire contents with this:

exit 0

Here is a series of commands that can do this for you and remove friendly-recovery:

echo -e '#!/bin/sh\nexit 0' | sudo tee /var/lib/dpkg/info/friendly-recovery.postrm
sudo chmod +x /var/lib/dpkg/info/friendly-recovery.postrm
sudo dpkg -P friendly-recovery

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.