The aptpkg uninstall operation needs to inherit DPKG_ENV_VARS set above as install and upgrade currently do.

Without this packages that prompt on removal cause that state to hang. resolvconf in particular prompts you with a warning about rebooting your system after removal.