Skip to content

Conversation

@priyama2
Copy link
Contributor

@priyama2 priyama2 commented Jun 9, 2025

ks file: http://10.40.71.8/powervmks/rhel/rhel-ae:e2:fd:10:0c:01.ks
log path : http://10.48.0.30//LOGS/installvm-20250609-072202.log
from lpar:

[priya@ktes ~]$ ssh root@donalp11
Warning: Permanently added 'donalp11,10.48.0.236' (ECDSA) to the list of known hosts.
root@donalp11's password:
[root@donalp11 ~]# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
nvme1n1     259:1    0  23.3G  0 disk
nvme1n2     259:3    0  23.3G  0 disk
└─nvme1n2p1 259:4    0  23.3G  0 part
  └─md1       9:1    0  23.2G  0 raid1 /
nvme1n3     259:6    0  23.3G  0 disk
└─nvme1n3p1 259:7    0  23.3G  0 part
nvme1n4     259:9    0  23.3G  0 disk
nvme1n5     259:11   0  23.3G  0 disk
nvme1n6     259:13   0  23.3G  0 disk
nvme1n7     259:15   0 116.4G  0 disk
├─nvme1n7p1 259:16   0     8M  0 part
├─nvme1n7p2 259:17   0     2G  0 part  /boot
└─nvme1n7p3 259:18   0 114.4G  0 part
  └─md1       9:1    0  23.2G  0 raid1 /
[root@donalp11 ~]# cd /root
[root@donalp11 ~]# ls
anaconda-ks.cfg  original-ks.cfg  post-install.log
[root@donalp11 ~]# cat po*
+ echo '>> Determining boot disk from /boot mount'
>> Determining boot disk from /boot mount
++ lsblk -P -o NAME,TYPE,MOUNTPOINT
++ awk '
        {
            name=""; mount="";
            for (i = 1; i <= NF; i++) {
                if ($i ~ /^NAME=/) {
                    gsub(/NAME=|"/, "", $i);
                    name = $i;
                }
                if ($i ~ /^MOUNTPOINT="\/boot"/) {
                    gsub(/MOUNTPOINT=|"/, "", $i);
                    mount = $i;
                }
            }
            if (mount == "/boot") {
                cmd = "lsblk -ndo PKNAME /dev/" name;
                cmd | getline parent;
                close(cmd);
                print "/dev/" parent;
                exit;
            }
        }'
+ BOOTDISK=/dev/nvme1n7
+ echo '>> Setting bootlist to /dev/nvme1n7'
>> Setting bootlist to /dev/nvme1n7
+ bootlist -m normal /dev/nvme1n7 -o
nvme0
nvme1n7
+ echo '>> Configuring SSH to skip StrictHostKeyChecking'
>> Configuring SSH to skip StrictHostKeyChecking
+ mkdir -p /root/.ssh
+ cat
+ chmod 600 /root/.ssh/config
[root@donalp11 ~]#  

ks file:

%pre --interpreter /bin/bash
        DISK_LIST="{{ vmParser.args.host_disk }}"
        for dev in $DISK_LIST; do
                echo "Wiping $dev ..."
                dd if=/dev/zero of=$dev bs=512 count=2048 status=none
        done
%end
url --url=http://10.40.71.11:81/crtl/repo/rhel/9.6le/GA/BaseOS
text
keyboard --vckeymap=us --xlayouts='us'
lang en_US.UTF-8
rootpw --plaintext BraceUP11iscoming!
skipx
timezone Asia/Kolkata --isUtc
zerombr
clearpart --all --initlabel --drives=/dev/disk/by-id/nvme-eui.36455630527025070025384100000007,/dev/disk/by-id/nvme-eui.36455630527025070025384100000002
bootloader --location=mbr --boot-drive=/dev/disk/by-id/nvme-eui.36455630527025070025384100000007
ignoredisk --only-use=/dev/disk/by-id/nvme-eui.36455630527025070025384100000007,/dev/disk/by-id/nvme-eui.36455630527025070025384100000002
part prepboot --fstype=prepboot --size=8 --ondisk=/dev/disk/by-id/nvme-eui.36455630527025070025384100000007
part /boot --fstype=xfs --size=2048 --ondisk=/dev/disk/by-id/nvme-eui.36455630527025070025384100000007
part raid.01 --fstype=mdmember --size=1 --grow --ondisk=/dev/disk/by-id/nvme-eui.36455630527025070025384100000007
part raid.02 --fstype=mdmember --size=1 --grow --ondisk=/dev/disk/by-id/nvme-eui.36455630527025070025384100000002
raid / --fstype=xfs --level=1 --device=md1 raid.01 raid.02
services --enabled=NetworkManager,sshd
reboot
%packages
@core
kexec-tools
device-mapper-multipath
%end
%post 
sed -i 's/#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;service sshd restart;multipath -t >/etc/multipath.conf;service multipathd start

--interpreter /bin/bash
        exec > /root/post-install.log 2>&1
        set -x

        echo ">> Determining boot disk from /boot mount"
        BOOTDISK=$(lsblk -P -o NAME,TYPE,MOUNTPOINT | awk '
        {
            name=""; mount="";
            for (i = 1; i <= NF; i++) {
                if ($i ~ /^NAME=/) {
                    gsub(/NAME=|"/, "", $i);
                    name = $i;
                }
                if ($i ~ /^MOUNTPOINT="\/boot"/) {
                    gsub(/MOUNTPOINT=|"/, "", $i);
                    mount = $i;
                }
            }
            if (mount == "/boot") {
                cmd = "lsblk -ndo PKNAME /dev/" name;
                cmd | getline parent;
                close(cmd);
                print "/dev/" parent;
                exit;
            }
        }')

        echo ">> Setting bootlist to $BOOTDISK"
        bootlist -m normal $BOOTDISK -o

        echo ">> Configuring SSH to skip StrictHostKeyChecking"
        mkdir -p /root/.ssh
        cat <<EOF > /root/.ssh/config
Host *
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
EOF
        chmod 600 /root/.ssh/config

        # Optional: Uncomment to install your SSH key
        %end

Signed-off-by: priyama2 <priyama2@in.ibm.com>
root_disks = full_disks # / can be on all disks (RAID or not)
vmParser.args.host_disk = ",".join(full_disks)
print(f"{boot_disk}")
print(f"{root_disks}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please push this into the logger

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes are in-progress

full_disks = ["/dev/disk/by-id/" + disk.strip() for disk in disks]
boot_disk = full_disks[0] # /boot only on first disk
root_disks = full_disks # / can be on all disks (RAID or not)
vmParser.args.host_disk = ",".join(full_disks)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we have given single disk is this work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When single disk, as of now install fails, since raid requires at least 2 disks.
As discussed if user specifies one disk then it will be considered as default 'plain' mode of install
Changes are in-progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants