Skip to main content
Topic: [SOLVED] avahi advertises the wrong hostname (Read 688 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[SOLVED] avahi advertises the wrong hostname

I have been setting up 4 qemu virtual machines to set up an aur package for testing with different inits. These are based on the isos

artix-lxde-{openrc,s6,runit,dinit}-20230814-x86_64.iso and have  hostnames artix-{openrc,s6,runit,dinit}

I have had no real troubles with virt-manager, but for some reason the s6 vm has difficulty in advertising its hostname.

On this machine instead of the expected artix-s6 I see that the avahi ssh server browser shows the advertised name as artixlinux.

Where is this coming from. I tried searching all the files under /etc using
but nothing seems to make the advertised hostname that value.

Code: [Select]
# find /etc -type f | xargs grep -l artixlinux
/etc/issue
/etc/debuginfod/artixlinux.urls
/etc/xdg/kcm-about-distrorc
/etc/pacman.d/mirrorlist
/etc/pacman.d/gnupg/pubring.gpg~
/etc/pacman.d/gnupg/pubring.gpg
/etc/skel/.config/falkon/profiles/default/settings.ini
/etc/skel/.config/falkon/profiles/default/browsedata.db
/etc/skel/.config/falkon/profiles/default/session.dat
/etc/skel/.config/xfce4/panel/whiskermenu-1.rc
/etc/skel/.local/share/epiphany/session_state.xml

Strangely sometimes I see the correct hostname in the avahi browser. It seems to go wrong most often when I reboot the vm.

Any ideas welcome.

Re: avahi advertises the wrong hostname

Reply #1
If not set elsewhere the default from the kernel is used if set.
Which on an Artix kernel is:
CONFIG_DEFAULT_HOSTNAME="artixlinux"

Rest of what you asked no clue sorry. I've always swerved avahi.

Re: avahi advertises the wrong hostname

Reply #2
If not set elsewhere the default from the kernel is used if set.
Which on with an Artix kernel is:
CONFIG_DEFAULT_HOSTNAME="artixlinux"

So I guess this must be s6 doing something odd. I have /etc/hostname containing artix-s6 and when logged in to the vm via the graphical interface the hostname command prints artix-s6. However, if at some point earlier something stores the hostname it might indeed see the default. s6 seem the most complicated of the inits. After testing them all this week I think I would order them simple to complex runit openrc systemd dinit s6.

Re: avahi advertises the wrong hostname

Reply #3
I'm not entirely sure what your workflow is, but does avahi-s6 simply just need to wait for the hostname oneshot as a dependency? It sounds like you're describing a race condition.

Re: avahi advertises the wrong hostname

Reply #4
I'm not entirely sure what your workflow is, but does avahi-s6 simply just need to wait for the hostname oneshot as a dependency? It sounds like you're describing a race condition.
I have no experience whatever of s6 so I will try and find out. I did not make changes to any of the installed service files. I tried to activate sshd and avahi-daemon. That seems to have worked as they started to run. I had to add an /etc/avahi/services/ssh.service file, but that has nothing about host name in it.

After inspection I see that avahi-daemon seems to have a dependencies.d/dbus only.  I will try adding hostname. And after s6-db-reload I think that has made a difference. Thanks for the tip. Don't know who contributes the s6 iso builds, but that might be the issue I saw.

Re: avahi advertises the wrong hostname

Reply #5
I'm not entirely sure what your workflow is, but does avahi-s6 simply just need to wait for the hostname oneshot as a dependency? It sounds like you're describing a race condition.
FWIW i use avahi-daemon merely to provide easier access to machines (or vms) by hostname. I use nss-mdns-domainless to allow use of the hostname alone (no .local needed). So when testing I can ssh artix-dinit without worrying about ip addresses etc etc.

 

Re: avahi advertises the wrong hostname

Reply #6
Don't know who contributes the s6 iso builds, but that might be the issue I saw.

I can update the avahi-s6 package to provide the hostname dependency. The isos just build from the packages in the repos.