Schwemmlandebene Posted May 22, 2016 Posted May 22, 2016 Hallo, the Armbian Debian jessie dhclient does not handle a served hostname reliable. Deleting /etc/hostname (or replacing it with an empty file) and setting the hostname option at the DHCP Server doesn't always work. In some cases the Armbian client still has its default name 'bananapim2'. http://blog.schlomo.schapiro.org/2013/11/setting-hostname-from-dhcp-in-debian.html describes the problem, a cause and a solution. Sadly, setting the hostname from DHCP is not trivial in Debian, here is the result of my research into the topic. I found 2 things to be essential and learned both of them by analysing the dhclient script. 1. Set the hostname to localhostThe first thing to do is to set the system hostname to localhost: # echo localhost >/etc/hostname 2. Workaround for broken dhclient-scriptThe dhclient-script has (IMHO) a bug: If there is an old DHCP lease with a hostname in the lease database (e.g. in /var/lib/dhcp/dhclient.eth0.leases), then the script will not set the hostname from DHCP even if the system name is still localhost. To circumvent this bug simply create a dhclient enter hook to unset the old host name variable: # echo unset old_host_name \ >/etc/dhcp/dhclient-enter-hooks.d/unset_old_hostname The result is that now the hostname will be always set from DHCP, even if something went wrong or if there are old lease infos. I can confirm the problem with the leases file. Following step 2 works for me. It would be really fine if the unset_old_hostname file could be added to Armbian by default. Kind regards, Steve
MichaGue Posted July 13, 2016 Posted July 13, 2016 Thanks for the solution. I have the same problem running armbian wheezy on a banana pi. But I am a complete newbie to linux. Could you explane your workaround in step 2 a bit more precise? Which single steps have to be done? Thanks for your help. Best regards, Michael
Recommended Posts