Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reinstall GRUB2 on a PReP boot partition #647

Open
janagoudarniroop opened this issue Aug 20, 2024 · 2 comments
Open

reinstall GRUB2 on a PReP boot partition #647

janagoudarniroop opened this issue Aug 20, 2024 · 2 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@janagoudarniroop
Copy link

What happened:
We are attempting to update and reinstall GRUB2 on a PReP boot partition for our system but need assistance in identifying the correct PReP device. The process involves:

Identifying the correct PReP partition using lsblk or fdisk.

-Updating GRUB2 (dnf update grub2).
-Installing GRUB2 on the identified PReP partition (grub2-install /dev/[prep-partition]).
-Setting the boot list with bootlist -m normal -o /dev/[prep-partition].
We require guidance on reliably identifying the PReP partition to complete the installation.

Find the PReP partition with /dev/mapper

prep_partition=$(fdisk -l | grep -i ppc | grep -i mapper | awk '{print $1}')

Check if a PReP partition was found

if [ -z "$prep_partition" ]; then
echo "No PReP partition found with /dev/mapper."
exit 1
else
echo "PReP partition found: $prep_partition"
fi

Update grub2

echo "Updating grub2..."
dnf update -y grub2

Install grub2 on the identified PReP partition

echo "Installing grub2 on $prep_partition..."
grub2-install "$prep_partition"

Execute bootlist command

echo "Setting boot list..."
bootlist -m normal -o

What you expected to happen:

The pvsadm is not able to pick the correct disk .

How to reproduce it (as minimally and precisely as possible):

This is how the layout looks when we create a power vs server on top of bare-metal server:
Last login: Mon Aug 19 01:39:11 on hvc0
[root@localhost ~]#
[root@localhost ~]# fdisk -l
Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x14fc63d2

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 10239 8192 4M 41 PPC PReP Boot
/dev/sda2 10240 20971519 20961280 10G 83 Linux

and we need to use /dev/sda1 to re-install the grub.

So what should the disk name we need to use in template script when we are trying to build the image using pvsadm tool?

This is the disk layout when we try to print the partitions using these below commands in our template script.

echo "-----------Printing Disk Layout----------"
echo -e "\n---------\n$(df /)\n------"
echo -e "\n---------\n$(df -h)\n------"
echo -e "\n---------\n$(fdisk -l)\n------"
-----------Printing Disk Layout----------

---------
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/loop1p2   104842220 2970752 101871468   3% /
------

---------
Filesystem                                      Size  Used Avail Use% Mounted on
/dev/loop1p2                                    100G  2.9G   98G   3% /
devtmpfs                                        718G     0  718G   0% /dev
tmpfs                                           718G  103M  718G   1% /run
/dev/mapper/3600507681381026e88000000000017fc2  100G  7.8G   93G   8% /etc/machine-id
------

---------
Disk /dev/sda: 350 GiB, 375809638400 bytes, 734003200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes


Disk /dev/sdd: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disklabel type: dos
Disk identifier: 0x14fc63d2

Device     Boot Start       End   Sectors  Size Id Type
/dev/sdd1  *     2048     10239      8192    4M 41 PPC PReP Boot
/dev/sdd2       10240 209715166 209704927  100G 83 Linux


Disk /dev/sdb: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disklabel type: dos
Disk identifier: 0x14fc63d2

Device     Boot Start       End   Sectors  Size Id Type
/dev/sdb1  *     2048     10239      8192    4M 41 PPC PReP Boot
/dev/sdb2       10240 209715166 209704927  100G 83 Linux


Disk /dev/sdc: 350 GiB, 375809638400 bytes, 734003200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes


Disk /dev/sde: 350 GiB, 375809638400 bytes, 734003200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes


Disk /dev/sdm: 350 GiB, 375809638400 bytes, 734003200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes


Disk /dev/sdk: 350 GiB, 375809638400 bytes, 734003200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes


Disk /dev/sdf: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disklabel type: dos
Disk identifier: 0x14fc63d2

Device     Boot Start       End   Sectors  Size Id Type
/dev/sdf1  *     2048     10239      8192    4M 41 PPC PReP Boot
/dev/sdf2       10240 209715166 209704927  100G 83 Linux


Disk /dev/sdo: 350 GiB, 375809638400 bytes, 734003200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes


Disk /dev/sdi: 350 GiB, 375809638400 bytes, 734003200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes


Disk /dev/sdj: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disklabel type: dos
Disk identifier: 0x14fc63d2

Device     Boot Start       End   Sectors  Size Id Type
/dev/sdj1  *     2048     10239      8192    4M 41 PPC PReP Boot
/dev/sdj2       10240 209715166 209704927  100G 83 Linux


Disk /dev/sdn: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disklabel type: dos
Disk identifier: 0x14fc63d2

Device     Boot Start       End   Sectors  Size Id Type
/dev/sdn1  *     2048     10239      8192    4M 41 PPC PReP Boot
/dev/sdn2       10240 209715166 209704927  100G 83 Linux


Disk /dev/sdl: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disklabel type: dos
Disk identifier: 0x14fc63d2

Device     Boot Start       End   Sectors  Size Id Type
/dev/sdl1  *     2048     10239      8192    4M 41 PPC PReP Boot
/dev/sdl2       10240 209715166 209704927  100G 83 Linux


Disk /dev/sdp: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disklabel type: dos
Disk identifier: 0x14fc63d2

Device     Boot Start       End   Sectors  Size Id Type
/dev/sdp1  *     2048     10239      8192    4M 41 PPC PReP Boot
/dev/sdp2       10240 209715166 209704927  100G 83 Linux


Disk /dev/sdg: 350 GiB, 375809638400 bytes, 734003200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes


Disk /dev/sdh: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disklabel type: dos
Disk identifier: 0x14fc63d2

Device     Boot Start       End   Sectors  Size Id Type
/dev/sdh1  *     2048     10239      8192    4M 41 PPC PReP Boot
/dev/sdh2       10240 209715166 209704927  100G 83 Linux




Disk /dev/mapper/3600507681381026e88000000000017fb: 350 GiB, 375809638400 bytes, 734003200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes


Disk /dev/mapper/3600507681381026e88000000000017fc: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disklabel type: dos
Disk identifier: 0x14fc63d2

Device                                         Boot Start       End   Sectors  Size Id Type
/dev/mapper/3600507681381026e88000000000017fc1 *     2048     10239      8192    4M 41 PPC PReP Boot
/dev/mapper/3600507681381026e88000000000017fc2      10240 209715166 209704927  100G 83 Linux


Disk /dev/mapper/data_vg-data_lv: 350 GiB, 375805444096 bytes, 733995008 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes


Disk /dev/loop0: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x14fc63d2

Device       Boot Start       End   Sectors  Size Id Type
/dev/loop0p1 *     2048     10239      8192    4M 41 PPC PReP Boot
/dev/loop0p2      10240 209715166 209704927  100G 83 Linux


Disk /dev/loop1: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x14fc63d2

Device       Boot Start       End   Sectors  Size Id Type
/dev/loop1p1 *     2048     10239      8192    4M 41 PPC PReP Boot
/dev/loop1p2      10240 209715166 209704927  100G 83 Linux
------

Anything else we need to know?:

Environment:

  • pvsadm version (use pvsadm version): pvsadm version
    Version: v0.1.15
  • Environment - On-Prem or IBM PowerVS: IBM PowerVS
  • OS (e.g: cat /etc/os-release):
    [root@build-server-8-8-sap ~]# cat /etc/os-release
    NAME="Red Hat Enterprise Linux"
    VERSION="8.8 (Ootpa)"
    ID="rhel"
    ID_LIKE="fedora"
    VERSION_ID="8.8"
    PLATFORM_ID="platform:el8"
    PRETTY_NAME="Red Hat Enterprise Linux 8.8 (Ootpa)"
    ANSI_COLOR="0;31"
    CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
    HOME_URL="https://www.redhat.com/"
    DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8"
    BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.8
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.8"

[root@build-server-8-8-sap ~]#

  • Kernel (e.g. uname -a):
    [root@build-server-8-8-sap ~]# uname -a
    Linux build-server-8-8-sap.power-iaas.cloud.ibm.com 4.18.0-477.51.1.el8_8.ppc64le Update go.yml #1 SMP Fri Mar 1 11:20:14 EST 2024 ppc64le ppc64le ppc64le GNU/Linux
  • Others:
@janagoudarniroop janagoudarniroop added the kind/bug Categorizes issue or PR as related to a bug. label Aug 20, 2024
@KeerthanaAP
Copy link
Contributor

@sudeeshjohn Could you help in this issue.

@sudeeshjohn
Copy link
Contributor

Locate the disk where the OS is installed and select the partition with type 41 using the fdisk -l <disk> command. For instance, if you need to identify the PReP Boot partition on a disk image



[root@scnlonprema temp]# losetup -f disk.raw
[root@scnlonprema temp]# 
[root@scnlonprema temp]# losetup
NAME       SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE                  DIO LOG-SEC
/dev/loop1         0      0         0  0 /data/OVAs/temp/disk.raw     0     512
/dev/loop0         0      0         1  0 /srv/node/drives/swift.img   0     512
[root@scnlonprema temp]# partprobe /dev/loop1
[root@scnlonprema temp]# 
[root@scnlonprema temp]# fdisk -l /dev/loop1
Disk /dev/loop1: 11 GiB, 11811160064 bytes, 23068672 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x14fc63d2

Device       Boot Start      End  Sectors Size Id Type
/dev/loop1p1 *     2048    10239     8192   4M 41 PPC PReP Boot
/dev/loop1p2      10240 23068638 23058399  11G 83 Linux
[root@scnlonprema temp]#

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants