1

Normally when installing CentOS 7, you download the ISO, write it to a thumb drive and boot it. However, I have a unique scenario where I'd like to be able to place the CentOS 7 installation files on a system's /boot/ partition and create a custom GRUB2 entry that can boot into that environment. This can then be used to install CentOS 7 on the same system.

I know this sounds silly, but I have my reasons..

After doing some research, I'm trying to piece together how this works. Here is what I'm seeing in my head currently:

  1. GRUB2 would load the CentOS 7 kernel vmlinuz and initrd.img.
  2. After initializing the kernel and loading the initrd.img into memory, the dracut-initqueue service starts.
  3. The dracut-initqueue processes will then try to load the stage2 image, which holds the installation runtime (Anaconda in this case).
  4. Finally, the CentOS installation process kicks off.

So to start I..

  1. Downloaded the ISO, mounted it and copied the /images/pxeboot/vmlinuz, /images/pxeboot/initrd.img and /LiveOS/squashfs.img (which I believe contains the stage2 image) files to my /boot/ partition.
  2. Added the below entry to /etc/grub.d/40_custom.
menuentry "CentOS 7 Installation" {
set root=(hd0,msdos1)
linux   /centos7-install/vmlinuz initrd=initrd.img stage2=/centos7-install/squashfs.img
initrd  /centos7-install/initrd.img
}

After doing the above, I would hope that I would at least get up to loading Anaconda, however instead it simply loads up to "dracut-initqueue timeout" messages. Sadly, I haven't had any luck finding any logs that hint towards exactly what went wrong.

Would anyone happen to have any ideas on how to go about this?

azurepancake
  • 141
  • 1
  • 8
  • 1
    https://www.howtogeek.com/196933/how-to-boot-linux-iso-images-directly-from-your-hard-drive/ – Bert Jan 15 '21 at 20:27

1 Answers1

0

Replace the following line

linux   /centos7-install/vmlinuz initrd=initrd.img stage2=/centos7-install/squashfs.img

with

linux   /centos7-install/vmlinuz inst.repo=<source>

where <source> can be http://host/path with a complete copy of the directories and files on the full installation DVD. Optionally, you can extract files from "boot" ISO and copy just .treeinfo file from "DVD" ISO. See additional options (like NFS) in the documentation.

Of course, network access is required to use this method "as is".

Anton
  • 1
  • 1