Removing /etc/hostname results in failed first login attempt

Bug #1007221 reported by Lincoln Smith
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
lightdm (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

We assign hostnames to machines using dhcp. For this to work in 12.04 you seem to have to remove /etc/hostname (or have it empty, the behaviour is the same). However doing this results in the first attempted graphical login after boot failing. I have reproduced this behaviour across several machines, from upgrades and clean installations, and can turn it on and off by removing /etc/hostname, or making it non-empty.

The symptoms are:
- At the greeter prompt the hostname at screen top left is set to localhost
- If I switch to a console prompt the hostname displays correctly (i.e. not localhost)
- After successfully entering a uname/pwd you briefly get a desktop for one second or so, then it drops to the console for half a sec or so, then the greeter re-appears.
- Once the greeter re-appears the hostname will be set correctly at screen top left, and subsequents logins successfully proceed to the desktop

.x-session-errors has some lines about xrdb being unable to open display:0, other logs in /var/log/lightdm/ seem ok, but I'll include them too. I've run strace -ff -p <lightdm> but am not familiar enough with the graphical login process to make much headway there, and I've yet to turn up an obvious - to me - error, though paging through strace output tends to make ones eyes glaze over :)

Curiously I can't replicate this in a VBox VM. Fresh install, exact same configuration but it displays the hostname properly at screen top left and the first login proceeds normally. I will make the VM name and dhcp hostname different and see if this reveals the bug.

Regards

Revision history for this message
Lincoln Smith (lincoln-smith) wrote :
Revision history for this message
Lincoln Smith (lincoln-smith) wrote :
Revision history for this message
Lincoln Smith (lincoln-smith) wrote :
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your bug report, the session log suggests the issue is not lightdm but rather the xorg session cookie (but maybe lightdm doesn't pick up the correct hostname to create the Xauthority)

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

So there are multiple aspects to this, one of which being the process used for the installation.

At installation, is the same DHCP used? Proceeding with an installation on the network should be receiving the same IP address as it would on a "normal" boot after install; and default to the DHCP-received hostname.

Revision history for this message
Lincoln Smith (lincoln-smith) wrote :

Mathieu,

In this case yes, installation was done on the same network so the same DHCP server and lease info was used/received. Doing a standard install from a live disk Ubuntu doesn't seem to use the DHCP supplied hostname: the live disk hostname is ubuntu, and the gui installer auto-generates a hostname from the user information + hardware info (like model string from BIOS). The installer won't let you have a blank hostname. At no point during installation do I see or get the option to use the DHCP supplied hostname.

As an update re: virtual machines I can't replicate this at all on a VBox VM, but have no trouble reproducing it on bare metal.

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Indeed, ubiquity doesn't bother with checking the DHCP host name. Perhaps it should -- that would be a bug in ubiquity. This is possibly why you can't replicate the issue on virtual machines, in this case are you using the alternate installer?

Regardless, it's not really supported to remove /etc/hostname. The file should instead be modified if the hostname for the system changes, along with /etc/hosts (since it contains a "pointer" to 127.0.1.1 for that name). At the same time, if lightdm fails to find the hostname (which is "normal" if it's just looking for it in /etc/hostname), it's behaving correctly in showing "localhost". What *is* broken is that the desktop doesn't continue to load cleanly and instead falls back to the greeter.

There needs to be some more investigation at the lightdm level for this; for the reasons listed by Sebastien.

Revision history for this message
Lincoln Smith (lincoln-smith) wrote : Re: [Bug 1007221] Re: Removing /etc/hostname results in failed first login attempt

On 05/06/12 06:42, Mathieu Trudel-Lapierre wrote:
> Indeed, ubiquity doesn't bother with checking the DHCP host name.
> Perhaps it should -- that would be a bug in ubiquity. This is possibly
> why you can't replicate the issue on virtual machines, in this case are
> you using the alternate installer?

No, all installations have been done from scratch using the standard
installer, except for one which was an upgrade from 10.04.

>
> Regardless, it's not really supported to remove /etc/hostname. The file
> should instead be modified if the hostname for the system changes, along
> with /etc/hosts (since it contains a "pointer" to 127.0.1.1 for that
> name). At the same time, if lightdm fails to find the hostname (which is
> "normal" if it's just looking for it in /etc/hostname), it's behaving
> correctly in showing "localhost".

Yeah I'm aware removing /etc/hostname isn't a good move.

The story of how I ended up down this path is that in 10.04 you could
set /etc/hostname to the magic string "(none)" and the DHCP supplied
hostname would be honored. On my desktop the upgrade to 12.04 removed
/etc/hostname (it had the magic string), and so I figured that was no
longer supported. However the DHCP supplied hostname was still honored,
though I had this login bug. There didn't seem to be another way to
have the DHCP hostname honored.

Having the DHCP hostname honored is convenient for us as it simplifies
image deployment. Blat the image onto the desktop, stick it on the
network, it picks up its hostname from DHCP and off we go, minimal
intervention required. It's not a huge hassle to change /etc/hostname
post image deployment, but it's something we didn't used to have to do.

That may or may not have been interesting/useful to you.

> What *is* broken is that the desktop
> doesn't continue to load cleanly and instead falls back to the greeter.
>
> There needs to be some more investigation at the lightdm level for this;
> for the reasons listed by Sebastien.
>

Thanks.

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

We still need to fix up lightdm or whatever else under it to not fail when /etc/hostname is removed -> Triaged/Medium

Changed in lightdm (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.