Remove software installed by an update module

Description

Is there a way to remove software installed by an update module? E.g. If I install functionality on a set of devices via an update module and later want to remove it because it is on longer needed.

I can see that we could write an update module in such a way that it deleted the files for the installed software instead of adding new ones from an artifact, based on the contents of the artifact being processed. But in this case, the mender-client will still report that the software is installed (perhaps with deleted as the version number if the artifact was built that way). It would perhaps be cleaner to remove all references to the software from the device. Is there any supported functionality for this, or would we need to write software that e.g. interacted with the mender-store database directly?

I’m just going to assume that you used the directory update module. It doesn’t support removing files, but you can replace the whole directory with some dummy text file which says “this application has been uninstalled”, or something like that.

With regards to the installed software information, this information can be removed with an artifact, but you need some hand crafting. Make sure you add these parameters when running the directory-artifact-gen:

directory-artifact-gen <...other-arguments...> \
    -- \
    --no-default-software-version \
    --clears-provides 'rootfs-image.directory.*'

The --clears-provides argument may need to be adjusted if you had different values here. See mender show-provides on the device to see exactly what is installed.

Thanks Kristian

We’re writing our own module, but it’s essentially a directory installer with some additional constraints and checking. I’ll take a look at the directory update module and directory-artifact-gen to see how the --no-default-software-version and --clears-provides arguments are used and see if we can make something similar work.