Static IP addresses with kickstart installation of CentOS 7

13,430

The error message indicates "missing --device" so a good thing to try is associating a device with the network configuration line:

network  --bootproto=static --ip=... --device=eno1

This may be problematical if the device names are coming up with some unknown name depending on their PCI position, though there are other options to control that (e.g. PXE booting things with ksdevice=eth0 net.ifnames=0 biosdevname=0 kernel arguments). In particular, the redhat "Installation Guide" docs indicate that the device name really should be specified:

Note that this is considered deprecated behavior; in most cases, you should always specify a --device= for every network command. The behavior of any subsequent network command in the same Kickstart file is unspecified if its --device= option is missing.

Share:
13,430

Related videos on Youtube

RabT
Author by

RabT

Updated on September 18, 2022

Comments

  • RabT
    RabT over 1 year

    The following error is being thrown when a kickstart file is used to install a CentOS 7 guest virtual machine with static IP networking:

    [3.835698] dracut-cmdline[81]: parse-kickstart ERROR: 
        'network --bootproto=static --ip=12.34.567.8aa --netmask=255.255.255.248 --gateway=12.34.567.8bb --nameserver=xx.xx.xx.xx,xx.xx.yy.yy': 
        missing --device
    

    I suspect that the problem is that bridge networking with static IP has not been set up at the host to replace the default NAT configuration. But what specific commands need to be typed in order to set resolve this error?


    Kickstart file:

    The kickstart file is:

    #version=RHEL7
    # System authorization information
    auth --enableshadow --passalgo=sha512
    
    # Run the Setup Agent on first boot
    firstboot --enable
    ignoredisk --only-use=sda
    # Keyboard layouts
    keyboard --vckeymap=us --xlayouts='us'
    # System language
    lang en_US.UTF-8
    
    # Network information
    network  --device=eno1 --onboot=on --activate
    network  --bootproto=static --ip=12.34.567.8aa --netmask=255.255.255.248 --gateway=12.34.567.8bb --nameserver=xx.xx.xx.xx,xx.xx.yy.yy
    network  --hostname=localhost.localdomain
    # Root password
    rootpw --iscrypted someLongHashedPassword
    # System timezone
    timezone someTimeZone --isUtc --nontp
    user --name=someUserName --password=someLongHashedPassword --iscrypted --gecos="someUserName"
    # System bootloader configuration
    bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
    # Partition clearing information.  Erases all partitions from the sda drive.
    clearpart --all --initlabel --drives=sda
    # Disk partitioning information
    part pv.204 --fstype="lvmpv" --ondisk=sda --size=1902212
    part /boot/efi --fstype="efi" --ondisk=sda --size=200 --fsoptions="umask=0077,shortname=winnt"
    part /boot --fstype="xfs" --ondisk=sda --size=500
    volgroup centos --pesize=4096 pv.204
    logvol /  --fstype="xfs" --grow --maxsize=51200 --size=1024 --name=root --vgname=centos
    logvol /home  --fstype="xfs" --size=230400 --name=home --vgname=centos
    logvol swap  --fstype="swap" --size=7808 --name=swap --vgname=centos
    
    %packages
    @base
    @compat-libraries
    @core
    @debugging
    @development
    @network-file-system-client
    @remote-system-management
    @security-tools
    @smart-card
    @virtualization-hypervisor
    @virtualization-platform
    @virtualization-tools
    @virtualization-client
    kexec-tools
    
    %end
    
    %addon com_redhat_kdump --enable --reserve-mb='auto'
    
    %end
    


    virt-install Command:

    For reference, the virt-install command that triggers the install is:

    virt-install \
       --name=public-centos7 \
       --disk path=/dev/mapper/centos-fifth,size=241 \
       --graphics none --vcpus=1 --memory=2048 \
       --location /tmp/CentOS-7-x86_64-Minimal-1611.iso \
       --network bridge=virbr0 --os-type=linux --os-variant=rhel7.0 \
       --initrd-inject=/tmp/vm.ks \
       --extra-args "ks=file:/tmp/vm.ks console=ttyS0"
    


    Current Config:
    Also, brctl show on the host machine gives:

    [root@remote-host ~]# brctl show
    bridge name     bridge id               STP enabled     interfaces
    virbr0          8000.525400c4a345       yes             virbr0-nic
                                                            vnet0
    


    Adding --device=eno1

    Per @thrig's suggestion, I changed the offending line of the kickstart file to become:

    # Network information
    network  --onboot=on --activate
    network  --bootproto=static --ip=12.34.567.8aa --netmask=255.255.255.248 --gateway=12.34.567.8bb --nameserver=xx.xx.xx.xx,xx.xx.yy.yy --device=eno1
    network  --hostname=localhost.localdomain  
    

    This seems to have resolved the error. But I am not yet certain because I am still resolving downstream problems.

  • RabT
    RabT about 7 years
    Thank you and +1 for quickly enabling me to move on to downstream issues. I have re-framed the downstream question after more careful examination and research/tinkering. Are you willing to comment? Here is the link: unix.stackexchange.com/questions/352181/…
  • Centimane
    Centimane over 6 years
    Also worth noting from the documentation you can use link as the device so as to avoid hard coding the interface name, and it will select the first NIC with an active link.