Change Default Host Names

From ubermix Wiki
Jump to: navigation, search

In order to ensure that every device has a unique hostname for Dynamic DNS (and because unique hostnames are simply good form), the ubermix automatically assigns a hostname on first boot to every device it is installed on. This hostname, by default, is set to the word "system" followed by a "-" and the last 3 octets of the device's ethernet card MAC address. So, for example, of my device's ethernet card has a MAC address of 18:03:73:78:36:67, on first boot my device's hostname will be set to "system-783667". While this works fine for most installations, some people would prefer to set hostnames to something else.

If you would like to set the hostname to something else, you have two options:

  1. Set your hostnames manually on each device, disabling the script entirely
  2. Alter the hostname script that sets the hostname by adding your own customizations


Setting the hostname manually:

As of ubermix version 0.913, setting hostnames manually is super-easy. Simply boot your device off of any ubermix install key, choose option "5. Expert Options" then option "5. Set device hostname". This disables the auto set script and sets the machine to the hostname you desire. Please note: You probably do not want to do this on a machine you plan to use for a master image (see Customization), or all of your machines will have the same hostname (which is probably not good).


To alter the hostname script, do the following:

  1. Boot or reboot your machine, and press "esc" when the screen goes blank immediately after showing the model specific splash screen.
  2. Select "Normal Boot" and press the "e" key on your keyboard
  3. Select the line in the box that begins with the word "initrd" and move the cursor to the end of the line. Backspace over the four letters "aufs" and replace them with "generic". Do not add any spaces.
  4. Press "ctrl-x" to boot your machine
  5. When your machine finishes booting up, open a terminal (ctrl-alt-t) and type the following: sudo gedit /usr/local/bin/update-hostname
  6. Locate the following section of the script, and change the three instances of the word "system" to whatever you like. Be careful not to delete the "\t" before the word "system" in the second instance:
if  ! $FOUND; then
	echo "system-$ETH_ADDR" >/etc/hostname
	sed -i "s/127.0.1.1.*$/127.0.1.1\tsystem-$ETH_ADDR/g" /etc/hosts
	if `mount | grep -q "SYSTEM on /ro"`; then
		mount -o rw,remount /ro
		cp /etc/hostname /ro/etc/hostname
		cp /etc/hosts /ro/etc/hosts
		mount -o ro,remount /ro
	fi
	hostname "system-$ETH_ADDR"
fi

When you are done, save your changes, reboot, and all future machines will use your new scheme.