Snap install network-manager blocks further snap installs

Hei,

running Ubuntu 20.04 in VMWare hosted machine and if I install network-manager, I can’t do any other snap installs anymore. They fail due to network issues. It somehow seems that the network-manager seems to screw up the networking for the machine and you can do further installations only after a reboot.

Anyone else noticed something like this?

Host OS / Linux:

Linux ubuntu-20-04 5.15.0-69-generic #76~20.04.1-Ubuntu SMP Mon Mar 20 15:54:19 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Reproduction steps.

# Check if network-manager and modem-manager have been
# installed and if not, install them.
nwmgr=$(snap list |grep network-manager) || true
if [ -z "${nwmgr}" ] ; then
  echo "Install network-manager snap."
  snap install network-manager
else
  echo "Snap network-manager already installed."
fi

mdmmgr=$(snap list |grep modem-manager) || true
if [[ -z "${mdmmgr}" ]]; then
  echo "Install modem-manager snap."
  snap install modem-manager
else
  echo "Snap modem-manager already installed."
fi

This fails then with:

+ snap install modem-manager error: cannot install "modem-manager": persistent network error: Post https://api.snapcraft.io/v2/snaps/refresh : dial tcp: lookup api.snapcraft.io : Temporary failure in name resolution