Skip to content
This repository has been archived by the owner on Mar 2, 2021. It is now read-only.

Setting hostname on boot doesn't affect avahi #4

Closed
StefanScherer opened this issue Feb 11, 2016 · 3 comments
Closed

Setting hostname on boot doesn't affect avahi #4

StefanScherer opened this issue Feb 11, 2016 · 3 comments

Comments

@StefanScherer
Copy link
Member

I have added a /boot/device-init.yaml file on a running RPi2 with

hostname: "new"

Then I rebooted with sudo reboot.

After rebooting I couldn't ssh into the renamed machine with ssh pirate@new.local, but still with ssh pirate@black-pearl.local.

Investigating the /var/log/syslog after the reboot with sudo grep 'avahi\|device-init' /var/log/syslog shows that the device-init rename is too late:

Feb 11 18:21:59 black-pearl avahi-daemon[195]: Found user 'avahi' (UID 105) and group 'avahi' (GID 111).
Feb 11 18:21:59 black-pearl avahi-daemon[195]: Successfully dropped root privileges.
Feb 11 18:21:59 black-pearl avahi-daemon[195]: avahi-daemon 0.6.31 starting up.
Feb 11 18:21:59 black-pearl avahi-daemon[195]: WARNING: No NSS support for mDNS detected, consider installing nss-mdns!
Feb 11 18:21:59 black-pearl avahi-daemon[195]: Successfully called chroot().
Feb 11 18:21:59 black-pearl avahi-daemon[195]: Successfully dropped remaining capabilities.
Feb 11 18:21:59 black-pearl avahi-daemon[204]: chroot.c: open() failed: No such file or directory
Feb 11 18:21:59 black-pearl avahi-daemon[195]: Failed to open /etc/resolv.conf: Invalid argument
Feb 11 18:21:59 black-pearl avahi-daemon[195]: No service file found in /etc/avahi/services.
Feb 11 18:21:59 black-pearl avahi-daemon[195]: Network interface enumeration completed.
Feb 11 18:21:59 black-pearl avahi-daemon[195]: Registering HINFO record with values 'ARMV7L'/'LINUX'.
Feb 11 18:21:59 black-pearl avahi-daemon[195]: Server startup complete. Host name is black-pearl.local. Local service cookie is 1581608388.
Feb 11 18:21:59 black-pearl systemd[1]: Starting device-init...
Feb 11 18:22:00 black-pearl device-init[224]: Using config file: /boot/device-init.yaml
Feb 11 18:22:00 black-pearl device-init[224]: Set hostname: new
Feb 11 18:22:00 black-pearl systemd[1]: Started device-init.
Feb 11 18:22:00 black-pearl avahi-daemon[195]: Joining mDNS multicast group on interface eth0.IPv4 with address 192.168.1.203.
Feb 11 18:22:00 black-pearl avahi-daemon[195]: New relevant interface eth0.IPv4 for mDNS.
Feb 11 18:22:00 black-pearl avahi-daemon[195]: Registering new address record for 192.168.1.203 on eth0.IPv4.
Feb 11 18:22:02 black-pearl avahi-daemon[195]: Joining mDNS multicast group on interface eth0.IPv6 with address fe80::ba27:ebff:feed:7480.
Feb 11 18:22:02 black-pearl avahi-daemon[195]: New relevant interface eth0.IPv6 for mDNS.
Feb 11 18:22:02 black-pearl avahi-daemon[195]: Registering new address record for fe80::ba27:ebff:feed:7480 on eth0.*.
Feb 11 18:22:02 black-pearl avahi-daemon[195]: Joining mDNS multicast group on interface docker0.IPv4 with address 172.17.0.1.
Feb 11 18:22:02 black-pearl avahi-daemon[195]: New relevant interface docker0.IPv4 for mDNS.
Feb 11 18:22:02 black-pearl avahi-daemon[195]: Registering new address record for 172.17.0.1 on docker0.IPv4.

So we have to change service dependencies to change boot order.

@StefanScherer
Copy link
Member Author

This is what occi did: https://github.com/adafruit/Adafruit-Occi/blob/master/usr/bin/occi#L188-L194

if hostname changed and avahi-daemon installed then restart avahi-daemon

@Govinda-Fichtner
Copy link
Collaborator

@StefanScherer I know what occi did. I looked at it while I implemented device-init. I left out the avahi part intentionally as I was not sure if we would need it.

We would only need it if we have a running avahi daemon and are changing the hostname.
As I understand it this is not related to the boot order of device-init, is it?

@Govinda-Fichtner
Copy link
Collaborator

Fixed with fda11e9.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants