Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Setting hostname from DHCP unreliable

Featured Replies

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 localhost
The first thing to do is to set the system hostname to localhost:
 
    # echo localhost >/etc/hostname
 
2. Workaround for broken dhclient-script
The 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

 

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

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.