Login and password for multipass instance

I am new to ubunto and want to run it in a VM so have installed multipass successfully and have an ubunto VM running in Hyper V. Connecting to the VM I am asked for a login and password is ther a default? or can I set them up from the multipass command line? I can' find any information in the documentation.

I have also tried using shell on a named running instance but connection failed with message "ssh connection failed: 'Failed to resolve hostname primary.mshome.net (No such host is known.)" I then tried creating an instance with just "multipass shell" command. which created a running primary with same result.

Any suggestions welcome


This might be a bit late but you can login to the instance from multipass without being asked for username and password. From there, you can set the password so that you can login using Hyper V.

First find the name of your instance

multipass list

then login to the instance in multipass

multipass shell <instance name>

Next you can set your password for the default ubuntu user

sudo passwd ubuntu

Now when you try to login using hyper v, just use ubuntu as the username and whatever password you set as the password.


TLDR

If somehow multipass shell doesn't work, you can connect it via ssh.

ssh ubuntu@vm-ip-address -i /var/snap/multipass/common/data/multipassd/ssh-keys/id_rsa

Multipass instance, by default doesn't have usable password.

$ passwd --status ubuntu
ubuntu L 04/03/2021 0 99999 7 -1

The L means Locked password.

This is on purpose

If you somehow lose access to the vm (e.g messing up with the network configuration, it happens to me :D).

You can login using the default ssh private key. You can find the private key at:

/var/snap/multipass/common/data/multipassd/ssh-keys/id_rsa

If you are installing it via snap.

You can also find it using locate.

$ locate id_rsa | grep multipass

and connect to the vm using ssh:

ssh ubuntu@vm-ip-address -i /var/snap/multipass/common/data/multipassd/ssh-keys/id_rsa

You may want to change the ownership of the ssh key to your user account. Mine currently set to root.


To find the vm ip address, it depends on the backend. Mine is using libvirt.

virsh net-dhcp-leases default