Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using the CentOS 6 netinstall ISO with some kickstart files on an http server. When the ISO boots I hit TAB and enter the boot options asknetwork ks=http://<ip-address>/path/to/kickstart.ks.

My kickstart files do not have a network parameter, so it should be prompting. When I leave out asknetwork it tries to use DHCP. With asknetwork it only prompts for IP information.

Unfortunately anaconda is hell bent on automatically discovering the hostname, which ends up being a reverse DNS lookup of the IP, or localhost.localdomain if nothing was found.

Is there a way to make anaconda prompt for the hostname, or some way to pre-enter it through a custom boot option?

There used to be network --bootproto=query for CentOS 5, but this no longer works in 6.

share|improve this question
    
There used to be network --bootproto=query for CentOS 5, but this no longer works in 6. It is still there, and it works (I used it a few weeks ago). The trick seems to be that if the Kernel passes on any network information to Anaconda, then --bootproto-query will silently be ignored. –  Stefan Lasiewski Jan 28 '13 at 23:00

2 Answers 2

I set the hostname in the kickstart file directly.

If you're trying to reuse the same template, you could get creative and use a bit of PHP to pass something to the installer. Kickstart files are http, so you could do something like:

ks=http://repo.brazzers.com/ks/kickstart.php?hostname=kitty

...where kitty is a variable in the kickstart file that populates the --hostname= parameter

Or the better route is to use a more robust provisioning framework like Cobbler.

share|improve this answer
    
You naughty man! :-) –  Andrew Smith Oct 23 '12 at 19:29
    
Why not simply pass "myname=kitty" and parse /proc/cmdline in the %post-section of kickstart? –  Nils Oct 24 '12 at 19:46
    
I was thinking of PHP in the context of a larger solution. I prefer Cobbler, regardless. –  ewwhite Oct 24 '12 at 20:02

I was trying to do this with virt-install and found a blog article with an excellent solution to this. The solution uses the /proc/cmdlines passed to the kernel at boot time to extract a hostname using a pre kickstart section and write a temporary file that is then included in the main kickstart section.

http://monzell.com/post/15547967527/automatically-set-the-hostname-during-kickstart

The blog was for kickstarting VMs in KVM. But I don't see any reason this wouldn't work in any other kickstart scenario where you can pass the kernel boot arguments easily.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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