Ubuntu Server installer mistreats hostname special characters

Bug #1996639 reported by Dominik Szymański
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
debian-installer (Ubuntu)
New
Undecided
Unassigned

Bug Description

TL;DR;: Installer trimmed bad characters from hostname, but put my input literally into /etc/hosts

I was installing Ubuntu Server in vmware from freshly downloaded ISO from your webpage.
`lsb_release -rd` output after finish:
Description: Ubuntu 22.04.1 LTS
Release: 22.04

CRC32 of image: 3d73cc1f

It asked me to update installer so I did (not sure which exactly version it was).

After some steps of me not choosing any extra packages, formatting whole drive, selecting network showed up form to put in my name, hostname, username and password.

Into the hostname field I've put:

mac_ubuntu

Nothing complained so I went with it no problem (although I think "Installing kernel" step took weirdly lot of time, but that might be unconnected).

After install I logged in into SSH and noticed prompt being:

dominik@macubuntu:~$

So I though: no biggie, it trimmed the chars it didn't like, and that's probbaly what happened.

However I noticed `sudo` taking long time. Little search pointed me to the answer, that `/etc/hosts` file might be missing 127.0.0.1 entry for my hostname, and so it ended up being!

Result of `hostname`:

macubuntu

Contents of `/etc/hosts`:

127.0.0.1 localhost
127.0.1.1 mac_ubuntu

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

And as you can see, entry for 127.0.1.1 is what I've originally put into the installer form, not what machine thinks hostname is.
After adding entry:

127.0.0.1 macubuntu

Sudo started behaving.

It's most probably low priority issue, affecting slim percentage of people, but sanitizing input or even validating that user puts only allowed chars in there could be a great idea.

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.