See also the comments in 
https://unix.stackexchange.com/questions/106614/preseed-cfg-ignoring-hostname-setting,
 and in particular the reference to
http://d-i.alioth.debian.org/manual/en.i386/apbs04.html#preseed-network
The hostname is probably a very common case though.


I am currently using this in my preseed file (tested with Ubuntu 16.04.2 
mini.iso):

d-i preseed/early_command string hostname=ubuntu; \
    sed "s/^127.0.1.1\t.*/127.0.1.1\t$hostname/" -i /etc/hosts; \
    echo "$hostname" > /etc/hostname; hostname "$hostname"

Proposal: revert the current patch and suggest the above preseed config *or* 
modify preseed:
1. Change sed commands to something like the above.
2. Remove "f ! echo "$RET" | grep -q 'ubuntu';" such that the hostname is 
unconditionally set when netcfg/hostname is given.

Note that "127.0.1.1\t%s" originates from netcfg-1.135ubuntu4.2,
function netcfg_write_common in netcfg-common.c. This exact match does
not rely on the current hostname which should possible regex injection
issues.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1452202

Title:
  ubuntu preseed install fails to set a hostname

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/debian-installer/+bug/1452202/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to