hostname is changed to username in live disk

Bug #1544228 reported by My name
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Respin
New
Undecided
Unassigned

Bug Description

Context:
Ubuntu 14.04 LTS, 64 bit, built up from the mini.iso to an ultralight system. X, lightdm & greeter, plain Openbox, no further DE, fully updated. Respin was installed from:
Respin-ub_1.0.0-1_all.deb (I think.)
with GDebi. (I think.)

On the live system my hostname is changed to be the same as my user name.

This isn't always quite as trivial as it seems. If sudoers has been modified to change the "ALL"s that denote hostnames to the local hostname (which is a darn good practice if you don't need to access to use sudo across a network, imo), you can't use sudo on the live system.

Workaround Alternative #1 (Works on the fly with a live disk you've already made):
On the booted live system, get a terminal and log in as root. Then edit the live system's /etc/sudoers (or the relevant file in /etc/sudoers.d if you've made one) to reflect the actual host name. Changing sudoers takes effect immediately. Probably the same is true of sudoers.d files but I haven't tested that. Works for me.
Alternately, you could change the hostname to match sudoers. But that takes more steps and you have to remember (or have a crib or a script) some commands you wouldn't normally use often enough to have committed them to memory. Easier to change sudoers. I haven't tested this but it should work.

Prerequisite for either of the above:
You must have enabled logging in to the root account by setting a root password with:
sudo passwd
before making the live disk. IMO, any sane person should routinely do this for all 'buntus anyway. Then you can always fix anything that goes wrong with sudo, whether on the live system or the regular HD-based one. Make a backup copy first and you can safely use any editor you want for editing sudoers and skip the awkward visudo.

Workaround Alternative #2 (better but has to be done before making a live disk):
Change the host specifications (plural because there is more than one place in sudoers where hostname(s) is specified) in sudoers on the hard drive, to recognize both the hostname on the regular system AND the hostname that will be on the live system (same as username). Or of course you can change the host specs back to "ALL". There are multiple ways to do this. Here's a convenient one.
In the section headed "# Host alias specification
" add a line like this:
Host_Alias TRUSTED_HOSTS = HostnameOnTheHDbasedSystem, YourUserName, AnyOtherHostsYouWantToTrust
and then change
%sudo whatever=(ALL:ALL) ALL
to
%sudo TRUSTED_HOSTS=(ALL:ALL) ALL
and make similar changes in other group specs if you use those groups.

Suggestion:
If you fix this, while you're at it, why not add an option in respin.conf to set the hostname for the live system? Personally I'd use $(hostname)-LIVE if it were an option. If you do that, you'd want to include a commented warning in respin.conf to the effect that if hostname specs in sudoers have been changed from ALL to make sure that the proposed hostname is allowed.

Tags: hostname
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.