Find the answer to your Linux question:
Results 1 to 7 of 7
Hello everyone, I need help running my first boot script. M using CentOS 6.4. the script i have is suppose to change the network configuration. and it is suppose to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2012
    Posts
    19

    Need help in running First boot script


    Hello everyone,
    I need help running my first boot script. M using CentOS 6.4.
    the script i have is suppose to change the network configuration. and it is suppose to be interactive. i is just getting hostname, ip address, domain, mask, dns ..., does ip validation and then copy those variable to /etc/sysconfig/network-scripts/ifcfg-eth0, /etc/resolv.conf and /etc/sysconfig/network. and also export those variables in /etc/profile.d/...

    Things i have done so far:
    - add my script to /etc/init.d using kickstart post install section.
    - changed its mode to 755
    - add my script to chkconfig (success)
    - chkconfig myscript on (success)
    - my script has " chkconfig: 2345 10 98 "

    But after this i have a problem, when i boot up my VM, it gets stuck when white color fills up the centos 6.4 bar. like in attached picture and won't boot.
    Capture.jpg

    i know my script works cuz if i boot my VM and go into interactive mode from grub screen, then i can use my script.

    I know there should be some easy way to do it from normal boot process.

    if m no clear enough please let me know.
    I will really appreciate your help.
    Thank you

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,390
    Let me guess: The usecase is to provision VMs?
    The traditional way to do this is via a kickstart file.
    This can be used in a ISO based as well as a PXE based install.
    In a kickstart file you can define all parameters needed for an unattended install, including network parameters.

    If you want to go one step further, then razor might be for you.
    I am playing with it right now.
    The basic idea is to pxe chainboot into a mini linux (so called razor microkernel), that scans and classifies a node.
    This data gets fed back to the razor server.
    If a node is known, a local boot will be initiated.
    If a node is unknown, then an ISO image + parameters is initiated based on rules.
    ie: you can define, which host will get (re)installed or booted into a diagnosis ISO or a wipe ISO, etc

    This is for a network reachable VMs, addressed to one or multiple users.
    For pure local VMs kickstart files and "host only" networks on a given workstation should be good enough.
    Last edited by Irithori; 05-15-2013 at 07:47 PM.
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Dec 2012
    Posts
    19
    Thanks for the quick response.
    M kinda new to the linux, half the things i don't understand. .. but yes it is for provisioning. but only the Main/ Management VM, which will have Chef installed and We configure nodes using Chef.

    the VM image that i m planning to export has "custom host only" network. not sure how can i define network parameters in kickstart file.
    So, if i can know how to have my script run as first boot in general boot sequence then it would solve my issue.

  4. #4
    Just Joined!
    Join Date
    Dec 2012
    Posts
    19
    Now i know what network parameter you are talking about. since network info will be different and static for each Mgt VM, and we are using same kickstart file for all. will that work and how?

    Is there any solution on how to use my script, interact with user and get network information.

  5. #5
    Just Joined!
    Join Date
    Dec 2012
    Posts
    19
    Thanks for the quick response.
    M kinda new to the linux, half the things i don't understand. .. but yes it is for provisioning. but only the Main/ Management VM, which will have Chef installed and We configure nodes using Chef.

    the VM image that i m planning to export has "custom host only" network. not sure how can i define network parameters in kickstart file.
    So, if i can know how to have my script run as first boot in general boot sequence and be interactive then it would solve my issue.

  6. #6
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,390
    I dislike the idea of having such a first boot script, because you need to inject it somehow (ok, you solved that)
    and it is not a completely unattendend installation.

    Your sript is a possibility, but imho an unneccessary duplication of existing functionality.
    Setting network can be done in kickstart file or via dhcp.

    kickstart
    This is not clean, as it introduces redundancy. But if only one or a few machines are to deployed, then maybe having multiple kickstart files is a quick solution.

    dhcp
    In a regular network, I would use dhcp with fixed addresses based on mac addresses.
    You can pass e.g. host and domainname, just like default gw, ntp, dns.
    You must always face the curtain with a bow.

  7. #7
    Just Joined!
    Join Date
    Dec 2012
    Posts
    19
    The thing is, there will be many mgt VM. dont think it is a good idea to have multiple kickstart files. We will be using dhcp to setup the node VM by the mgt VM. but to setup that Mgt VM i need to configure its network first.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •