My newly installed Ubuntu shows lele-ThinkPad-X230 as its hostname. I downloaded debian-installer and ubuntu-installer (ubiquity) to see the code, but found nothing useful about this. Is this DHCP or some hardware database?

lele-ThinkPad-X230, split by dash: the first lele is my username, and the rest is the machine name (by Lenovo). So how does the installer get this when I input no hostname?

  • Great question, it freaked me out when it appeared to know things about my network.
    – Ian
    Jan 30, 2018 at 4:31

4 Answers 4


The Debian and Ubuntu installers both get their hostname through DHCP, as most DHCP servers provide this along with the lease.

For example, running the Ubuntu GUI installer on my Windows laptop suggests a hostname of "Ed-PC", as this was the name I assigned under Windows, and when I requested the DHCP lease.

As per the Debian installation documentation at https://www.debian.org/releases/stable/amd64/ch03s03.html.en#idp52296784:

If the network you are connected to uses DHCP (Dynamic Host Configuration Protocol) for configuring network settings, you don't need this information because the DHCP server will provide it directly to your computer during the installation process.

  • I'm not sure what you mean by this, this is where the Ubuntu graphical and alternative installer gets it's hostname - clearing all leases or not using DHCP causes the installer to use the hardware name.
    – user117882
    Jun 7, 2015 at 21:14

When I used Ubuntu I believe it used lele-laptop.

There's a debian package called laptop-detect. It's yes/no test which is then used for extra setup for laptops. Ubuntu would have used this for the '-laptop' suffix.

The manpage for laptop-detect references dmidecode. dmidecode reports naming information for the machine like "Thinkpad X230" (and presumably enough information to decide whether it's a laptop). It doesn't require a massive hardware database, it just relies on the vendor providing helpful information in the firmware (heh).

Putting the name of the hardware into the hostname could be a logical extension.

I think I've seen some Windows version setting it similarly but just using the vendor (e.g. Lenovo)... though AFAIK it could have been a vendor modification to the OS.

A DHCP mechanism is possible - if what you're seeing exactly matched a previous hostname of the laptop. However it seems unlikely, and Ubuntu would have to implement it explicitly - I can't see why they would do it.


You can set the systems hostname by editing the file /etc/hostname You should also edit /etc/hosts and update it if it appears there.

  • Thanks, I know this, but I just want to find out how they(debian-installer or ubuntu installer) get to guess it out.
    – schemacs
    Mar 29, 2014 at 5:21

hostname package is responsible for creating /etc/init/hostname.conf file which inturn set the system hostname.This package is preinstalled on your Ubuntu OS(default).

$ dpkg -S /etc/init/hostname.conf
hostname: /etc/init/hostname.conf

$ cat /etc/init/hostname.conf
# This task is run on startup to set the system hostname from /etc/hostname,
# falling back to "localhost" if that file is not readable or is empty and
# no hostname has yet been set.

description     "set system hostname"

start on startup

exec hostname -b -F /etc/hostname

From man hostname

 When  called  without  any  arguments, the program displays the current

 hostname will print the name of the system as returned by the  gethost‐
   name(2) function.
  • How they get it right at the first time(installation)?
    – schemacs
    Mar 31, 2014 at 15:08
  • terminal holds on dpkg command. does this conf file show manual?
    – diEcho
    Dec 9, 2014 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.