Host FQDN and Hypervisor hostname perceived by libvirt are different on ubuntu22.04 multipass virsh

Bug #2030349 reported by JamesLin
44
This bug affects 9 people
Affects Status Importance Assigned to Milestone
OpenStack Snap
Triaged
High
Guillaume Boutry

Bug Description

On host machine(ubuntu22.04)

```
$ multipass get local.driver
libvirt

$ multipass --version
multipass 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'])
```

JamesLin (jneo8)
description: updated
Revision history for this message
ERDEM AĞBAHCA (aerdow) wrote :

@JamesLin

I encountered the same problem. When you change the hostname to something else and re run "sunbeam cluster bootstrap --accept-defaults" it works. Surely this is not an explanation to the bug but it can be assumed as a workaround.

For example:
cat /etc/hostname is: oldone
hostname -f output is: oldone.oldopenstacknetwork

Revision history for this message
JamesLin (jneo8) wrote (last edit ):

Hi @aerdow

What I expect is the smoothly user experience between multipass and sunbeam integrate together, so I don't need to provide any workaround. But still thanks for your work around solution.

Revision history for this message
philippe (philhay) wrote :
Download full text (6.6 KiB)

Hello All,

I have same problem, appears each time.

I made a fresh install from kubuntu 22.04 LTS. Twice, one with docker and git install first, second one directly following install process of microstack describe here https://microstack.run/?_ga=2.213454557.874672970.1693812924-1742046544.1693812924#get-started.

workaround from Erdem does not work.

Hypervisor hostname perceived by libvirt should be displayed to have a useful error message ...

Full steps and traces

phil@phil-dell:~$ sudo snap install multipass
[sudo] password for phil:
multipass 1.12.2 from Canonical✓ installed
phil@phil-dell:~$ multipass launch --name microstack --cpus 4 --memory 16G --disk 50G && multipass shell microstack
Launched: microstack
Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-83-generic x86_64)

 * Documentation: https://help.ubuntu.com
 * Management: https://landscape.canonical.com
 * Support: https://ubuntu.com/advantage

  System information as of Sat Sep 16 07:59:50 UTC 2023

  System load: 0.4677734375 Processes: 138
  Usage of /: 2.9% of 48.27GB Users logged in: 0
  Memory usage: 1% IPv4 address for ens3: 10.158.141.207
  Swap usage: 0%

Expanded Security Maintenance for Applications is not enabled.

0 updates can be applied immediately.

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status

To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
ubuntu@microstack:~$ sudo snap install openstack
openstack (2023.1/stable) 2023.1 from Canonical✓ installed

ubuntu@microstack:~$ sudo snap install openstack
openstack (2023.1/stable) 2023.1 from Canonical✓ installed
ubuntu@microstack:~$ sunbeam prepare-node-script | bash -x && newgrp snap_daemon
++ lsb_release -sc
+ '[' jammy '!=' jammy ']'
++ whoami
+ USER=ubuntu
+ SUDO_ASKPASS=/bin/false
+ sudo -A whoami
+ sudo grep -r ubuntu /etc/sudoers /etc/sudoers.d
+ grep NOPASSWD:ALL
+ dpkg -s openssh-server
+ echo 'fs.inotify.max_user_instances = 1024'
+ sudo tee /etc/sysctl.d/80-sunbeam.conf
fs.inotify.max_user_instances = 1024
+ sudo sysctl -q -p /etc/sysctl.d/80-sunbeam.conf
+ sudo snap connect openstack:ssh-keys
+ sudo addgroup ubuntu snap_daemon
Adding user `ubuntu' to group `snap_daemon' ...
Adding user ubuntu to group snap_daemon
Done.
+ newgrp snap_daemon
Generating public/private rsa key pair.
Your identification has been saved in /home/ubuntu/.ssh/id_rsa
Your public key has been saved in /home/ubuntu/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:QQDHfeM0hFuJYDqM8b6/j4kju8s0a0QJ28q+QiV+21c ubuntu@microstack
The keys randomart image is:
+---[RSA 4096]----+
| . .o=+.+.. |
|. = +..+ B |
| +..= .* o |
|..+o . ... |
|ooo . S |
|.+.. . E |
|o.+ + . |
|.+o+.+ + |
|.oB=..*o. |
+----[SHA256]-----+
# 10.158.141.207:22 SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.3
# 10.158.141.207:22 SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.3
# 10.158.141.207:22 SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.3
# 10.158.141.207:22 SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.3
# 10.158.141.207:22 SSH-2.0-OpenSSH_8...

Read more...

Revision history for this message
Brian (bsinger98) wrote :

I also have the same issue as above both using multipass and on bare-metal.

Revision history for this message
Marian Gasparovic (marosg) wrote :

I can see this with 2023.1/stable in mutlipass.

For what it's worth when I added my IP to /etc/hosts I don't get the error

Changed in snap-openstack:
assignee: nobody → Guillaume Boutry (gboutry)
importance: Undecided → High
status: New → Triaged
Revision history for this message
Guillaume Boutry (gboutry) wrote :

Multipass is currently not configuring the fqdn correctly.

hostname --long should return microstack.multipass but does not.

As workaround you can create a cloud init file with:
#cloud-config
fqdn: microstack.multipass

And run:
multipass launch --name microstack --cloud-init cloud-init.yaml --cpus 4 --memory 16G --disk 50G && multipass shell microstack

I've created an issue on multipass repository, and I will follow up depending on the progress: https://github.com/canonical/multipass/issues/3277

Revision history for this message
Robert Gildein (rgildein) wrote :

Same issue for me and the workaround provided by @gboutry helped with it.

Revision history for this message
Bee (cyber-bee) wrote :

I modify /etc/hosts such that:

127.0.1.1 microstack

becomes

127.0.1.1 microstack.multipass

.. I also added the line ...

my.vm.ip.number microstack.multipass

This seemed to work.

Revision history for this message
Calvin Hartwell (calvinh) wrote :

Hi folks,

I'm not using multipass, but hit this issue on a brand new machine install on a single bare-metal node running a fresh install of Ubuntu Server 22.04.3 LTS.

My original hostname was calvinh-openstack and I could not see any obvious issue with the resolution. I changed my hostname based on @aerdow's feedback and it seemed to progress, but the issue should be studied further.

I changed my hostname to openstack.host and it progressed:
 > hostname openstack.host
 > hostnamectl set-hostname openstack.host

Revision history for this message
Scott Storck (scttstrck) wrote :

I was also able to resolve this issue by adding my nodes name and IP combination to /etc/hosts file as IP FQDN NAME.

for example
192.168.1.1 node1.lab node1

Revision history for this message
Szilard Cserey (szilard.cserey) wrote (last edit ):

Following this tutorial
https://microstack.run/docs/single-node

I was executing "sunbeam cluster bootstrap --accept-defaults" in a multipass created VM instance,
got the same error message and was able to resolve it by

CHANGING in /etc/hosts

FROM
127.0.1.1 microstack microstack

TO
127.0.1.1 microstack.multipass microstack

hostname -f
microstack

Szilard

Revision history for this message
Gonkers (gonkers) wrote :

This is completely asinine, but what @szilard.cserey suggested worked for me. In my /etc/hosts file I added
an additional host entry for 127.0.1.1 that appended `.multipass` on to my normal hostname.

FROM
127.0.1.1 openstack-demo

TO
127.0.1.1 openstack-demo.multipass openstack-demo

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.