task/2505957: Add retries for package installation/uninstallation

Note that 'N of N tests passed' is still displayed upon failure.

Tested by killing the simulator as packages are installed and uninstalled.