4

Ultimate goal: Create an automated installation disk for CentOS, using a kickstart config file stored on an internal website.

What I've done: Created a script that

  1. downloads an ISO
  2. unpacks it
  3. updates the isolinux.cfg file with my own menu option
  4. recreates the ISO using genisoimage

All of this works, and the ISO is recreated without any errors. However, when I try to use the ISO, to start an installation, the sistem always dies at:

"new value non-existent xfs filesystem is not valid as a default fs type"
Pane is dead

Unlike this question here, my error happens pre-installation, and I'm already using lang = en_US.UTF-8. I even tried en_US, but it did not make a difference.

Lines I added to the isolinux.cfg file:

label install
  menu label ^Kickstart Installation
  menu default
  kernel vmlinuz
  append initrd=initrd.img text ramdisk=100000 lang=en_US.UTF-8 keymap=us ipv6.disable=1 ip=dhcp install inst.ks=cdrom:/kickstart.cfg

I searched online for the error, and a lot of comments seem to be related to mismatching versions for init and the kernel, or corrupted files. I am not replacing any files, and the only change I make is to the configuration file isolinux.cfg. There is no mixing of files from different versions/DVDs/images.

Has anyone had/seen the above, and have any ideas on what I should try next? I've tried playing around with the options I am putting into the file, but it doesn't seem to make a difference.

Other Info

Original image: CentOS 7.2 - DVD ISO

State of the system:

Ctrl-Alt-F1: Ctrl-Alt-F1

Ctrl-Alt-F2: Ctrl-Alt-F2

EDIT

Script that I am writing, as requested:

#!/bin/bash
#############################################################
function prepare {
    rm -rf ${ISO_EXTRACTION_DIR}
    if [ -d ${ISO_MOUNT_DIR} ]
    then
        umount ${ISO_MOUNT_DIR} 2>&1 || true
        rm -rf ${ISO_MOUNT_DIR}
    fi
    mkdir -p ${ISO_MOUNT_DIR} ${ISO_EXTRACTION_DIR}
}

function extract_iso {
    echo "Extracting ISO"

    cd $(dirname ${ISO_MOUNT_DIR})
    cp -pRf ${ISO_MOUNT_DIR}/* ${ISO_EXTRACTION_DIR}

    echo "Extracted $(ls ${ISO_EXTRACTION_DIR} | wc -l) files and directories from ISO"
}

function update_config {
    echo "Updating configuration"
    cd ${ISO_EXTRACTION_DIR}

    if [ -d "isolinux" ]
    then
        isolinux_cfg_file="${ISO_EXTRACTION_DIR}/isolinux/isolinux.cfg"
    else
        isolinux_cfg_file="${ISO_EXTRACTION_DIR}/isolinux.cfg"
    fi

    sed -i 's/timeout 600/timeout 50/' ${isolinux_cfg_file}  # Shorten timeout
    sed -i '/menu default/d' ${isolinux_cfg_file}            # Delete existing menu default
    echo "label linux" >> ${isolinux_cfg_file}
    echo "  menu default" >> ${isolinux_cfg_file}
    echo "  kernel vmlinuz" >> ${isolinux_cfg_file}
    echo "  append initrd=initrd.img text ramdisk=100000 lang=en_US.UTF-8 keymap=us ipv6.disable=1 ip=dhcp install inst.ks=cdrom:/kickstart.cfg" >> ${isolinux_cfg_file}
}

function repackage_iso {
    echo "Repackaging ISO"

    cd ${ISO_EXTRACTION_DIR}
    volume_id="${LINUX_DISTRO}-${LINUX_VERSION}-bootable"

    if [ -d "isolinux" ]
    then
        boot_cat_file="isolinux/boot.cat"
        isolinux_bin_file="isolinux/isolinux.bin"
    else
        boot_cat_file="boot.cat"
        isolinux_bin_file="isolinux.bin"
    fi

    iso_file_name="$(echo $(basename ${IMAGE_FILENAME}) | cut -d '.' -f 1)-bootable.iso"

    genisoimage \
        -U -r -v -T -J -joliet-long \
        -V 'CentOS 7 x86_64' \
        -volset "${LINUX_DISTRO}-${LINUX_VERSION}" \
        -A "${LINUX_DISTRO}-${LINUX_VERSION}" \
        -b ${isolinux_bin_file} \
        -c ${boot_cat_file} \
        -no-emul-boot \
        -boot-load-size 4 \
        -boot-info-table \
        -eltorito-alt-boot \
        -e images/efiboot.img \
        -no-emul-boot \
        -o "${IMAGE_DIR}/${iso_file_name}" .
}

prepare
check_input
mount_iso
extract_iso
unmount_iso
update_config
repackage_iso
Sagar
  • 524
  • 3
  • 7
  • 20
  • 1
    Red Hat's knowledgebase [suggests](https://access.redhat.com/solutions/697913) this happens when you mix and match bits from _different_ install media. Are you absolutely 100% certain you used files from the same ISO image for every part of the process? How do you know? Can you share the script you used to prepare the ISO image? (And why are you using out of date media anyway?) – Michael Hampton Apr 30 '18 at 18:53
  • 100% certain. I clear out the extracted data folder at each run of the script; also, I unmount the "pure" ISO as soon as I have extracted files/folders from it. I started at the latest, and then went backwards. I had read some post online that mentioned issue with 7.3. That wasn't the issue here, though. I'll post the relevant portions of the script I'm using soon. – Sagar Apr 30 '18 at 19:22
  • Hm. I think part of the script is missing. But what's there suggests to me that perhaps you aren't using the original CentOS ISO image to start with. Check its sha256sum, or just go get a fresh copy. – Michael Hampton Apr 30 '18 at 21:24
  • Why do you say that? Just wondering because it may point me to something...I am downloading the original ISO at every run, so I can ensure it is a fresh copy (I didn't post that, because there's other stuff that's downloaded, that I couldn't show). Sorry! – Sagar Apr 30 '18 at 21:27
  • Because, that is the _only_ known circumstance in which this error occurs. – Michael Hampton Apr 30 '18 at 21:29
  • I think when your script copied the ISO with `cp`, it destroyed all the SELinux contexts. You should add `--preserve=context` to that `cp` command line. If you don't think you need SElinux, set `SELINUX=permissive` in `/etc/selinux/config`. Can't be sure that this is what's causing your failure, but it's likely what's causing all those audit messages in the console. – Mike Andrews Jun 28 '18 at 21:28

2 Answers2

6

I was having the exact same problem until I realized that I hadn't updated my pxe tftpboot environment to agree with my up-to-date Centos 7.5 media, by copying Centos-7.5-version files from centos/7/os/x86_64/isolinux/.

user247671
  • 91
  • 5
  • That wasn't it. I wasn't doing anything with PXE, but also I tried versions from 7.5 down to 7.1, and none of them worked. However, +1, since it is a valid cause of the error – Sagar Jun 29 '18 at 13:07
0

I got it working a few days ago, but forgot to post here (sorry!). Answering my own question, in case it helps anyone else.

Instead of replacing the entire menu option, I had to use sed to modify parts of it to what I wanted. It wasn't as clean, but it did what I wanted, so I let it be:

sed -i 's/timeout 600/timeout 50/' ${isolinux_cfg_file}
sed -i '/menu default/d' ${isolinux_cfg_file}
sed -i '/label linux/a\
menu default' ${isolinux_cfg_file}   # this line is badly indented on purpose. Do not change it.
sed -i 's/quiet//' ${isolinux_cfg_file}

I think part of it was the missing stage2 option on the append line.

I won't "Accept" this answer, in case someone else has a better explanation for why this worked vs creating a new menu option.

Sagar
  • 524
  • 3
  • 7
  • 20