|

Installing one Linux from another

I have recently acquired a new computer without an operating system, and I wish to install Oracle Enterprise Linux version 9.1 on it. The ISO file required for the installation is located on an NFS file server, accessible through a network infrastructure. The hardware boots using uEFI, and I have a USB disk-on-key containing Ubuntu 22.04. As recreating a new USB disk-on-key containing Oracle Linux will take a considerable amount of time due to the size of the ISO file, I will use the Ubuntu to boot and start the installation process.

Here are the steps required to start an Oracle Linux installation:

  1. Create a small FAT32 partition (600MB or smaller) on the SSD disk (partition #1).
  2. Create a small ext4 partition (1GB or smaller) on the SSD disk (partition #2).
  3. Mount the ISO file (accessible through mounting the NFS share) and copy the contents of the /EFI directory to the mounted /dev/sda1 partition.
  4. Copy the contents of /images/pxeboot (vmlinuz and initrd.img) from the ISO into the mounted /dev/sda2 partition.
  5. Set a label to /dev/sda2.
  6. Edit the grub.cfg located in /dev/sda1/BOOT/grub.cfg and update the label to point to the 2nd partition, the path of vmlinuz and initrd to be relative to that path, and the location of inst.stage2 parameter to point to the NFS location of the ISO file.
  7. Reboot and load GRUBX64.EFI in the EFI shell or booting a file (if your BIOS supports manual booting).

Here is a detailed explanation of each step:

1. Create the partitions

To create the partitions, erase the contents of the disk (/dev/sda) after ensuring that it is not the USB disk-on-key. You can use the following command to create partitions of 600MB and 1GB respectively:

parted -s /dev/sda "mklabel msdos mkpart primary 1 600M mkpart primary 600M 1600M"
mkfs.vfat /dev/sda1
mkfs.ext4 -L boot /dev/sda2

2. Create temporary destinations

Create a temporary destination to mount the partitions:

mkdir -p /mnt/efi
mkdir -p /mnt/boot
mount /dev/sda1 /mnt/efi
mount /dev/sda2 /mnt/boot

3. Mount the ISO file

Mount the ISO file on the NFS server share:

mkdir -p /mnt/nfs
mkdir -p /mnt/iso
apt install -y nfs-common # to satisfy Ubuntu requirements to mount NFS shares
mount server:/share/ISO/Oracle_Ent_Linux/ /mnt/nfs
mount -o loop /mnt/nfs/OracleLinux-R9-U1-x86_64-dvd.iso /mnt/iso

4. Copy the necessary files

Copy the necessary files to boot from the ISO:

cp -R /mnt/iso/EFI/BOOT /mnt/efi/
cp /mnt/iso/images/pxeboot/vmlinuz /mnt/boot/
cp /mnt/iso/images/pxeboot/initrd.img /mnt/boot/

5. Set a label

Set a label to the second partition:

e2label /dev/sda2 boot

6. Edit the grub.cfg file and modify it

Edit the grub.cfg file in /mnt/efi/BOOT/grub.cfg

nano /mnt/efi/BOOT/grub.cfg  # Use whatever text editor you like

Modify the following lines:

The line starting with the word “search”:

We should modify the syntax after the ‘-l’ flag to ‘boot’. This is the label given to our /dev/sda2 partition.

search --no-floppy --set=root -l 'boot'

The line starting with linuxefi (the first appearance only). Two changes:

Modify the path of the kernel from

linuxefi /images/pxeboot/vmlinuz

to

linuxefi /vmlinuz

to point at the relative (to /dev/sda2) location of the kernel (vmlinuz)

Modify the value of inst.stage2 to point to the ISO file location. In my example: server:/share/ISO/Oracle_Ent_Linux/OracleLinux-R9-U1-x86_64-dvd.iso

inst.stage2=nfs:server:/share/ISO/Oracle_Ent_Linux/OracleLinux-R9-U1-x86_64-dvd.iso

Provide the full path to the ISO file.

The line starting with inirdefi (the first appearance only):

Modify the path of the initrd.img from

initrdefi /images/pxeboot/initrd.img

to

initrdefi /initrd.img

to point to the relative (to /dev/sda2) location of the initramfs (initrd.img)


Finish

The last step is to reboot the system and load GRUBX64.EFI from the EFI shell. Alternatively, if your BIOS supports manual booting a file, you can manually load GRUBX64.EFI to start the installation using the BIOS internal file browser.

To reboot the system, type:

reboot

Once the system has rebooted, either enter the BIOS or the EFI shell. The method for accessing the EFI shell varies depending on the computer manufacturer.

From the BIOS file browser, if exists, load the file GRUBX64.EFI inside /BOOT

From the EFI shell, locate and load GRUBX64.EFI. The location of GRUBX64.EFI may vary depending on your setup.

Once you have located GRUBX64.EFI, load it using the following command:

fs0:\BOOT\GRUBX64.EFI

Assuming that fs0 is the correct file system for your system. If you receive an error, try fs1 or fs2.

Once GRUBX64.EFI has been loaded, you will be presented with the GRUB menu. Select the Oracle Enterprise Linux installation option and follow the prompts to complete the installation.

In summary, to install Oracle Enterprise Linux version 9.1 on a computer without an operating system installed, you will need to create a small FAT32 partition and a small ext4 partition on the SSD disk, mount the ISO file located on an NFS file server, copy the contents of the /EFI directory to the mounted FAT32 partition, copy the vmlinuz and initrd.img files from the /images/pxeboot directory of the ISO to the mounted ext4 partition, edit the grub.cfg file located in the mounted FAT32 partition, reboot the system, and load GRUBX64.EFI to start the installation.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.