Comment 0 for bug 2030349

Revision history for this message
JamesLin (jneo8) wrote :

On host machine(ubuntu22.04)

```
$ multipass get local.driver
libvirt

$ multipass --version
multipass 1.12.2
multipassd 1.12.2

$ virsh --version
8.0.0

# Use this line to create vm
$ multipass launch -c 4 -m 16G -d 50G https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img -vvvv -n sunbeam
```

Inside multipass sunbeam

```
$ sunbeam cluster bootstrap --accept-defaults
Error: Host FQDN and Hypervisor hostname perceived by libvirt are different, check `hostname -f` and `/etc/hosts` file

$ ip -c a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:79:8b:41 brd ff:ff:ff:ff:ff:ff
    altname enp0s3
    inet 10.78.137.122/24 metric 100 brd 10.78.137.255 scope global dynamic ens3
       valid_lft 3138sec preferred_lft 3138sec
    inet6 fe80::5054:ff:fe79:8b41/64 scope link
       valid_lft forever preferred_lft forever

$ cat /etc/hosts
# Your system has configured 'manage_etc_hosts' as True.
# As a result, if you wish for changes to this file to persist
# then you will need to either
# a.) make changes to the master file in /etc/cloud/templates/hosts.debian.tmpl
# b.) change or remove the value of 'manage_etc_hosts' in
# /etc/cloud/cloud.cfg or cloud-config from user-data
#
127.0.1.1 sunbeam sunbeam
127.0.0.1 localhost

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

$ hostname -f
sunbeam
```

Debug

```
>>> from sunbeam import utils
>>> utils.get_hypervisor_hostname()
'sunbeam'
>>> utils.get_fqdn()
'sunbeam.multipass'
>>> utils.get_local_ip_by_default_route()
'10.78.137.122'

>>> socket.gethostbyaddr("127.0.1.1")
('sunbeam', ['sunbeam'], ['127.0.1.1'])
>>> socket.gethostbyaddr("127.0.0.1")
('localhost', [], ['127.0.0.1'])
>>> socket.gethostbyaddr("10.78.137.122")
('sunbeam.multipass', [], ['10.78.137.122'])
```