I modified the host file via command-line, and did a reboot. My server booted but with a lot of failed services: webmin, usermin, etc…even my netplan config was messed up.
As it was on a VM, I was able to login via console and change the host-file content to what it was before…to recover the server.
There is nothing special about modifying /etc/hosts in a Virtualmin system. It’s not one of our files and not something we modify the behavior of. We only touch it during install if your system doesn’t even have a fully qualified domain name when the installer is run (we’d rather you got that right before the installation so we don’t have to make any changes).
But, this is either not an /etc/hosts file issue (because Webmin and Usermin do not require anything specific of your hosts file), or you have an additional problem with your configuration…hosts file changes almost certainly cannot cause what you’re describing, even if you do it wrong. (But, maybe I’m wrong. I’ve never really messed up a hosts file in significant ways.)