Closed revantjhalani closed 3 years ago
if you are up to date, it is <nnn>. There is a .1% of 2 hosts having the same name. Also, look at the comitup.conf file.
The conf only specifies how to add the hostname in the ssid, what I'd like to do is the opposite.
I'd like to add the number
True, but they also advertise on mdns as comitup-<nnn>.local.
There is automatic deconfliction with the "raspberrypi" name (on mdns). I have "raspberrypi" and "raspberrypi-2" on my network now. I've not looked into how that is managed.
This would be a decent addition to the Comitup Image. The package, though, should not be changing hostnames.
The latest comitup image sets the hostname to the AP name on first boot.
In the new image, I keep running across the error "unable to resolve host comitup-931: Name or service not known" while invoking any system commands. I haven't had a chance to look at the hosts and hostname files, I'll try to recreate the issue in a while, but thought that this could just be the behavior at the first system startup since you're now changing the hostname at runtime. Is that the case?
I haven't seen this.
Hi David - first of all thank you for this project - it has become my starting point for every project recently! I have also been receiving this issue on the new image too (2021-03-17) - I am able to recreate it when running anything preceded with sudo.
eg. on first boot - my first action is to update the ap_name variable in /etc/comitup.conf (to "product-
# Change hostname to device-$MACADDRESS
pi@comitup-591:~ $ sudo hostname device-$(cat /sys/class/net/wlan0/address | sed -e 's/://g')
sudo: unable to resolve host comitup-591: Name or service not known
A quick google found me here: https://www.globo.tech/learning-center/sudo-unable-to-resolve-host-explained/
And the apparent solution is to include a loopback in /etc/hosts to the given hostname ie.
127.0.0.1 mynewhostname
I also found a way to change the /etc/hosts file programmatically - here's the full bash script below
#!/bin/bash
# Set Hostname
echo "Setting hostname..."
NEWHOSTNAME=$(cat /sys/class/net/wlan0/address | sed -e 's/://g')
sudo hostname device-$NEWHOSTNAME
# Add loopback to /etc/hosts file
echo "Adding loopback to /etc/hosts file..."
echo "127.0.0.1 device-$NEWHOSTNAME" | sudo tee -a /etc/hosts
Some notable strange behaviour that might be related:
I hope this helps.
Possibly related: Is there a way to force a new
The persistent random number is stored in /var/lib/comitup/comitup.json. If it is set before comitup runs, it will not be overwritten.
The service that sets the host name runs exactly once, then self-deletes. In general, I don't want Comitup messing with hostnames.
The new ap_name variables currently require an "apt-get upgrade" to come alive.
And the apparent solution is to include a loopback in /etc/hosts to the given hostname
A disk image with this change is uploading now.
If there are multiple comitup devices on the same network, there's bound to be hostname conflicts. Is there any inbuilt way to also change the hostname to the comitup- variable?